← Back to team overview

launchpad-reviewers team mailing list archive

[Merge] lp:~wgrant/launchpad/no-bfjo-pls into lp:launchpad

 

William Grant has proposed merging lp:~wgrant/launchpad/no-bfjo-pls into lp:launchpad.

Commit message:
Remove some IBuildFarmJobOld references that can easily go before the rest.

Requested reviews:
  Launchpad code reviewers (launchpad-reviewers)

For more details, see:
https://code.launchpad.net/~wgrant/launchpad/no-bfjo-pls/+merge/195192

Remove some IBuildFarmJobOld references that can easily go before the rest.
-- 
https://code.launchpad.net/~wgrant/launchpad/no-bfjo-pls/+merge/195192
Your team Launchpad code reviewers is requested to review the proposed merge of lp:~wgrant/launchpad/no-bfjo-pls into lp:launchpad.
=== modified file 'lib/lp/buildmaster/tests/test_buildqueue.py'
--- lib/lp/buildmaster/tests/test_buildqueue.py	2013-11-14 07:36:26 +0000
+++ lib/lp/buildmaster/tests/test_buildqueue.py	2013-11-14 10:12:04 +0000
@@ -101,17 +101,15 @@
 
     def test_binarypackagebuild_cancel(self):
         build = self.factory.makeBinaryPackageBuild()
-        buildpackagejob = build.makeJob()
-        bq = self._makeBuildQueue(buildpackagejob.job)
-        Store.of(build).add(bq)
+        bq = build.queueBuild()
         bq.markAsBuilding(self.builder)
         bq.cancel()
 
-        self.assertCancelled(buildpackagejob.build, bq)
+        self.assertCancelled(build, bq)
 
     def test_recipebuild_cancel(self):
-        bq = self.factory.makeSourcePackageRecipeBuild().queueBuild()
-        build = bq.specific_build
+        build = self.factory.makeSourcePackageRecipeBuild()
+        bq = build.queueBuild()
         bq.markAsBuilding(self.builder)
         bq.cancel()
 

=== modified file 'lib/lp/soyuz/interfaces/buildpackagejob.py'
--- lib/lp/soyuz/interfaces/buildpackagejob.py	2013-01-07 02:40:55 +0000
+++ lib/lp/soyuz/interfaces/buildpackagejob.py	2013-11-14 10:12:04 +0000
@@ -7,60 +7,17 @@
 
 __all__ = [
     'IBuildPackageJob',
-    'COPY_ARCHIVE_SCORE_PENALTY',
-    'PRIVATE_ARCHIVE_SCORE_BONUS',
-    'SCORE_BY_COMPONENT',
-    'SCORE_BY_POCKET',
-    'SCORE_BY_URGENCY',
     ]
 
 from lazr.restful.fields import Reference
 from zope.schema import Int
 
 from lp import _
-from lp.registry.interfaces.pocket import PackagePublishingPocket
-from lp.registry.interfaces.sourcepackage import SourcePackageUrgency
 from lp.services.job.interfaces.job import IJob
 from lp.soyuz.interfaces.binarypackagebuild import IBinaryPackageBuild
 from lp.soyuz.interfaces.buildfarmbuildjob import IBuildFarmBuildJob
 
 
-SCORE_BY_POCKET = {
-    PackagePublishingPocket.BACKPORTS: 0,
-    PackagePublishingPocket.RELEASE: 1500,
-    PackagePublishingPocket.PROPOSED: 3000,
-    PackagePublishingPocket.UPDATES: 3000,
-    PackagePublishingPocket.SECURITY: 4500,
-}
-
-
-SCORE_BY_COMPONENT = {
-    'multiverse': 0,
-    'universe': 250,
-    'restricted': 750,
-    'main': 1000,
-    'partner': 1250,
-}
-
-
-SCORE_BY_URGENCY = {
-    SourcePackageUrgency.LOW: 5,
-    SourcePackageUrgency.MEDIUM: 10,
-    SourcePackageUrgency.HIGH: 15,
-    SourcePackageUrgency.EMERGENCY: 20,
-}
-
-
-PRIVATE_ARCHIVE_SCORE_BONUS = 10000
-
-
-# Rebuilds have usually a lower priority than other builds.
-# This will be subtracted from the final score, usually taking it
-# below 0, ensuring they are built only when nothing else is waiting
-# in the build farm.
-COPY_ARCHIVE_SCORE_PENALTY = 2600
-
-
 class IBuildPackageJob(IBuildFarmBuildJob):
     """A read-only interface for build package jobs."""
 

=== modified file 'lib/lp/soyuz/model/binarypackagebuild.py'
--- lib/lp/soyuz/model/binarypackagebuild.py	2013-11-12 00:12:53 +0000
+++ lib/lp/soyuz/model/binarypackagebuild.py	2013-11-14 10:12:04 +0000
@@ -5,6 +5,11 @@
 __all__ = [
     'BinaryPackageBuild',
     'BinaryPackageBuildSet',
+    'COPY_ARCHIVE_SCORE_PENALTY',
+    'PRIVATE_ARCHIVE_SCORE_BONUS',
+    'SCORE_BY_COMPONENT',
+    'SCORE_BY_POCKET',
+    'SCORE_BY_URGENCY',
     ]
 
 import datetime
@@ -54,6 +59,7 @@
 from lp.registry.interfaces.distroseries import IDistroSeries
 from lp.registry.interfaces.pocket import PackagePublishingPocket
 from lp.registry.interfaces.series import SeriesStatus
+from lp.registry.interfaces.sourcepackage import SourcePackageUrgency
 from lp.registry.model.sourcepackagename import SourcePackageName
 from lp.services.config import config
 from lp.services.database.bulk import load_related
