dpkg-buildpackage ignores DEB_BUILD_PROFILES

Bug #2054741 reported by Luca Boccassi
10
This bug affects 1 person
Affects Status Importance Assigned to Milestone
dpkg (Ubuntu)
Fix Released
Undecided
Unassigned
Jammy
Fix Released
Undecided
Unassigned
Mantic
Fix Released
Undecided
Unassigned
Noble
Fix Released
Undecided
Unassigned

Bug Description

[Impact]

DEB_BUILD_PROFILES= can be used in Debian to specify a build profile to use with dpkg-buildpackage. We want to use it in the systemd project to build the upstream packages for the Ubuntu autopkgtest cloud CI on Github. But in the Ubuntu's fork of dpkg, DEB_BUILD_PROFILES's value is ignored and unconditionally swapped with 'noudeb'. This makes it impossible to use package-specific profiles, and it's a regression w.r.t Debian.

[Fix]

Backport patch from Noble that fixes the issue: https://code.launchpad.net/~bluca/ubuntu/+source/dpkg/+git/dpkg/+merge/461136
and takes into account if the environment variable is set when reading the profile

[Test]

To reproduce it, simply print the content of DEB_BUILD_PROFILES in d/rules in any package and build with DEB_BUILD_PROFILES=foo dpkg-buildpackage. Before the fix, whatever is passed via the env var is ignored. After the fix, it will be respected.

[Regression Potential]

dpkg-buildpackage is used to build all packages, so in case of unforeseen issues other packages could potentially fail to build. A unit test exercising this change is included in the patch to minimize potential for regressions.

Related branches

Revision history for this message
Luca Boccassi (bluca) wrote :
tags: added: patch
Changed in dpkg (Ubuntu Jammy):
status: New → Confirmed
Changed in dpkg (Ubuntu Mantic):
status: New → Confirmed
Changed in dpkg (Ubuntu Noble):
status: New → Confirmed
Changed in dpkg (Ubuntu Noble):
status: Confirmed → Fix Committed
Changed in dpkg (Ubuntu Mantic):
status: Confirmed → In Progress
Changed in dpkg (Ubuntu Jammy):
status: Confirmed → In Progress
Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package dpkg - 1.22.4ubuntu5

