diff options
Diffstat (limited to 'scripts/mk/pkg-info.mk')
-rw-r--r-- | scripts/mk/pkg-info.mk | 36 |
1 files changed, 27 insertions, 9 deletions
diff --git a/scripts/mk/pkg-info.mk b/scripts/mk/pkg-info.mk index bccde23..ddda4f7 100644 --- a/scripts/mk/pkg-info.mk +++ b/scripts/mk/pkg-info.mk @@ -12,16 +12,34 @@ # SOURCE_DATE_EPOCH: source release date as seconds since the epoch, as # specified by <https://reproducible-builds.org/specs/source-date-epoch/> # (since dpkg 1.18.8). +# If it is undefined, the date of the latest changelog entry is used. +# In both cases, the value is exported. -dpkg_late_eval ?= $(or $(value DPKG_CACHE_$(1)),$(eval DPKG_CACHE_$(1) := $(shell $(2)))$(value DPKG_CACHE_$(1))) +ifndef dpkg_pkg_info_mk_included +dpkg_pkg_info_mk_included = yes -DEB_SOURCE = $(call dpkg_late_eval,DEB_SOURCE,dpkg-parsechangelog -SSource) -DEB_VERSION = $(call dpkg_late_eval,DEB_VERSION,dpkg-parsechangelog -SVersion) -DEB_VERSION_EPOCH_UPSTREAM = $(call dpkg_late_eval,DEB_VERSION_EPOCH_UPSTREAM,echo '$(DEB_VERSION)' | sed -e 's/-[^-]*$$//') -DEB_VERSION_UPSTREAM_REVISION = $(call dpkg_late_eval,DEB_VERSION_UPSTREAM_REVISION,echo '$(DEB_VERSION)' | sed -e 's/^[0-9]*://') -DEB_VERSION_UPSTREAM = $(call dpkg_late_eval,DEB_VERSION_UPSTREAM,echo '$(DEB_VERSION_EPOCH_UPSTREAM)' | sed -e 's/^[0-9]*://') -DEB_DISTRIBUTION = $(call dpkg_late_eval,DEB_DISTRIBUTION,dpkg-parsechangelog -SDistribution) - -SOURCE_DATE_EPOCH ?= $(call dpkg_late_eval,SOURCE_DATE_EPOCH,dpkg-parsechangelog -STimestamp) +dpkg_parsechangelog_run = $(eval $(shell dpkg-parsechangelog | sed -n '\ + s/^Distribution: \(.*\)/$$(eval DEB_DISTRIBUTION:=\1)/p;\ + s/^Source: \(.*\)/$$(eval DEB_SOURCE:=\1)/p;\ + s/^Version: \([0-9]*:\)\{0,1\}\([^-]*\)\(\(.*\)-[^-]*\)\{0,1\}$$/\ + $$(eval DEB_VERSION:=\1\2\3)\ + $$(eval DEB_VERSION_EPOCH_UPSTREAM:=\1\2\4)\ + $$(eval DEB_VERSION_UPSTREAM_REVISION:=\2\3)\ + $$(eval DEB_VERSION_UPSTREAM:=\2\4)/p;\ + s/^Timestamp: \(.*\)/$$(eval SOURCE_DATE_EPOCH?=\1)/p')) +ifdef SOURCE_DATE_EPOCH + dpkg_lazy_eval ?= $(eval $(1) = $(2)$$($(1))) + $(call dpkg_lazy_eval,DEB_DISTRIBUTION,$$(dpkg_parsechangelog_run)) + $(call dpkg_lazy_eval,DEB_SOURCE,$$(dpkg_parsechangelog_run)) + $(call dpkg_lazy_eval,DEB_VERSION,$$(dpkg_parsechangelog_run)) + $(call dpkg_lazy_eval,DEB_VERSION_EPOCH_UPSTREAM,$$(dpkg_parsechangelog_run)) + $(call dpkg_lazy_eval,DEB_VERSION_UPSTREAM,$$(dpkg_parsechangelog_run)) + $(call dpkg_lazy_eval,DEB_UPSTREAM_REVISION,$$(dpkg_parsechangelog_run)) +else + # We need to compute the values right now. + $(dpkg_parsechangelog_run) +endif export SOURCE_DATE_EPOCH + +endif # dpkg_pkg_info_mk_included |