← Back to team overview

launchpad-reviewers team mailing list archive

[Merge] ~mwhudson/launchpad:variants-vs-linux-any-2 into launchpad:master

 

Michael Hudson-Doyle has proposed merging ~mwhudson/launchpad:variants-vs-linux-any-2 into launchpad:master.

Commit message:
just some test suite tweaks

Requested reviews:
  Launchpad code reviewers (launchpad-reviewers)

For more details, see:
https://code.launchpad.net/~mwhudson/launchpad/+git/launchpad/+merge/493851
-- 
Your team Launchpad code reviewers is requested to review the proposed merge of ~mwhudson/launchpad:variants-vs-linux-any-2 into launchpad:master.
diff --git a/lib/lp/soyuz/model/binarypackagebuild.py b/lib/lp/soyuz/model/binarypackagebuild.py
index 1c4b182..c866d17 100644
--- a/lib/lp/soyuz/model/binarypackagebuild.py
+++ b/lib/lp/soyuz/model/binarypackagebuild.py
@@ -1592,8 +1592,7 @@ class BinaryPackageBuildSet(SpecificBuildFarmJobSourceMixin):
         # Create builds for the remaining architectures.
         new_builds = []
         for das in sorted(need_archs, key=attrgetter("architecturetag")):
-            archtag = abi_tag(das)
-            if archtag not in create_tag_map:
+            if abi_tag(das) not in create_tag_map:
                 continue
             indep = (
                 False
diff --git a/lib/lp/soyuz/tests/test_build_set.py b/lib/lp/soyuz/tests/test_build_set.py
index 1be91de..bc5165a 100644
--- a/lib/lp/soyuz/tests/test_build_set.py
+++ b/lib/lp/soyuz/tests/test_build_set.py
@@ -682,7 +682,9 @@ class BuildRecordCreationTests(TestNativePublishingBase):
             architecturehintlist="x32",
         )
         x32v2 = self.factory.makeProcessor(
-            name="x32v2", supports_virtualized=True
+            name="x32v2",
+            supports_virtualized=True,
+            build_by_default=True,
         )
         self.factory.makeBuildableDistroArchSeries(
             distroseries=self.distroseries2,
@@ -690,9 +692,37 @@ class BuildRecordCreationTests(TestNativePublishingBase):
             processor=x32v2,
             underlying_architecturetag="x32",
         )
+        # self.archive is not created until we call createBuilds and
+        # has all processors with "build_by_default" set enabled,
+        # which is why x32v2 is built here.
         builds = self.createBuilds(spr, self.distroseries2)
         self.assertBuildsMatch({"x32": True, "x32v2": False}, builds)
 
+    def test_createForSource_variant_not_enabled(self):
+        # createForSource with a hintlist of a specfic architecture
+        # does not built variants of that architecture if they are not
+        # enabled for the archive.
+        spr = self.factory.makeSourcePackageRelease(
+            architecturehintlist="x32",
+        )
+        x32v2 = self.factory.makeProcessor(
+            name="x32v2",
+            supports_virtualized=True,
+            build_by_default=False,
+        )
+        self.factory.makeBuildableDistroArchSeries(
+            distroseries=self.distroseries2,
+            architecturetag="x32v2",
+            processor=x32v2,
+            underlying_architecturetag="x32",
+        )
+        # As in test_createForSource_variant self.archive gets all
+        # processors with build_by_default set enabled, so as x32v2
+        # does not have that flag set in this test, it is not enabled
+        # and so not built.
+        builds = self.createBuilds(spr, self.distroseries2)
+        self.assertBuildsMatch({"x32": True}, builds)
+
     def test_createForSource_variant_created_later(self):
         # createForSource with a hintlist of a specfic architecture
         # builds variants of that architecture too, even if the