---------------
dpkg (1.22.4ubuntu5) noble; urgency=medium

  [ Luca Boccassi ]
  * Fix dpkg-buildpackage ignoring DEB_BUILD_PROFILES (LP: #2054741)

 -- Gianfranco Costamagna <email address hidden> Fri, 23 Feb 2024 10:52:26 +0100

Changed in dpkg (Ubuntu Noble):
status: Fix Committed → Fix Released
Luca Boccassi (bluca)
description: updated
Revision history for this message
Brian Murray (brian-murray) wrote : Please test proposed package

Hello Luca, or anyone else affected,

Accepted dpkg into mantic-proposed. The package will build now and be available at https://launchpad.net/ubuntu/+source/dpkg/1.22.0ubuntu1.1 in a few hours, and then in the -proposed repository.

Please help us by testing this new package. See https://wiki.ubuntu.com/Testing/EnableProposed for documentation on how to enable and use -proposed. Your feedback will aid us getting this update out to other Ubuntu users.

If this package fixes the bug for you, please add a comment to this bug, mentioning the version of the package you tested, what testing has been performed on the package and change the tag from verification-needed-mantic to verification-done-mantic. If it does not fix the bug for you, please add a comment stating that, and change the tag to verification-failed-mantic. In either case, without details of your testing we will not be able to proceed.

Further information regarding the verification process can be found at https://wiki.ubuntu.com/QATeam/PerformingSRUVerification . Thank you in advance for helping!

N.B. The updated package will be released to -updates after the bug(s) fixed by this package have been verified and the package has been in -proposed for a minimum of 7 days.

Changed in dpkg (Ubuntu Mantic):
status: In Progress → Fix Committed
tags: added: verification-needed verification-needed-mantic
Revision history for this message
Ubuntu SRU Bot (ubuntu-sru-bot) wrote : Autopkgtest regression report (dpkg/1.22.0ubuntu1.1)

All autopkgtests for the newly accepted dpkg (1.22.0ubuntu1.1) for mantic have finished running.
The following regressions have been reported in tests triggered by the package:

clamav/1.0.5+dfsg-0ubuntu0.23.10.1 (armhf)
debsums/3.0.2.1 (armhf)
dgit/11.3 (armhf)
golang-logrus/1.9.0-1 (armhf)
haproxy/2.6.15-1ubuntu2 (armhf)
llvm-toolchain-14/1:14.0.6-16 (armhf)
needrestart/3.6-5 (armhf)
openblas/0.3.23+ds-3 (armhf)
util-linux/2.39.1-4ubuntu2 (armhf)

Please visit the excuses page listed below and investigate the failures, proceeding afterwards as per the StableReleaseUpdates policy regarding autopkgtest regressions [1].

https://people.canonical.com/~ubuntu-archive/proposed-migration/mantic/update_excuses.html#dpkg

[1] https://wiki.ubuntu.com/StableReleaseUpdates#Autopkgtest_Regressions

Thank you!

Revision history for this message
Brian Murray (brian-murray) wrote : Please test proposed package

Hello Luca, or anyone else affected,

Accepted dpkg into jammy-proposed. The package will build now and be available at https://launchpad.net/ubuntu/+source/dpkg/1.21.1ubuntu2.3 in a few hours, and then in the -proposed repository.

Please help us by testing this new package. See https://wiki.ubuntu.com/Testing/EnableProposed for documentation on how to enable and use -proposed. Your feedback will aid us getting this update out to other Ubuntu users.

If this package fixes the bug for you, please add a comment to this bug, mentioning the version of the package you tested, what testing has been performed on the package and change the tag from verification-needed-jammy to verification-done-jammy. If it does not fix the bug for you, please add a comment stating that, and change the tag to verification-failed-jammy. In either case, without details of your testing we will not be able to proceed.

Further information regarding the verification process can be found at https://wiki.ubuntu.com/QATeam/PerformingSRUVerification . Thank you in advance for helping!

N.B. The updated package will be released to -updates after the bug(s) fixed by this package have been verified and the package has been in -proposed for a minimum of 7 days.

Changed in dpkg (Ubuntu Jammy):
status: In Progress → Fix Committed
tags: added: verification-needed-jammy
Revision history for this message
Luca Boccassi (bluca) wrote :

Verified that the packages in proposed work and solve the bug. Thanks!

tags: added: verification-done verification-done-jammy verification-done-mantic
removed: verification-needed verification-needed-jammy verification-needed-mantic
Revision history for this message
Ubuntu SRU Bot (ubuntu-sru-bot) wrote : Autopkgtest regression report (dpkg/1.21.1ubuntu2.3)

All autopkgtests for the newly accepted dpkg (1.21.1ubuntu2.3) for jammy have finished running.
The following regressions have been reported in tests triggered by the package:

libreoffice/1:7.3.7-0ubuntu0.22.04.4 (ppc64el)
pbuilder/0.231build1 (arm64)

Please visit the excuses page listed below and investigate the failures, proceeding afterwards as per the StableReleaseUpdates policy regarding autopkgtest regressions [1].

https://people.canonical.com/~ubuntu-archive/proposed-migration/jammy/update_excuses.html#dpkg

[1] https://wiki.ubuntu.com/StableReleaseUpdates#Autopkgtest_Regressions

Thank you!

Revision history for this message
Luca Boccassi (bluca) wrote :

The autopkgtest failures are unrelated, one is some patch fuzz:

15200s ====== Unapplying the patch ======
15200s patching file solenv/gbuild/UITest.mk
15200s Hunk #1 succeeded at 34 with fuzz 1.
15200s Hunk #2 succeeded at 71 with fuzz 2 (offset 6 lines).
15200s Hunk #3 succeeded at 92 (offset -3 lines).
15200s patching file solenv/gbuild/Module.mk
15200s Hunk #1 succeeded at 212 (offset 11 lines).
15200s Hunk #2 succeeded at 392 (offset 20 lines).
15200s Hunk #3 succeeded at 504 (offset 25 lines).
15200s it failed
15200s autopkgtest [01:36:42]: test uicheck-sw: -----------------------]
15201s autopkgtest [01:36:43]: test uicheck-sw: - - - - - - - - - - results - - - - - - - - - -
15201s uicheck-sw FAIL non-zero exit status 2

