← Back to team overview

launchpad-reviewers team mailing list archive

[Merge] ~cjwatson/launchpad:build-private-bpb-immediately into launchpad:master

 

Colin Watson has proposed merging ~cjwatson/launchpad:build-private-bpb-immediately into launchpad:master.

Commit message:
Dispatch private BPBs immediately

Requested reviews:
  Launchpad code reviewers (launchpad-reviewers)

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

Now that we fetch private source files from the librarian rather than from the private PPA server, we no longer need to wait for private source packages to be published before we can dispatch their builds.
-- 
Your team Launchpad code reviewers is requested to review the proposed merge of ~cjwatson/launchpad:build-private-bpb-immediately into launchpad:master.
diff --git a/lib/lp/buildmaster/tests/test_builder.py b/lib/lp/buildmaster/tests/test_builder.py
index 0adba4a..77245fe 100644
--- a/lib/lp/buildmaster/tests/test_builder.py
+++ b/lib/lp/buildmaster/tests/test_builder.py
@@ -382,13 +382,13 @@ class TestFindBuildCandidatesPrivatePPA(TestFindBuildCandidatesPPABase):
         build = getUtility(IBinaryPackageBuildSet).getByQueueEntry(next_job)
         self.assertEqual("joesppa", build.archive.name)
 
-        # If the source for the build is still pending, it won't be
-        # dispatched because the builder has to fetch the source files
-        # from the (password protected) repo area, not the librarian.
+        # If the source for the build is still pending, it will still be
+        # dispatched: the builder will use macaroon authentication to fetch
+        # the source files from the librarian.
         pub = build.current_source_publication
         pub.status = PackagePublishingStatus.PENDING
         [candidate] = self.bq_set.findBuildCandidates(self.proc_386, True, 1)
-        self.assertNotEqual(next_job.id, candidate.id)
+        self.assertEqual(next_job.id, candidate.id)
 
 
 class TestFindBuildCandidatesDistroArchive(TestFindBuildCandidatesBase):
diff --git a/lib/lp/soyuz/model/binarypackagebuild.py b/lib/lp/soyuz/model/binarypackagebuild.py
index 3689956..8c4be97 100644
--- a/lib/lp/soyuz/model/binarypackagebuild.py
+++ b/lib/lp/soyuz/model/binarypackagebuild.py
@@ -60,11 +60,7 @@ from lp.services.macaroons.interfaces import (
 )
 from lp.services.macaroons.model import MacaroonIssuerBase
 from lp.soyuz.adapters.buildarch import determine_architectures_to_build
-from lp.soyuz.enums import (
-    ArchivePurpose,
-    BinarySourceReferenceType,
-    PackagePublishingStatus,
-)
+from lp.soyuz.enums import ArchivePurpose, BinarySourceReferenceType
 from lp.soyuz.interfaces.archive import (
     IArchive,
     InvalidExternalDependencies,
@@ -1332,34 +1328,13 @@ class BinaryPackageBuildSet(SpecificBuildFarmJobSourceMixin):
     @staticmethod
     def addCandidateSelectionCriteria():
         """See `ISpecificBuildFarmJobSource`."""
-        private_statuses = (
-            PackagePublishingStatus.PUBLISHED,
-            PackagePublishingStatus.SUPERSEDED,
-            PackagePublishingStatus.DELETED,
-        )
         return """
-            SELECT TRUE FROM Archive, BinaryPackageBuild, DistroArchSeries
+            SELECT TRUE FROM BinaryPackageBuild
             WHERE
             BinaryPackageBuild.build_farm_job = BuildQueue.build_farm_job AND
-            BinaryPackageBuild.distro_arch_series =
-                DistroArchSeries.id AND
-            BinaryPackageBuild.archive = Archive.id AND
-            ((Archive.private IS TRUE AND
-              EXISTS (
-                  SELECT SourcePackagePublishingHistory.id
-                  FROM SourcePackagePublishingHistory
-                  WHERE
-                      SourcePackagePublishingHistory.distroseries =
-                         DistroArchSeries.distroseries AND
-                      SourcePackagePublishingHistory.sourcepackagerelease =
-                         BinaryPackageBuild.source_package_release AND
-                      SourcePackagePublishingHistory.archive = Archive.id AND
-                      SourcePackagePublishingHistory.status IN %s))
-              OR
-              archive.private IS FALSE) AND
             BinaryPackageBuild.status = %s
         """ % sqlvalues(
-            private_statuses, BuildStatus.NEEDSBUILD
+            BuildStatus.NEEDSBUILD
         )
 
     @staticmethod