Hi!

On Mon, 2024-11-25 at 18:40:09 +0100, Diederik de Haas wrote:
> Package: dpkg-dev
> Version: 1.22.11
> Severity: wishlist

> Trying to figure out what exactly the various variables from pkg-info.mk
> return, I added a number of 'debug' statements to my (modified) clone of
> ffmpeg package repo's debian/rules file and got the following results:

Hmm, wasn't the comment header at the top of the file not clear
enough? If so I think that deserves to be improved, which I've tried
with the attached patch.

> ```
> $DEB_VERSION = 7:7.1-9.1
> $DEB_VERSION_EPOCH_UPSTREAM = 7:7.1
> $DEB_VERSION_UPSTREAM_REVISION = 7.1-9.1
> $DEB_VERSION_UPSTREAM = 7.1
> ```
> 
> ffmpeg's debian/rules file also had this statement:
> 
> ```
> # Get the Debian version revision:
> DEB_REVISION := $(word 2, $(subst -, ,$(DEB_VERSION)))
> ```
> 
> which returns "9.1".
> It seems useful if pkg-info.mk could return that value too?

A problem I guess is that in contrast to all the existing version
variable, this one can be empty for native packages. Which could be
documented, and if added I guess we might need to add also a variable
to extract the epoch for symmetry. I'm not sure these are something
common enough to want to extract though, and my codesearch.debian.net
search imagination is failing me (or giving me too many false
positives for SOURCE_DATE_EPOCH).

Thanks,
Guillem
From 582ccde908dcad3676dc3fd3ecdc5da1cd77a527 Mon Sep 17 00:00:00 2001
From: Guillem Jover <guil...@debian.org>
Date: Tue, 17 Dec 2024 04:21:48 +0100
Subject: [PATCH] mk: Clarify format for version variables from pkg-info.mk

Ref: #1088244
---
 scripts/mk/pkg-info.mk | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/scripts/mk/pkg-info.mk b/scripts/mk/pkg-info.mk
index 375e429b0..ea86589ac 100644
--- a/scripts/mk/pkg-info.mk
+++ b/scripts/mk/pkg-info.mk
@@ -2,10 +2,15 @@
 # information variables:
 #
 #   DEB_SOURCE: source package name.
-#   DEB_VERSION: package's full version (epoch + upstream vers. + revision).
+#   DEB_VERSION: package's full version.
+#     [epoch:]upstream-version[-revision]
 #   DEB_VERSION_EPOCH_UPSTREAM: package's version without the Debian revision.
+#     [epoch:]upstream-version.
 #   DEB_VERSION_UPSTREAM_REVISION: package's version without the Debian epoch.
-#   DEB_VERSION_UPSTREAM: package's upstream version.
+#     upstream-version[-revision]
+#   DEB_VERSION_UPSTREAM: package's upstream version without the Debian epoch
+#     or revision.
+#     upstream-version
 #   DEB_DISTRIBUTION: distribution(s) listed in the current debian/changelog
 #     entry.
 #   DEB_TIMESTAMP: source package release date as seconds since the epoch as
-- 
2.45.2

Reply via email to