@@ -90,13 +96,6 @@
     IBinaryPackageBuildSet,
     UnparsableDependencies,
     )
-from lp.soyuz.interfaces.buildpackagejob import (
-    COPY_ARCHIVE_SCORE_PENALTY,
-    PRIVATE_ARCHIVE_SCORE_BONUS,
-    SCORE_BY_COMPONENT,
-    SCORE_BY_POCKET,
-    SCORE_BY_URGENCY,
-    )
 from lp.soyuz.interfaces.distroarchseries import IDistroArchSeries
 from lp.soyuz.interfaces.packageset import IPackagesetSet
 from lp.soyuz.model.binarypackagename import BinaryPackageName
@@ -110,6 +109,42 @@
     )
 
 
+SCORE_BY_POCKET = {
+    PackagePublishingPocket.BACKPORTS: 0,
+    PackagePublishingPocket.RELEASE: 1500,
+    PackagePublishingPocket.PROPOSED: 3000,
+    PackagePublishingPocket.UPDATES: 3000,
+    PackagePublishingPocket.SECURITY: 4500,
+}
+
+
+SCORE_BY_COMPONENT = {
+    'multiverse': 0,
+    'universe': 250,
+    'restricted': 750,
+    'main': 1000,
+    'partner': 1250,
+}
+
+
+SCORE_BY_URGENCY = {
+    SourcePackageUrgency.LOW: 5,
+    SourcePackageUrgency.MEDIUM: 10,
+    SourcePackageUrgency.HIGH: 15,
+    SourcePackageUrgency.EMERGENCY: 20,
+}
+
+
+PRIVATE_ARCHIVE_SCORE_BONUS = 10000
+
+
+# Rebuilds have usually a lower priority than other builds.
+# This will be subtracted from the final score, usually taking it
+# below 0, ensuring they are built only when nothing else is waiting
+# in the build farm.
+COPY_ARCHIVE_SCORE_PENALTY = 2600
+
+
 class BinaryPackageBuild(PackageBuildMixin, SQLBase):
     implements(IBinaryPackageBuild)
     _table = 'BinaryPackageBuild'

=== modified file 'lib/lp/soyuz/scripts/initialize_distroseries.py'
--- lib/lp/soyuz/scripts/initialize_distroseries.py	2013-09-23 02:04:18 +0000
+++ lib/lp/soyuz/scripts/initialize_distroseries.py	2013-11-14 10:12:04 +0000
@@ -34,7 +34,6 @@
     CannotCopy,
     IArchiveSet,
     )
-from lp.soyuz.interfaces.buildpackagejob import COPY_ARCHIVE_SCORE_PENALTY
 from lp.soyuz.interfaces.component import IComponentSet
 from lp.soyuz.interfaces.distributionjob import (
     IDistroSeriesDifferenceJobSource,
@@ -45,6 +44,7 @@
     NoSuchPackageSet,
     )
 from lp.soyuz.interfaces.queue import IPackageUploadSet
+from lp.soyuz.model.binarypackagebuild import COPY_ARCHIVE_SCORE_PENALTY
 from lp.soyuz.model.packageset import Packageset
 from lp.soyuz.scripts.packagecopier import do_copy
 

=== modified file 'lib/lp/soyuz/tests/test_binarypackagebuild.py'
--- lib/lp/soyuz/tests/test_binarypackagebuild.py	2013-11-12 00:37:54 +0000
+++ lib/lp/soyuz/tests/test_binarypackagebuild.py	2013-11-14 10:12:04 +0000
@@ -35,19 +35,17 @@
     IBinaryPackageBuildSet,
     UnparsableDependencies,
     )
-from lp.soyuz.interfaces.buildpackagejob import (
+from lp.soyuz.interfaces.buildpackagejob import IBuildPackageJob
+from lp.soyuz.interfaces.component import IComponentSet
+from lp.soyuz.model.binarypackagebuild import (
+    BinaryPackageBuild,
+    BinaryPackageBuildSet,
     COPY_ARCHIVE_SCORE_PENALTY,
-    IBuildPackageJob,
     PRIVATE_ARCHIVE_SCORE_BONUS,
     SCORE_BY_COMPONENT,
     SCORE_BY_POCKET,
     SCORE_BY_URGENCY,
     )
-from lp.soyuz.interfaces.component import IComponentSet
-from lp.soyuz.model.binarypackagebuild import (
-    BinaryPackageBuild,
-    BinaryPackageBuildSet,
-    )
 from lp.soyuz.model.buildpackagejob import BuildPackageJob
 from lp.soyuz.tests.test_publishing import SoyuzTestPublisher
 from lp.testing import (
@@ -226,15 +224,10 @@
         depwait_build = self._setupSimpleDepwaitContext()
         depwait_build_id = depwait_build.id
 
-        # Grab the relevant db records for later comparison.
+        # Grab the relevant DB IDs for later queries.
         store = Store.of(depwait_build)
-        build_package_job = store.find(
-            BuildPackageJob,
-            depwait_build.id == BuildPackageJob.build).one()
-        build_package_job_id = build_package_job.id
-        job_id = store.find(Job, Job.id == build_package_job.job.id).one().id
-        build_queue_id = store.find(
-            BuildQueue, BuildQueue.job == job_id).one().id
+        build_queue_id = depwait_build.buildqueue_record.id
+        job_id = removeSecurityProxy(depwait_build.buildqueue_record.job).id
 
         depwait_build.buildqueue_record.destroySelf()
 
@@ -242,7 +235,7 @@
         self.assertEqual(
             store.find(
                 BuildPackageJob,
-                BuildPackageJob.id == build_package_job_id).count(),
+                BuildPackageJob.build == depwait_build_id).count(),
             0)
         self.assertEqual(
             store.find(Job, Job.id == job_id).count(),


Follow ups