← 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:
pass abi tags not architecture tags to determine_architectures_to_build

fixes requesting a build for a variant after the variant has been created



Requested reviews:
  Launchpad code reviewers (launchpad-reviewers)

For more details, see:
https://code.launchpad.net/~mwhudson/launchpad/+git/launchpad/+merge/493836

glad a test caught this by accident, I would probably have been very confused if the previous branch made it to production and the self-copy trick still didn't work!
-- 
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 bb729ff..0ca11b4 100644
--- a/lib/lp/soyuz/model/binarypackagebuild.py
+++ b/lib/lp/soyuz/model/binarypackagebuild.py
@@ -1541,7 +1541,6 @@ class BinaryPackageBuildSet(SpecificBuildFarmJobSourceMixin):
         # arch-indep build has already succeeded, or another build in
         # this series already has it set.
         need_arch_indep = not any(bpb.arch_indep for bpb in relevant_builds)
-
         # Find the architectures for which the source could end up with
         # new binaries. Exclude architectures not allowed in this
         # archive and architectures that have already built. Order by
@@ -1571,6 +1570,12 @@ class BinaryPackageBuildSet(SpecificBuildFarmJobSourceMixin):
             else None
         )
 
+        def abi_tag(das):
+            if das.underlying_architecturetag is not None:
+                return das.underlying_architecturetag
+            else:
+                return das.architecturetag
+
         # Filter the valid archs against the hint list and work out
         # their arch-indepness.
         create_tag_map = determine_architectures_to_build(
@@ -1578,7 +1583,7 @@ class BinaryPackageBuildSet(SpecificBuildFarmJobSourceMixin):
             sourcepackagerelease.getUserDefinedField(
                 "Build-Indep-Architecture"
             ),
-            [das.architecturetag for das in need_archs],
+            [abi_tag(das) for das in need_archs],
             nominated_arch_indep_tag,
             need_arch_indep,
         )
@@ -1586,11 +1591,7 @@ class BinaryPackageBuildSet(SpecificBuildFarmJobSourceMixin):
         # Create builds for the remaining architectures.
         new_builds = []
         for das in sorted(need_archs, key=attrgetter("architecturetag")):
-            archtag = (
-                das.underlying_architecturetag
-                if das.underlying_architecturetag is not None
-                else das.architecturetag
-            )
+            archtag = abi_tag(das)
             if archtag not in create_tag_map:
                 continue
             indep = (
diff --git a/lib/lp/soyuz/tests/test_build_set.py b/lib/lp/soyuz/tests/test_build_set.py
index 2fba66f..1be91de 100644
--- a/lib/lp/soyuz/tests/test_build_set.py
+++ b/lib/lp/soyuz/tests/test_build_set.py
@@ -681,15 +681,45 @@ class BuildRecordCreationTests(TestNativePublishingBase):
         spr = self.factory.makeSourcePackageRelease(
             architecturehintlist="x32",
         )
+        x32v2 = self.factory.makeProcessor(
+            name="x32v2", supports_virtualized=True
+        )
         self.factory.makeBuildableDistroArchSeries(
             distroseries=self.distroseries2,
             architecturetag="x32v2",
+            processor=x32v2,
             underlying_architecturetag="x32",
-            add_proc_to_archive_processors=True,
         )
         builds = self.createBuilds(spr, self.distroseries2)
         self.assertBuildsMatch({"x32": True, "x32v2": False}, 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
+        # variant was created after the initial builds.
+        spr = self.factory.makeSourcePackageRelease(
+            architecturehintlist="x32",
+        )
+        builds = self.createBuilds(spr, self.distroseries2)
+        self.assertBuildsMatch({"x32": True}, builds)
+        x32v2 = self.factory.makeProcessor(
+            name="x32v2", supports_virtualized=True
+        )
+        self.factory.makeBuildableDistroArchSeries(
+            distroseries=self.distroseries2,
+            architecturetag="x32v2",
+            processor=x32v2,
+            underlying_architecturetag="x32",
+        )
+        self.archive.setProcessors(self.archive.processors + [x32v2])
+        builds = getUtility(IBinaryPackageBuildSet).createForSource(
+            spr,
+            self.archive,
+            self.distroseries2,
+            PackagePublishingPocket.RELEASE,
+        )
+        self.assertBuildsMatch({"x32v2": False}, builds)
+
     def test_createForSource_honours_filters(self):
         # If there are DistroArchSeriesFilters for some architectures,
         # createForSource honours them.