• Bug#1088244: dpkg-dev: Add variable for Debian revision to pkg-info.mk

    From Diederik de Haas@1:229/2 to All on Mon Nov 25 18:50:01 2024
    XPost: linux.debian.bugs.dist
    From: didi.debian@cknow.org

    Package: dpkg-dev
    Version: 1.22.11
    Severity: wishlist

    -----BEGIN PGP SIGNED MESSAGE-----
    Hash: SHA256

    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:

    ```
    $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?

    Cheers,
    Diederik

    - -- Package-specific info:

    - -- System Information:
    Debian Release: trixie/sid
    APT prefers unstable
    APT policy: (500, 'unstable'), (500, 'testing'), (101, 'experimental') Architecture: amd64 (x86_64)

    Kernel: Linux 6.12+unreleased-amd64 (SMP w/16 CPU threads; PREEMPT)
    Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8), LANGUAGE=en_US:en
    Shell: /bin/sh linked to /usr/bin/dash
    Init: systemd (via /run/systemd/system)
    LSM: AppArmor: enabled

    Versions of packages dpkg-dev depends on:
    ii binutils 2.43.1-5
    ii bzip2 1.0.8-6
    ii libdpkg-perl 1.22.11
    ii make 4.3-4.1
    ii patch 2.7.6-7
    ii perl 5.40.0-8
    ii tar 1.35+dfsg-3
    ii xz-utils 5.6.3-1+b1

    Versions of packages dpkg-dev recommends:
    ii build-essential 12.12
    ii clang-16 [c-compiler] 1:16.0.6-27+b1
    ii clang-19 [c-compiler] 1:19.1.3-2
    ii fakeroot 1.36-1
    ii gcc [c-compiler] 4:14.2.0-1
    ii gcc-10 [c-compiler] 10.5.0-4
    ii gcc-13 [c-compiler] 13.3.0-8
    ii gcc-14 [c-compiler] 14.2.0-8
    ii gnupg 2.2.45-2
    ii gpgv 2.2.45-2
    ii libalgorithm-merge-perl 0.08-5

    Versions of packages dpkg-dev suggests:
    ii debian-keyring 2024.09.22

    - -- no debconf information

    -----BEGIN PGP SIGNATURE-----

    iHUEARYIAB0WIQT1sUPBYsyGmi4usy/XblvOeH7bbgUCZ0S2cgAKCRDXblvOeH7b buafAP48BC4IFmc0sANgEl8ppFkD8Q1lO5OcvClTLlZ8ThZELQEAqp16VuTQDK/r B3k3r2QUFtORzgGPcy9I2cCL1DvgLAw=
    =PbZC
    -----END PGP SIGNATURE-----

    --- SoupGate-Win32 v1.05
    * Origin: you cannot sedate... all the things you hate (1:229/2)
  • From Guillem Jover@1:229/2 to Diederik de Haas on Tue Dec 17 04:40:01 2024
    XPost: linux.debian.bugs.dist
    From: guillem@debian.org

    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 <guillem@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
  • From Guillem Jover@1:229/2 to Diederik de Haas on Tue Dec 17 13:10:01 2024
    XPost: linux.debian.bugs.dist
    From: guillem@debian.org

    Hi!

    On Tue, 2024-12-17 at 11:24:30 +0100, Diederik de Haas wrote:
    On Tue Dec 17, 2024 at 4:32 AM CET, Guillem Jover wrote:
    On Mon, 2024-11-25 at 18:40:09 +0100, Diederik de Haas wrote:
    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.

    The main problem I had is that based on the description I could make a (somewhat educated) guess as to what a variable would return, while I
    needed to know exactly what I would be getting back.
    As usual, once you *know* you can then see/follow the logic that was
    used, but (in my case) I needed debug statements to *know*.

    The attached patch is an improvement :-)
    But do (also) consider adding a practical (fictitious) example like I
    did with the ffmpeg version.

    I guess given the optional nature of the epoch and revision, I'd need
    to add at least three versions and their values for each variable.
    Hmm. :) Will see whether that does not end up very cluttered.

    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).

    That is (ofc) a maintainers call, but my thought was: if you already
    provide most version parts in variables, why not all? The cost seems negligible to *me* as you already have done 90% of the work needed?

    You're obviously much more fluent in Makefile syntax/parsing then I am,
    so it would be great if someone like you could provide it then me trying
    to come up with something ... which (in my case) usually means searching
    on codesearch and hoping/assuming that that other person did it correctly.

    I looked into this due to the debian-rules-parses-dpkg-parsechangelog
    lintian message. Not providing all the parts *could* mean people would
    still need to do that ... for that tiny bit that is NOT provided in pkg-info.mk.

    Ah, the debian-rules-parses-dpkg-parsechangelog lintian tag! Ok, then
    I see where you are coming from, and why just for this alone that would
    make sense. I think there's indeed also a point of being complete about
    what gets exposed.

    My initial apparent reluctance was coming from thinking about a potential future where dpkg-buildpackage can obsolete all these make fragment files,
    and provide the information itself, and how that could end up polluting
    the environment for all children processes, for example.

    In any case, I'll try to get something going.

    Thanks,
    Guillem

    --- SoupGate-Win32 v1.05
    * Origin: you cannot sedate... all the things you hate (1:229/2)
  • From Diederik de Haas@1:229/2 to Guillem Jover on Tue Dec 17 11:40:02 2024
    XPost: linux.debian.bugs.dist
    From: didi.debian@cknow.org

    --36cb6b8641c57e27e92279a5fc1736a619c66465132346e7dab9a4ee7366 Content-Transfer-Encoding: quoted-printable
    Content-Type: text/plain; charset=UTF-8

    Hi,

    On Tue Dec 17, 2024 at 4:32 AM CET, Guillem Jover wrote:
    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.

    The main problem I had is that based on the description I could make a (somewhat educated) guess as to what a variable would return, while I
    needed to know exactly what I would be getting back.
    As usual, once you *know* you can then see/follow the logic that was
    used, but (in my case) I needed debug statements to *know*.

    The attached patch is an improvement :-)
    But do (also) consider adding a practical (fictitious) example like I
    did with the ffmpeg version.

    ```
    $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 don't see a problem if a variable returns an empty value.
    Good point about epoch, that would be useful as well.

    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).

    That is (ofc) a maintainers call, but my thought was: if you already
    provide most version parts in variables, why not all? The cost seems
    negligible to *me* as you already have done 90% of the work needed?

    You're obviously much more fluent in Makefile syntax/parsing then I am,
    so it would be great if someone like you could provide it then me trying
    to come up with something ... which (in my case) usually means searching
    on codesearch and hoping/assuming that that other person did it correctly.

    I looked into this due to the debian-rules-parses-dpkg-parsechangelog
    lintian message. Not providing all the parts *could* mean people would
    still need to do that ... for that tiny bit that is NOT provided in pkg-info.mk.

    Cheers,
    Diederik

    --36cb6b8641c57e27e92279a5fc1736a619c66465132346e7dab9a4ee7366
    Content-Type: application/pgp-signature; name="signature.asc"

    -----BEGIN PGP SIGNATURE-----

    iHUEABYIAB0WIQT1sUPBYsyGmi4usy/XblvOeH7bbgUCZ2FRZAAKCRDXblvOeH7b bjfGAP9kaRuo9Ew/tqqsa5uSw3S2Naf1hvnqftJYO98JanMBEQEAhLBJGFDemZAs CceJi/hdUQvQai2o08VvVl3/y8j2bQM=qvUW
    -----END PGP SIGNATURE-----

    --36cb6b8641c57e27e92279a5fc1736a619c66465132346e7dab9a4ee7366--

    --- SoupGate-Win32 v1.05
    * Origin: you cannot sedate... all the things you hate (1:229/2)
  • From Diederik de Haas@1:229/2 to Guillem Jover on Tue Dec 17 13:30:01 2024
    XPost: linux.debian.bugs.dist
    From: didi.debian@cknow.org

    --e9b4af9481cdb9d91901057fdee482ef07fbf52912449715a5fd8264114a Content-Transfer-Encoding: quoted-printable
    Content-Type: text/plain; charset=UTF-8

    On Tue Dec 17, 2024 at 1:04 PM CET, Guillem Jover wrote:
    On Tue, 2024-12-17 at 11:24:30 +0100, Diederik de Haas wrote:
    On Tue Dec 17, 2024 at 4:32 AM CET, Guillem Jover wrote:
    On Mon, 2024-11-25 at 18:40:09 +0100, Diederik de Haas wrote:
    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:

    The main problem I had is that based on the description I could make a (somewhat educated) guess as to what a variable would return, while I needed to know exactly what I would be getting back.

    But do (also) consider adding a practical (fictitious) example like I
    did with the ffmpeg version.

    I guess given the optional nature of the epoch and revision, I'd need
    to add at least three versions and their values for each variable.
    Hmm. :) Will see whether that does not end up very cluttered.

    I took ffmpeg for 'debugging' as it had all components, but it was
    actually for another package (mumble).
    My guess: with your patch and an example with all components (like
    ffmpeg), it should be clear for everyone even if they don't have them
    all.

    That is (ofc) a maintainers call, but my thought was: if you already provide most version parts in variables, why not all? The cost seems negligible to *me* as you already have done 90% of the work needed?

    I looked into this due to the debian-rules-parses-dpkg-parsechangelog lintian message. Not providing all the parts *could* mean people would still need to do that ... for that tiny bit that is NOT provided in pkg-info.mk.

    Ah, the debian-rules-parses-dpkg-parsechangelog lintian tag! Ok, then
    I see where you are coming from, and why just for this alone that would
    make sense. I think there's indeed also a point of being complete about
    what gets exposed.

    My initial apparent reluctance was coming from thinking about a potential future where dpkg-buildpackage can obsolete all these make fragment files, and provide the information itself, and how that could end up polluting
    the environment for all children processes, for example.

    Yeah, while it seems simple to me, I don't have the insight and broader
    view that you have, hence maintainers call :-)

    In any case, I'll try to get something going.

    Awesome! TIA :-)

    Cheers,
    Diederik

    --e9b4af9481cdb9d91901057fdee482ef07fbf52912449715a5fd8264114a
    Content-Type: application/pgp-signature; name="signature.asc"

    -----BEGIN PGP SIGNATURE-----

    iHUEABYIAB0WIQT1sUPBYsyGmi4usy/XblvOeH7bbgUCZ2FsagAKCRDXblvOeH7b boaoAQCYouVbQBVMAJzgFKNjxfUsEVDm9RmFzmSgU4kBu2j+gAD9Go/NDkwM+AI7 ThiGHbK9XXVoNSdOV8xj3B3CSzqnGAI=Refq
    -----END PGP SIGNATURE-----

    --e9b4af9481cdb9d91901057fdee482ef07fbf52912449715a5fd8264114a--

    --- SoupGate-Win32 v1.05
    * Origin: you cannot sedate... all the things you hate (1:229/2)