https://autopkgtest.ubuntu.com/results/autopkgtest-jammy/jammy/ppc64el/libr/libreoffice/20240229_025213_7395c@/log.gz

and the other one is due to the recent usr-merge changes in base-files breaking debootstrap:

205s tar: ./bin: Cannot create symlink to 'usr/bin': File exists
205s tar: ./lib: Cannot create symlink to 'usr/lib': File exists
205s tar: ./sbin: Cannot create symlink to 'usr/sbin': File exists

https://autopkgtest.ubuntu.com/results/autopkgtest-jammy/jammy/arm64/p/pbuilder/20240229_090138_97dd0@/log.gz

Could it be hinted to migrate, please?

Revision history for this message
Gianfranco Costamagna (costamagnagianfranco) wrote :

Also mantic autopkgtests are good.
Autopkgtests for SRUs are not blocking release, a manual accept is needed form ubuntu-sru

Revision history for this message
Andreas Hasenack (ahasenack) wrote :

The autopkgtests look good now, but the test plan execution is very vague:

> Verified that the packages in proposed work and solve the bug. Thanks!

Which versions? I would have to check what was in jammy and mantic proposed on the day of this comment, assuming the test and the comment were written on the same day.

Since the test plan is so easy to run, I'll do it myself.

Revision history for this message
Luca Boccassi (bluca) wrote :

Pick any package and add to debian/rules:

execute_before_dh_auto_clean:
       echo $(DEB_BUILD_PROFILES)
       exit 1

root@jammy:/tmp/s# dpkg-buildpackage -uc -us -b
dpkg-buildpackage: info: source package systemd
dpkg-buildpackage: info: source version 255.4-1
dpkg-buildpackage: info: source distribution sid
dpkg-buildpackage: info: source changed by Luca Boccassi <email address hidden>
dpkg-buildpackage: info: host architecture amd64
 dpkg-source --before-build .
 debian/rules clean
dh clean --without autoreconf --buildsystem=meson
   debian/rules execute_before_dh_auto_clean
make[1]: Entering directory '/tmp/s'
echo noudeb
noudeb
exit 1
make[1]: *** [debian/rules:179: execute_before_dh_auto_clean] Error 1
make[1]: Leaving directory '/tmp/s'
make: *** [debian/rules:291: clean] Error 2
dpkg-buildpackage: error: debian/rules clean subprocess returned exit status 2
root@jammy:/tmp/s# DEB_BUILD_PROFILES=foo dpkg-buildpackage -uc -us -b
dpkg-buildpackage: info: source package systemd
dpkg-buildpackage: info: source version 255.4-1
dpkg-buildpackage: info: source distribution sid
dpkg-buildpackage: info: source changed by Luca Boccassi <email address hidden>
dpkg-buildpackage: info: host architecture amd64
 dpkg-source --before-build .
 debian/rules clean
dh clean --without autoreconf --buildsystem=meson
   debian/rules execute_before_dh_auto_clean
