← Back to team overview

launchpad-reviewers team mailing list archive

[Merge] ~xnox/launchpad-buildd:noudeb into launchpad-buildd:master

 

Dimitri John Ledkov has proposed merging ~xnox/launchpad-buildd:noudeb into launchpad-buildd:master.

Commit message:
binarypackage: build with noudeb profile for groovy+

Requested reviews:
  Launchpad code reviewers (launchpad-reviewers)
Related bugs:
  Bug #1884836 in launchpad-buildd: "Groovy+ should build with  noudeb deb-build-profile"
  https://bugs.launchpad.net/launchpad-buildd/+bug/1884836

For more details, see:
https://code.launchpad.net/~xnox/launchpad-buildd/+git/launchpad-buildd/+merge/386466
-- 
Your team Launchpad code reviewers is requested to review the proposed merge of ~xnox/launchpad-buildd:noudeb into launchpad-buildd:master.
diff --git a/debian/changelog b/debian/changelog
index 26d4622..acc33d8 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -30,6 +30,7 @@ launchpad-buildd (190) UNRELEASED; urgency=medium
 
   [ Dimitri John Ledkov ]
   * lxd: Add riscv64 to arch table.
+  * binarypackage: build with noudeb profile for groovy+. LP: #1884836
 
  -- Colin Watson <cjwatson@xxxxxxxxxx>  Tue, 28 Apr 2020 10:19:27 +0100
 
diff --git a/lpbuildd/binarypackage.py b/lpbuildd/binarypackage.py
index 2111bbe..f18ac08 100644
--- a/lpbuildd/binarypackage.py
+++ b/lpbuildd/binarypackage.py
@@ -47,6 +47,15 @@ APT_DUBIOUS_DEP_PATTERNS = [
     ]
 
 
+UDEB_SUITES = (
+    'warty', 'hoary', 'breezy', 'dapper', 'edgy', 'feisty', 'gutsy', 'hardy',
+    'intrepid', 'jaunty', 'karmic', 'lucid', 'maverick', 'natty', 'oneiric',
+    'precise', 'quantal', 'raring', 'saucy', 'trusty', 'utopic', 'vivid',
+    'wily', 'xenial', 'yakkety', 'zesty', 'artful', 'bionic', 'cosmic',
+    'disco', 'eoan', 'focal'
+    )
+
+
 class BuildLogRegexes:
     """Build log regexes for performing actions based on regexes, and extracting dependencies for auto dep-waits"""
     GIVENBACK = [
@@ -175,6 +184,8 @@ class BinaryPackageBuildManager(DebianBuildManager):
             env.pop("DEB_BUILD_OPTIONS", None)
         else:
             env["DEB_BUILD_OPTIONS"] = "noautodbgsym"
+        if self.series not in UDEB_SUITES:
+            env["DEB_BUILD_PROFILES"] = "noudeb"
         self.runSubProcess(self._sbuildpath, args, env=env)
 
     def getAvailablePackages(self):
diff --git a/lpbuildd/tests/test_binarypackage.py b/lpbuildd/tests/test_binarypackage.py
index c88bdb2..7423d51 100644
--- a/lpbuildd/tests/test_binarypackage.py
+++ b/lpbuildd/tests/test_binarypackage.py
@@ -268,6 +268,76 @@ class TestBinaryPackageBuildManagerIteration(TestCase):
             self.buildmanager.backend.backend_fs['/CurrentlyBuilding'])
 
     @defer.inlineCallbacks
+    def test_with_udebs(self):
+        # A build with warty-focal suites does not pass DEB_BUILD_PROFILES
+        self.addCleanup(
+            setattr, self.buildmanager, 'backend_name',
+            self.buildmanager.backend_name)
+        self.buildmanager.backend_name = 'fake'
+        self.buildmanager.initiate(
+            {'foo_1.dsc': ''}, 'chroot.tar.gz',
+            {'distribution': 'ubuntu', 'series': 'warty', 'suite': 'warty',
+             'ogrecomponent': 'main', 'archive_purpose': 'PRIMARY',
+             'build_debug_symbols': True})
+        os.makedirs(self.chrootdir)
+        self.buildmanager._state = BinaryPackageBuildState.UPDATE
+        yield self.buildmanager.iterate(0)
+        self.assertState(
+            BinaryPackageBuildState.SBUILD,
+            ['sharepath/bin/sbuild-package', 'sbuild-package',
+             self.buildid, 'i386', 'warty',
+             '-c', 'chroot:build-' + self.buildid,
+             '--arch=i386', '--dist=warty', '--nolog',
+             'foo_1.dsc'],
+            env_matcher=Not(Contains('DEB_BUILD_PROFILES')), final=True)
+        self.assertFalse(self.builder.wasCalled('chrootFail'))
+        self.assertEqual(
+            (dedent("""\
+                Package: foo
+                Component: main
+                Suite: warty
+                Purpose: PRIMARY
+                Build-Debug-Symbols: yes
+                """).encode('UTF-8'), stat.S_IFREG | 0o644),
+            self.buildmanager.backend.backend_fs['/CurrentlyBuilding'])
+
+    @defer.inlineCallbacks
+    def test_without_udebs(self):
+        # A build with groovy+ suites passes DEB_BUILD_PROFILE=noudeb
+        self.addCleanup(
+            setattr, self.buildmanager, 'backend_name',
+            self.buildmanager.backend_name)
+        self.buildmanager.backend_name = 'fake'
+        self.buildmanager.initiate(
+            {'foo_1.dsc': ''}, 'chroot.tar.gz',
+            {'distribution': 'ubuntu', 'series': 'groovy', 'suite': 'groovy',
+             'ogrecomponent': 'main', 'archive_purpose': 'PRIMARY',
+             'build_debug_symbols': True})
+        os.makedirs(self.chrootdir)
+        self.buildmanager._state = BinaryPackageBuildState.UPDATE
+        yield self.buildmanager.iterate(0)
+        self.assertState(
+            BinaryPackageBuildState.SBUILD,
+            ['sharepath/bin/sbuild-package', 'sbuild-package',
+             self.buildid, 'i386', 'groovy',
+             '-c', 'chroot:build-' + self.buildid,
+             '--arch=i386', '--dist=groovy', '--nolog',
+             'foo_1.dsc'],
+            env_matcher=ContainsDict(
+                {'DEB_BUILD_PROFILES': Equals('noudeb')}),
+            final=True)
+        self.assertFalse(self.builder.wasCalled('chrootFail'))
+        self.assertEqual(
+            (dedent("""\
+                Package: foo
+                Component: main
+                Suite: groovy
+                Purpose: PRIMARY
+                Build-Debug-Symbols: yes
+                """).encode('UTF-8'), stat.S_IFREG | 0o644),
+            self.buildmanager.backend.backend_fs['/CurrentlyBuilding'])
+
+    @defer.inlineCallbacks
     def test_abort_sbuild(self):
         # Aborting sbuild kills processes in the chroot.
         yield self.startBuild()
diff --git a/sbuildrc b/sbuildrc
index c49ada9..51fc784 100644
--- a/sbuildrc
+++ b/sbuildrc
@@ -32,9 +32,10 @@ $build_environment = {
 };
 
 # We want to expose almost nothing from the buildd environment.
-# DEB_BUILD_OPTIONS is set by sbuild-package.
+# DEB_BUILD_OPTIONS DEB_BUILD_PROFILES are set by sbuild-package.
 $environment_filter = [
     '^DEB_BUILD_OPTIONS$',
+    '^DEB_BUILD_PROFILES$',
     ];
 
 # We're just going to throw the chroot away anyway.