This is an automated email from the git hooks/post-receive script. guillem pushed a commit to branch main in repository dpkg.
View the commit online: https://git.dpkg.org/cgit/dpkg/dpkg.git/commit/?id=322971e3caf1c0ab5e37ef0d7e19e196126bcf30 commit 322971e3caf1c0ab5e37ef0d7e19e196126bcf30 (HEAD -> main) Author: Guillem Jover <guil...@debian.org> AuthorDate: Wed Dec 18 13:13:10 2024 +0100 scripts/mk: Add support for new DEB_VERSION_EPOCH and DEB_VERSION_REVISION This completes the parts of the source variable we are exposing via variables. This should make it possible to use these variables without having to call dpkg-parsechangelog directly. Closes: #1088244 --- scripts/mk/pkg-info.mk | 12 ++++++++++++ scripts/t/mk/pkg-info.mk | 4 ++++ 2 files changed, 16 insertions(+) diff --git a/scripts/mk/pkg-info.mk b/scripts/mk/pkg-info.mk index 7ed491558..017f51918 100644 --- a/scripts/mk/pkg-info.mk +++ b/scripts/mk/pkg-info.mk @@ -9,6 +9,11 @@ # DEB_VERSION: Package's full version. # Format: [epoch:]upstream-version[-revision] # Example: 1:2.3-4 +# DEB_VERSION_EPOCH: Package's epoch without the upstream-version or the +# Debian revision (since dpkg 1.22.12). The variable can be empty if +# there is no epoch. +# Format: [epoch] +# Example: 1 # DEB_VERSION_EPOCH_UPSTREAM: Package's version without the Debian revision. # Format: [epoch:]upstream-version # Example: 1:2.3 @@ -19,6 +24,11 @@ # or revision. # Format: upstream-version # Example: 2.3 +# DEB_VERSION_REVISION: Package's Debian revision without the Debian epoch +# or the upstream-version (since dpkg 1.22.12). The variable can be empty +# if there is no revision. +# Format: [revision] +# Example: 4 # DEB_DISTRIBUTION: Distribution(s) listed in the current debian/changelog # entry. # DEB_TIMESTAMP: Source package release date as seconds since the epoch as @@ -42,9 +52,11 @@ dpkg_late_eval ?= $(or $(value DPKG_CACHE_$(1)),$(eval DPKG_CACHE_$(1) := $(shel 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 = $(call dpkg_late_eval,DEB_VERSION_EPOCH,echo '$(DEB_VERSION)' | sed -e 's/^\([0-9]\):.*$$/\1/') 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_VERSION_REVISION = $(call dpkg_late_eval,DEB_VERSION_REVISION,echo '$(DEB_VERSION)' | sed -e 's/^.*-\([^-]*\)$$/\1/') DEB_DISTRIBUTION = $(call dpkg_late_eval,DEB_DISTRIBUTION,dpkg-parsechangelog -SDistribution) DEB_TIMESTAMP = $(call dpkg_late_eval,DEB_TIMESTAMP,dpkg-parsechangelog -STimestamp) diff --git a/scripts/t/mk/pkg-info.mk b/scripts/t/mk/pkg-info.mk index 6863ebb80..d173e7913 100644 --- a/scripts/t/mk/pkg-info.mk +++ b/scripts/t/mk/pkg-info.mk @@ -2,18 +2,22 @@ include $(srcdir)/mk/pkg-info.mk TEST_DEB_SOURCE = source TEST_DEB_VERSION = 1:2:3.4-5-6 +TEST_DEB_VERSION_EPOCH = 1 TEST_DEB_VERSION_EPOCH_UPSTREAM = 1:2:3.4-5 TEST_DEB_VERSION_UPSTREAM_REVISION = 2:3.4-5-6 TEST_DEB_VERSION_UPSTREAM = 2:3.4-5 +TEST_DEB_VERSION_REVISION = 6 TEST_DEB_DISTRIBUTION = suite TEST_DEB_TIMESTAMP = 1438697630 test_vars := \ DEB_SOURCE \ DEB_VERSION \ + DEB_VERSION_EPOCH \ DEB_VERSION_EPOCH_UPSTREAM \ DEB_VERSION_UPSTREAM_REVISION \ DEB_VERSION_UPSTREAM \ + DEB_VERSION_REVISION \ DEB_DISTRIBUTION \ DEB_TIMESTAMP \ SOURCE_DATE_EPOCH \ -- Dpkg.Org's dpkg