summaryrefslogtreecommitdiffstats
path: root/scripts/mk/pkg-info.mk
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-08-07 13:30:08 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-08-07 13:30:08 +0000
commit44cf9c6d2d274eac37502e835155f7e985f1b8e6 (patch)
tree9576ba968924c5b9a55ba9e14f4f26184c62c7d4 /scripts/mk/pkg-info.mk
parentAdding upstream version 1.22.6. (diff)
downloaddpkg-44cf9c6d2d274eac37502e835155f7e985f1b8e6.tar.xz
dpkg-44cf9c6d2d274eac37502e835155f7e985f1b8e6.zip
Adding upstream version 1.22.7.upstream/1.22.7
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'scripts/mk/pkg-info.mk')
-rw-r--r--scripts/mk/pkg-info.mk36
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