make[1]: Entering directory '/tmp/s'
echo noudeb foo
noudeb foo
exit 1
make[1]: *** [debian/rules:179: execute_before_dh_auto_clean] Error 1
make[1]: Leaving directory '/tmp/s'
make: *** [debian/rules:291: clean] Error 2
dpkg-buildpackage: error: debian/rules clean subprocess returned exit status 2
root@jammy:/tmp/s# apt-cache policy dpkg
dpkg:
  Installed: 1.21.1ubuntu2.3
  Candidate: 1.21.1ubuntu2.3
  Version table:
 *** 1.21.1ubuntu2.3 500
        500 http://azure.archive.ubuntu.com/ubuntu jammy-proposed/main amd64 Packages
        100 /var/lib/dpkg/status
     1.21.1ubuntu2.3~ppa22.04.1 500
        500 https://ppa.launchpadcontent.net/upstream-systemd-ci/systemd-ci/ubuntu jammy/main amd64 Packages
     1.21.1ubuntu2.2 500
        500 http://azure.archive.ubuntu.com/ubuntu jammy-updates/main amd64 Packages
     1.21.1ubuntu2.1 500
        500 http://azure.archive.ubuntu.com/ubuntu jammy-security/main amd64 Packages
     1.21.1ubuntu2 500
        500 http://azure.archive.ubuntu.com/ubuntu jammy/main amd64 Packages

Revision history for this message
Andreas Hasenack (ahasenack) wrote :

So I launched a jammy container, grabbed the source of base-files (a quick build package), and applied this change:

--- a/debian/rules
+++ b/debian/rules
@@ -12,6 +12,7 @@ VENDORFILE = ubuntu
 DESTDIR = debian/base-files

 %:
+ echo $$DEB_BUILD_PROFILES
        dh $@

 locale-check:

With dpkg 1.21.1ubuntu2.2 from jammy-updates, I did two builds:

dpkg-buildpackage -uc -us

DEB_BUILD_PROFILES=foo dpkg-buildpackage -uc -us

In both, I saw this output, as expected:
 fakeroot debian/rules clean
echo $DEB_BUILD_PROFILES
noudeb
...
 debian/rules build
echo $DEB_BUILD_PROFILES
noudeb
...
 fakeroot debian/rules binary
echo $DEB_BUILD_PROFILES
noudeb

I then installed dpkg 1.21.1ubuntu2.3 from jammy-updates, repeated the builds, but did NOT see DEB_BUILD_PROFILES set to foo:
$ apt-cache policy dpkg
dpkg:
  Installed: 1.21.1ubuntu2.3
  Candidate: 1.21.1ubuntu2.3
  Version table:
 *** 1.21.1ubuntu2.3 500
        500 http://br.archive.ubuntu.com/ubuntu jammy-proposed/main amd64 Packages
        100 /var/lib/dpkg/status

$ DEB_BUILD_PROFILES=foo dpkg-buildpackage -uc -us 2>&1 | grep -A 1 DEB_BUILD_PROFILES
echo $DEB_BUILD_PROFILES
noudeb
--
echo $DEB_BUILD_PROFILES
noudeb
--
echo $DEB_BUILD_PROFILES
noudeb

Could someone please clarify if I did something wrong? In the meantime, this is verification-failed for jammy.

tags: added: verification-failed-jammy
removed: verification-done-jammy
Revision history for this message
Andreas Hasenack (ahasenack) wrote :

Ah, my mistake. I installed only the new dpkg, and dpkg-dev stayed at the previous version. It doesn't upgrade together.

With dpkg-dev also updated to 1.21.1ubuntu2.3, it worked:
$ DEB_BUILD_PROFILES=foo dpkg-buildpackage -uc -us 2>&1 | grep -A 1 DEB_BUILD_PROFILES
echo $DEB_BUILD_PROFILES
noudeb foo
--
echo $DEB_BUILD_PROFILES
noudeb foo
--
echo $DEB_BUILD_PROFILES
noudeb foo

Jammy verification succeeded.

tags: added: verification-done-jammy
removed: verification-failed-jammy
Revision history for this message
Andreas Hasenack (ahasenack) wrote :

Mantic verification

Reproducing the bug with 1.22.0ubuntu1:
$ apt-cache policy dpkg-dev
dpkg-dev:
  Installed: 1.22.0ubuntu1
  Candidate: 1.22.0ubuntu1
  Version table:
 *** 1.22.0ubuntu1 500
        500 http://br.archive.ubuntu.com/ubuntu mantic/main amd64 Packages
        100 /var/lib/dpkg/status

$ dpkg-buildpackage -uc -us 2>&1 | grep -A 1 DEB_BUILD_PROFILES
echo $DEB_BUILD_PROFILES
noudeb
--
echo $DEB_BUILD_PROFILES
noudeb
--
echo $DEB_BUILD_PROFILES
noudeb

$ DEB_BUILD_PROFILES=foo dpkg-buildpackage -uc -us 2>&1 | grep -A 1 DEB_BUILD_PROFILES
echo $DEB_BUILD_PROFILES
noudeb
--
echo $DEB_BUILD_PROFILES
noudeb
--
echo $DEB_BUILD_PROFILES
noudeb

Updating to 1.22.0ubuntu1.1 from mantic-proposed:
$ apt-cache policy dpkg-dev
dpkg-dev:
  Installed: 1.22.0ubuntu1.1
  Candidate: 1.22.0ubuntu1.1
  Version table:
 *** 1.22.0ubuntu1.1 500
        500 http://br.archive.ubuntu.com/ubuntu mantic-proposed/main amd64 Packages
        100 /var/lib/dpkg/status

Default was kept:
$ dpkg-buildpackage -uc -us 2>&1 | grep -A 1 DEB_BUILD_PROFILES
echo $DEB_BUILD_PROFILES
noudeb
--
echo $DEB_BUILD_PROFILES
noudeb
--
echo $DEB_BUILD_PROFILES
noudeb

And the extra profile was added:
$ DEB_BUILD_PROFILES=foo dpkg-buildpackage -uc -us 2>&1 | grep -A 1 DEB_BUILD_PROFILES
echo $DEB_BUILD_PROFILES
noudeb foo
--
echo $DEB_BUILD_PROFILES
noudeb foo
--
echo $DEB_BUILD_PROFILES
noudeb foo

Mantic verification succeeded.

Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package dpkg - 1.22.0ubuntu1.1

---------------
dpkg (1.22.0ubuntu1.1) mantic; urgency=medium

  [ Luca Boccassi ]
  * Fix dpkg-buildpackage ignoring DEB_BUILD_PROFILES (LP: #2054741)

 -- Gianfranco Costamagna <email address hidden> Fri, 23 Feb 2024 15:56:43 +0100

Changed in dpkg (Ubuntu Mantic):
status: Fix Committed → Fix Released
Revision history for this message
Andreas Hasenack (ahasenack) wrote : Update Released

The verification of the Stable Release Update for dpkg has completed successfully and the package is now being released to -updates. Subsequently, the Ubuntu Stable Release Updates Team is being unsubscribed and will not receive messages about this bug report. In the event that you encounter a regression using the package from -updates please report a new bug using ubuntu-bug and tag the bug report regression-update so we can easily find any regressions.

Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package dpkg - 1.21.1ubuntu2.3

---------------
dpkg (1.21.1ubuntu2.3) jammy; urgency=medium

  [ Luca Boccassi ]
  * Fix dpkg-buildpackage ignoring DEB_BUILD_PROFILES (LP: #2054741)

 -- Gianfranco Costamagna <email address hidden> Fri, 23 Feb 2024 15:53:39 +0100

Changed in dpkg (Ubuntu Jammy):
status: Fix Committed → Fix Released
Revision history for this message
Luca Boccassi (bluca) wrote :

Thank you!

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.