Julian Edwards wrote: > Review: Needs Fixing code > Phew! What a change, thanks for staying late and getting this done > Muharem. There's a few things to fix; you're already aware of some > that I mentioned on IRC. More inline! Hello Julian, thanks for reviewing this monster branch :P Please see my responses below as well as the enclosed incremental diff. >> === modified file 'lib/lp/buildmaster/buildergroup.py' >> --- lib/lp/buildmaster/buildergroup.py 2009-08-16 12:38:12 +0000 >> +++ lib/lp/buildmaster/buildergroup.py 2009-11-13 16:42:17 +0000 >> @@ -130,8 +130,9 @@ >> try: >> build = getUtility(IBuildSet).getByBuildID(int(build_id)) >> queue_item = getUtility(IBuildQueueSet).get(int(queue_item_id)) >> - # Also check it build and buildqueue are properly related. >> - if queue_item.build.id != build.id: >> + queued_build = getUtility(IBuildSet).getByQueueEntry(queue_item) >> + # Also check whether build and buildqueue are properly related. >> + if queued_build.id != build.id: >> raise BuildJobMismatch('Job build entry mismatch') >> >> except (SQLObjectNotFound, NotFoundError, BuildJobMismatch), reason: >> @@ -159,9 +160,10 @@ >> >> Invoke getFileFromSlave method with 'buildlog' identifier. >> """ >> + build = getUtility(IBuildSet).getByQueueEntry(queueItem) >> return queueItem.builder.transferSlaveFileToLibrarian( >> 'buildlog', queueItem.getLogFileName(), >> - queueItem.build.archive.private) >> + build.archive.private) >> >> def updateBuild(self, queueItem): >> """Verify the current build job status. >> @@ -199,7 +201,7 @@ >> "Unknown status code (%s) returned from status() probe." >> % builder_status) >> queueItem.builder = None >> - queueItem.buildstart = None >> + queueItem.setDateStarted(None) >> self.commit() >> return >> >> @@ -261,17 +263,18 @@ >> >> Store Buildlog, datebuilt, duration, dependencies. >> """ >> - queueItem.build.buildlog = self.getLogFromSlave(queueItem) >> - queueItem.build.builder = queueItem.builder >> - queueItem.build.dependencies = dependencies >> + build = getUtility(IBuildSet).getByQueueEntry(queueItem) >> + build.buildlog = self.getLogFromSlave(queueItem) >> + build.builder = queueItem.builder >> + build.dependencies = dependencies >> # XXX cprov 20060615 bug=120584: Currently buildduration includes >> # the scanner latency, it should really be asking the slave for >> # the duration spent building locally. >> - queueItem.build.datebuilt = UTC_NOW >> + build.datebuilt = UTC_NOW >> # We need dynamic datetime.now() instance to be able to perform >> # the time operations for duration. >> RIGHT_NOW = datetime.datetime.now(pytz.timezone('UTC')) >> - queueItem.build.buildduration = RIGHT_NOW - queueItem.buildstart >> + build.buildduration = RIGHT_NOW - queueItem.job.date_started > > Since you added buildqueue.setDateStarted, it makes sense to have a > property buildqueue.date_started so it's consistent. Done. >> def buildStatus_OK(self, queueItem, librarian, buildid, >> @@ -287,7 +290,7 @@ >> self.logger.debug("Processing successful build %s" % buildid) >> # Explode before collect a binary that is denied in this >> # distroseries/pocket >> - build = queueItem.build >> + build = getUtility(IBuildSet).getByQueueEntry(queueItem) >> if not build.archive.allowUpdatesToReleasePocket(): >> assert build.distroseries.canUploadToPocket(build.pocket), ( >> "%s (%s) can not be built for pocket %s: illegal status" >> @@ -309,8 +312,9 @@ >> # can be correctly found during the upload: >> # /distribution_name >> # for all destination archive types. >> - archive = queueItem.build.archive >> - distribution_name = queueItem.build.distribution.name >> + build = getUtility(IBuildSet).getByQueueEntry(queueItem) >> + archive = build.archive >> + distribution_name = build.distribution.name >> target_path = '%s/%s' % (archive.id, distribution_name) >> upload_path = os.path.join(upload_dir, target_path) >> os.makedirs(upload_path) >> @@ -330,10 +334,10 @@ >> # add extra arguments for processing a binary upload >> extra_args = [ >> "--log-file", "%s" % uploader_logfilename, >> - "-d", "%s" % queueItem.build.distribution.name, >> - "-s", "%s" % (queueItem.build.distroseries.name + >> - pocketsuffix[queueItem.build.pocket]), >> - "-b", "%s" % queueItem.build.id, >> + "-d", "%s" % build.distribution.name, >> + "-s", "%s" % (build.distroseries.name + >> + pocketsuffix[build.pocket]), >> + "-b", "%s" % build.id, >> "-J", "%s" % upload_leaf, >> "%s" % root, >> ] >> @@ -409,12 +413,11 @@ >> # uploader about this occurrence. The failure notification will >> # also contain the information required to manually reprocess the >> # binary upload when it was the case. >> - build = getUtility(IBuildSet).getByBuildID(queueItem.build.id) >> + build = getUtility(IBuildSet).getByQueueEntry(queueItem) >> if (build.buildstate != BuildStatus.FULLYBUILT or >> build.binarypackages.count() == 0): >> self.logger.debug("Build %s upload failed." % build.id) >> - # update builder >> - queueItem.build.buildstate = BuildStatus.FAILEDTOUPLOAD >> + build.buildstate = BuildStatus.FAILEDTOUPLOAD >> # Retrieve log file content. >> possible_locations = ( >> 'failed', 'failed-to-move', 'rejected', 'accepted') >> @@ -434,11 +437,13 @@ >> uploader_log_content = 'Could not find upload log file' >> # Store the upload_log_contents in librarian so it can be >> # accessed by anyone with permission to see the build. >> - queueItem.build.storeUploadLog(uploader_log_content) >> + build.storeUploadLog(uploader_log_content) >> # Notify the build failure. >> - queueItem.build.notify(extra_info=uploader_log_content) >> + build.notify(extra_info=uploader_log_content) >> else: >> - self.logger.debug("Gathered build %s completely" % queueItem.name) >> + self.logger.debug( >> + "Gathered build %s completely" % >> + build.sourcepackagerelease.name) >> >> # Release the builder for another job. >> queueItem.builder.cleanSlave() >> @@ -456,10 +461,11 @@ >> set the job status as FAILEDTOBUILD, store available info and >> remove Buildqueue entry. >> """ >> - queueItem.build.buildstate = BuildStatus.FAILEDTOBUILD >> + build = getUtility(IBuildSet).getByQueueEntry(queueItem) >> + build.buildstate = BuildStatus.FAILEDTOBUILD >> self.storeBuildInfo(queueItem, librarian, buildid, dependencies) >> queueItem.builder.cleanSlave() >> - queueItem.build.notify() >> + build.notify() >> queueItem.destroySelf() >> >> def buildStatus_DEPFAIL(self, queueItem, librarian, buildid, >> @@ -470,7 +476,8 @@ >> MANUALDEPWAIT, store available information, remove BuildQueue >> entry and release builder slave for another job. >> """ >> - queueItem.build.buildstate = BuildStatus.MANUALDEPWAIT >> + build = getUtility(IBuildSet).getByQueueEntry(queueItem) >> + build.buildstate = BuildStatus.MANUALDEPWAIT >> self.storeBuildInfo(queueItem, librarian, buildid, dependencies) >> self.logger.critical("***** %s is MANUALDEPWAIT *****" >> % queueItem.builder.name) >> @@ -485,12 +492,13 @@ >> job as CHROOTFAIL, store available information, remove BuildQueue >> and release the builder. >> """ >> - queueItem.build.buildstate = BuildStatus.CHROOTWAIT >> + build = getUtility(IBuildSet).getByQueueEntry(queueItem) >> + build.buildstate = BuildStatus.CHROOTWAIT >> self.storeBuildInfo(queueItem, librarian, buildid, dependencies) >> self.logger.critical("***** %s is CHROOTWAIT *****" % >> queueItem.builder.name) >> queueItem.builder.cleanSlave() >> - queueItem.build.notify() >> + build.notify() >> queueItem.destroySelf() >> >> def buildStatus_BUILDERFAIL(self, queueItem, librarian, buildid, >> @@ -507,10 +515,11 @@ >> ("Builder returned BUILDERFAIL when asked " >> "for its status")) >> # simply reset job >> - queueItem.build.buildstate = BuildStatus.NEEDSBUILD >> + build = getUtility(IBuildSet).getByQueueEntry(queueItem) >> + build.buildstate = BuildStatus.NEEDSBUILD >> self.storeBuildInfo(queueItem, librarian, buildid, dependencies) >> queueItem.builder = None >> - queueItem.buildstart = None >> + queueItem.setDateStarted(None) >> >> def buildStatus_GIVENBACK(self, queueItem, librarian, buildid, >> filemap=None, dependencies=None): >> @@ -522,7 +531,8 @@ >> """ >> self.logger.warning("***** %s is GIVENBACK by %s *****" >> % (buildid, queueItem.builder.name)) >> - queueItem.build.buildstate = BuildStatus.NEEDSBUILD >> + build = getUtility(IBuildSet).getByQueueEntry(queueItem) >> + build.buildstate = BuildStatus.NEEDSBUILD >> self.storeBuildInfo(queueItem, librarian, buildid, dependencies) >> # XXX cprov 2006-05-30: Currently this information is not >> # properly presented in the Web UI. We will discuss it in >> @@ -530,7 +540,7 @@ >> # to use this content. For now we just ensure it's stored. >> queueItem.builder.cleanSlave() >> queueItem.builder = None >> - queueItem.buildstart = None >> + queueItem.setDateStarted(None) >> queueItem.logtail = None >> queueItem.lastscore = 0 >> >> >> === modified file 'lib/lp/buildmaster/master.py' >> --- lib/lp/buildmaster/master.py 2009-10-26 18:40:04 +0000 >> +++ lib/lp/buildmaster/master.py 2009-11-13 16:42:17 +0000 >> @@ -280,8 +280,10 @@ >> "scanActiveBuilders() found %d active build(s) to check" >> % queueItems.count()) >> >> + build_set = getUtility(IBuildSet) >> for job in queueItems: >> - proc = job.archseries.processorfamily >> + build = build_set.getByQueueEntry(job) >> + proc = build.distroarchseries.processorfamily >> try: >> builders = notes[proc]["builders"] >> except KeyError: >> @@ -309,7 +311,7 @@ >> % candidates.count()) >> >> for job in candidates: >> - uptodate_build = getUtility(IBuildSet).getByBuildID(job.build.id) >> + uptodate_build = getUtility(IBuildSet).getByQueueEntry(job) >> if uptodate_build.buildstate != BuildStatus.NEEDSBUILD: >> continue >> job.score() >> >> === modified file 'lib/lp/buildmaster/tests/queuebuilder.txt' >> --- lib/lp/buildmaster/tests/queuebuilder.txt 2009-10-26 18:40:04 +0000 >> +++ lib/lp/buildmaster/tests/queuebuilder.txt 2009-11-13 16:42:17 +0000 >> @@ -229,7 +229,7 @@ >> >>> copied_pub = pub_failed.copyTo( >> ... hoary, PackagePublishingPocket.RELEASE, warty.main_archive) >> >> - >>> from lp.soyuz.interfaces.build import BuildStatus >> + >>> from lp.soyuz.interfaces.build import BuildStatus, IBuildSet >> >>> failed_build = pub_failed.sourcepackagerelease.createBuild( >> ... warty['i386'], PackagePublishingPocket.RELEASE, >> ... warty.main_archive, status=BuildStatus.FAILEDTOBUILD) >> @@ -343,7 +343,8 @@ >> happen in parallel with build creation. >> >> >>> build_queue = active_jobs[0] >> - >>> print build_queue.build.title >> + >>> build = getUtility(IBuildSet).getByQueueEntry(build_queue) >> + >>> print build.title >> i386 build of test-buildd 667 in ubuntu hoary RELEASE >> >>> build_queue.lastscore >> 2505 >> @@ -351,15 +352,15 @@ >> Check the published component name retriever, they might be different, >> i.e., the published component can be different than the original component. >> >> - >>> print build_queue.build.current_component.name >> + >>> print build.current_component.name >> main >> - >>> print build_queue.build.sourcepackagerelease.component.name >> + >>> print build.sourcepackagerelease.component.name >> main >> >> Missing BuildQueue records, resulting from given-back builds, are >> created in the last stage of the queue-builder script. >> >> - >>> given_back_build = build_queue.build >> + >>> given_back_build = getUtility(IBuildSet).getByQueueEntry(build_queue) >> >>> build_queue.destroySelf() >> >>> flush_database_updates() >> >> >> === modified file 'lib/lp/buildmaster/tests/test_manager.py' >> --- lib/lp/buildmaster/tests/test_manager.py 2009-09-07 13:02:02 +0000 >> +++ lib/lp/buildmaster/tests/test_manager.py 2009-11-13 16:42:17 +0000 >> @@ -24,7 +24,7 @@ >> from lp.buildmaster.tests.harness import BuilddManagerTestSetup >> from canonical.launchpad.ftests import ANONYMOUS, login >> from lp.soyuz.tests.soyuzbuilddhelpers import SaneBuildingSlave >> -from lp.soyuz.interfaces.build import BuildStatus >> +from lp.soyuz.interfaces.build import BuildStatus, IBuildSet >> from lp.soyuz.interfaces.builder import IBuilderSet >> from lp.soyuz.interfaces.buildqueue import IBuildQueueSet >> from lp.registry.interfaces.distribution import IDistributionSet >> @@ -494,8 +494,9 @@ >> >> self.assertTrue(job is not None) >> self.assertEqual(job.builder, builder) >> - self.assertTrue(job.buildstart is not None) >> - self.assertEqual(job.build.buildstate, BuildStatus.BUILDING) >> + self.assertTrue(job.job.date_started is not None) >> + build = getUtility(IBuildSet).getByQueueEntry(job) >> + self.assertEqual(build.buildstate, BuildStatus.BUILDING) >> self.assertEqual(job.logtail, logtail) >> >> def _getManager(self): >> @@ -617,8 +618,9 @@ >> >> job = getUtility(IBuildQueueSet).get(job.id) >> self.assertTrue(job.builder is None) >> - self.assertTrue(job.buildstart is None) >> - self.assertEqual(job.build.buildstate, BuildStatus.NEEDSBUILD) >> + self.assertTrue(job.job.date_started is None) >> + build = getUtility(IBuildSet).getByQueueEntry(job) >> + self.assertEqual(build.buildstate, BuildStatus.NEEDSBUILD) >> >> def testScanRescuesJobFromBrokenBuilder(self): >> # The job assigned to a broken builder is rescued. >> @@ -701,13 +703,14 @@ >> builder.builderok = True >> >> job = builder.currentjob >> + build = getUtility(IBuildSet).getByQueueEntry(job) >> self.assertEqual( >> 'i386 build of mozilla-firefox 0.9 in ubuntu hoary RELEASE', >> - job.build.title) >> + build.title) >> >> - self.assertEqual('BUILDING', job.build.buildstate.name) >> + self.assertEqual('BUILDING', build.buildstate.name) >> self.assertNotEqual(None, job.builder) >> - self.assertNotEqual(None, job.buildstart) >> + self.assertNotEqual(None, job.job.date_started) > > Urg, I think we need to rename all instances of "job" that are actually > a buildqueue object, or things will get rather confusing. > > Also same comment regarding having a date_started property on the > buildqueue. > > I wonder now if we shouldn't have just turned the existing buildstart > column into a property that returned job.date_started ... In the interest of not further blowing up this already supersized branch I am deferring this to a forthcoming refactoring branch. >> self.assertNotEqual(None, job.logtail) >> >> transaction.commit() >> @@ -717,9 +720,10 @@ >> def assertJobIsClean(self, job_id): >> """Re-fetch the `IBuildQueue` record and check if it's clean.""" >> job = getUtility(IBuildQueueSet).get(job_id) >> - self.assertEqual('NEEDSBUILD', job.build.buildstate.name) >> + build = getUtility(IBuildSet).getByQueueEntry(job) >> + self.assertEqual('NEEDSBUILD', build.buildstate.name) >> self.assertEqual(None, job.builder) >> - self.assertEqual(None, job.buildstart) >> + self.assertEqual(None, job.job.date_started) >> self.assertEqual(None, job.logtail) >> >> def testResetDispatchResult(self): >> >> === modified file 'lib/lp/registry/model/sourcepackage.py' >> --- lib/lp/registry/model/sourcepackage.py 2009-10-26 18:40:04 +0000 >> +++ lib/lp/registry/model/sourcepackage.py 2009-11-13 16:42:17 +0000 >> @@ -554,8 +554,10 @@ >> # It should present the builds in a more natural order. >> if build_state in [BuildStatus.NEEDSBUILD, BuildStatus.BUILDING]: >> orderBy = ["-BuildQueue.lastscore"] >> + clauseTables.append('BuildPackageJob') >> + condition_clauses.append('BuildPackageJob.build = Build.id') >> clauseTables.append('BuildQueue') >> - condition_clauses.append('BuildQueue.build = Build.id') >> + condition_clauses.append('BuildQueue.job = BuildPackageJob.job') >> elif build_state == BuildStatus.SUPERSEDED or build_state is None: >> orderBy = ["-Build.datecreated"] >> else: >> >> === modified file 'lib/lp/services/job/tests/test_job.py' >> --- lib/lp/services/job/tests/test_job.py 2009-07-17 00:26:05 +0000 >> +++ lib/lp/services/job/tests/test_job.py 2009-11-13 16:42:17 +0000 >> @@ -8,6 +8,8 @@ >> from unittest import TestLoader >> >> import pytz >> +from zope.component import getUtility >> + >> from canonical.database.constants import UTC_NOW >> from canonical.testing import LaunchpadZopelessLayer >> from storm.locals import Store >> @@ -17,6 +19,8 @@ >> from lp.services.job.interfaces.job import IJob, JobStatus >> from lp.testing import TestCase >> from canonical.launchpad.webapp.testing import verifyObject >> +from canonical.launchpad.webapp.interfaces import ( >> + IStoreSelector, MAIN_STORE, DEFAULT_FLAVOR) >> >> >> class TestJob(TestCase): >> @@ -155,40 +159,53 @@ >> >> layer = LaunchpadZopelessLayer >> >> + def _sampleData(self): >> + store = getUtility(IStoreSelector).get(MAIN_STORE, DEFAULT_FLAVOR) >> + return list(store.execute(Job.ready_jobs)) >> + >> def test_ready_jobs(self): >> """Job.ready_jobs should include new jobs.""" >> + preexisting = self._sampleData() >> job = Job() >> self.assertEqual( >> - [(job.id,)], list(Store.of(job).execute(Job.ready_jobs))) >> + preexisting + [(job.id,)], >> + list(Store.of(job).execute(Job.ready_jobs))) >> >> def test_ready_jobs_started(self): >> """Job.ready_jobs should not jobs that have been started.""" >> + preexisting = self._sampleData() >> job = Job(_status=JobStatus.RUNNING) >> self.assertEqual( >> - [], list(Store.of(job).execute(Job.ready_jobs))) >> + preexisting, list(Store.of(job).execute(Job.ready_jobs))) >> >> def test_ready_jobs_lease_expired(self): >> """Job.ready_jobs should include jobs with expired leases.""" >> + preexisting = self._sampleData() >> UNIX_EPOCH = datetime.fromtimestamp(0, pytz.timezone('UTC')) >> job = Job(lease_expires=UNIX_EPOCH) >> self.assertEqual( >> - [(job.id,)], list(Store.of(job).execute(Job.ready_jobs))) >> + preexisting + [(job.id,)], >> + list(Store.of(job).execute(Job.ready_jobs))) >> >> def test_ready_jobs_lease_in_future(self): >> """Job.ready_jobs should not include jobs with active leases.""" >> + preexisting = self._sampleData() >> future = datetime.fromtimestamp( >> time.time() + 1000, pytz.timezone('UTC')) >> job = Job(lease_expires=future) >> - self.assertEqual([], list(Store.of(job).execute(Job.ready_jobs))) >> + self.assertEqual( >> + preexisting, list(Store.of(job).execute(Job.ready_jobs))) >> >> def test_ready_jobs_not_jobs_scheduled_in_future(self): >> """Job.ready_jobs does not included jobs scheduled for a time in the >> future. >> """ >> + preexisting = self._sampleData() >> future = datetime.fromtimestamp( >> time.time() + 1000, pytz.timezone('UTC')) >> job = Job(scheduled_start=future) >> - self.assertEqual([], list(Store.of(job).execute(Job.ready_jobs))) >> + self.assertEqual( >> + preexisting, list(Store.of(job).execute(Job.ready_jobs))) >> >> def test_acquireLease(self): >> """Job.acquireLease should set job.lease_expires.""" >> >> === modified file 'lib/lp/soyuz/browser/build.py' >> --- lib/lp/soyuz/browser/build.py 2009-10-26 18:40:04 +0000 >> +++ lib/lp/soyuz/browser/build.py 2009-11-13 16:42:17 +0000 >> @@ -288,10 +288,10 @@ >> prefetched_data = dict() >> build_ids = [build.id for build in builds] >> results = getUtility(IBuildQueueSet).getForBuilds(build_ids) >> - for (buildqueue, builder) in results: >> + for (buildqueue, _builder, build_job) in results: >> # Get the build's id, 'buildqueue', 'sourcepackagerelease' and >> # 'buildlog' (from the result set) respectively. >> - prefetched_data[buildqueue.build.id] = buildqueue >> + prefetched_data[build_job.build.id] = buildqueue >> >> complete_builds = [] >> for build in builds: >> >> === modified file 'lib/lp/soyuz/browser/builder.py' >> --- lib/lp/soyuz/browser/builder.py 2009-09-17 14:45:15 +0000 >> +++ lib/lp/soyuz/browser/builder.py 2009-11-13 16:42:17 +0000 >> @@ -237,12 +237,12 @@ >> def current_build_duration(self): >> """Return the delta representing the duration of the current job.""" >> if (self.context.currentjob is None or >> - self.context.currentjob.buildstart is None): >> + self.context.currentjob.job.date_started is None): >> return None >> else: >> UTC = pytz.timezone('UTC') >> - buildstart = self.context.currentjob.buildstart >> - return datetime.datetime.now(UTC) - buildstart >> + date_started = self.context.currentjob.job.date_started >> + return datetime.datetime.now(UTC) - date_started >> >> @property >> def page_title(self): >> >> === modified file 'lib/lp/soyuz/browser/tests/builder-views.txt' >> --- lib/lp/soyuz/browser/tests/builder-views.txt 2009-09-16 19:06:48 +0000 >> +++ lib/lp/soyuz/browser/tests/builder-views.txt 2009-11-13 16:42:17 +0000 >> @@ -1,7 +1,7 @@ >> = Builder View Classes and Pages = >> >> >>> from zope.component import getMultiAdapter, getUtility >> - >>> from canonical.launchpad.interfaces import IBuilderSet >> + >>> from canonical.launchpad.interfaces import IBuildSet, IBuilderSet >> >>> from canonical.launchpad.webapp.servers import LaunchpadTestRequest >> >> >>> builder = getUtility(IBuilderSet).get(1) >> @@ -158,7 +158,8 @@ >> >>> frog = getUtility(IBuilderSet)['frog'] >> >>> frog.builderok = True >> >>> private_build.builder = frog >> - >>> private_job = BuildQueue(build=private_build, builder=frog) >> + >>> private_job = private_build.createBuildQueueEntry() >> + >>> private_job.builder = frog >> >>> private_job_id = private_job.id >> >> >>> from canonical.database.sqlbase import flush_database_caches >> @@ -175,7 +176,9 @@ >> >>> print frog.builderok >> True >> >> - >>> print frog.currentjob.build.title >> + >>> build_set = getUtility(IBuildSet) >> + >>> build = build_set.getByQueueEntry(frog.currentjob) >> + >>> print build.title >> i386 build of privacy-test 666 in ubuntutest breezy-autotest RELEASE >> >> >>> print frog.failnotes >> @@ -199,7 +202,8 @@ >> >>> print admin_view.context.builderok >> True >> >> - >>> print admin_view.context.currentjob.build.title >> + >>> build = build_set.getByQueueEntry(admin_view.context.currentjob) >> + >>> print build.title >> i386 build of privacy-test 666 in ubuntutest breezy-autotest RELEASE >> >> >>> print admin_view.context.failnotes >> @@ -211,7 +215,7 @@ >> >> >>> import datetime >> >>> import pytz >> - >>> private_job.buildstart = ( >> + >>> private_job.job.date_started = ( >> ... datetime.datetime.now(pytz.UTC) - datetime.timedelta(10)) >> >>> print admin_view.current_build_duration >> 10 days... >> >> === modified file 'lib/lp/soyuz/configure.zcml' >> --- lib/lp/soyuz/configure.zcml 2009-11-09 17:59:18 +0000 >> +++ lib/lp/soyuz/configure.zcml 2009-11-13 16:42:17 +0000 >> @@ -560,7 +560,7 @@ >> >> > permission="zope.Public" >> - set_attributes="lastscore builder buildstart logtail"/> >> + set_attributes="lastscore builder logtail"/> > > the new date_started should go here. OK. Added. >> >> >> >> @@ -863,5 +863,11 @@ >> interface="lp.soyuz.interfaces.packagesetgroup.IPackagesetGroup"/> >> >> >> + >> + > + class="lp.soyuz.model.buildpackagejob.BuildPackageJob"> >> + > + interface="lp.soyuz.interfaces.buildpackagejob.IBuildPackageJob"/> >> + >> >> >> >> === modified file 'lib/lp/soyuz/doc/build-estimated-dispatch-time.txt' >> --- lib/lp/soyuz/doc/build-estimated-dispatch-time.txt 2009-08-28 07:34:44 +0000 >> +++ lib/lp/soyuz/doc/build-estimated-dispatch-time.txt 2009-11-13 16:42:17 +0000 >> @@ -59,7 +59,8 @@ >> >>> UTC = pytz.timezone('UTC') >> >>> bob_the_builder = builder_set.get(1) >> >>> cur_bqueue = bob_the_builder.currentjob >> - >>> cur_build = cur_bqueue.build >> + >>> from lp.soyuz.interfaces.build import IBuildSet >> + >>> cur_build = getUtility(IBuildSet).getByQueueEntry(cur_bqueue) >> >> Make sure the job at hand is currently being built. >> >> @@ -73,16 +74,16 @@ >> of job N in the build queue. These values will now be set for the job >> that is currently building. >> >> + >>> from zope.security.proxy import removeSecurityProxy >> >>> cur_bqueue.lastscore = 1111 >> - >>> cur_bqueue.buildstart = datetime(2008, 4, 1, 10, 45, 39, >> - ... tzinfo=UTC) >> - >>> print cur_bqueue.buildstart >> + >>> removeSecurityProxy(cur_bqueue.job).date_started = ( >> + ... datetime(2008, 4, 1, 10, 45, 39, tzinfo=UTC)) > > I'd like us to find out why removeSecurityProxy is needed here. IJob has > a zcml declaration to allow all items in its interface so it should work. That's fixed, removeSecurityProxy() is not used any more here. >> + >>> print cur_bqueue.job.date_started >> 2008-04-01 10:45:39+00:00 >> >> Please note that the "estimated build duration" is an internal property >> and not meant to be viewed or modified by an end user. >> >> - >>> from zope.security.proxy import removeSecurityProxy >> >>> naked_build = removeSecurityProxy(cur_build) >> >>> naked_build.estimated_build_duration = timedelta(minutes=56) >> >> >> === modified file 'lib/lp/soyuz/doc/buildd-dispatching.txt' >> --- lib/lp/soyuz/doc/buildd-dispatching.txt 2009-10-14 08:20:40 +0000 >> +++ lib/lp/soyuz/doc/buildd-dispatching.txt 2009-11-13 16:42:17 +0000 >> @@ -134,18 +134,20 @@ >> >> >>> job.id >> 2 >> - >>> job.build.buildstate.name >> + >>> from lp.soyuz.interfaces.build import IBuildSet >> + >>> build = getUtility(IBuildSet).getByQueueEntry(job) >> + >>> build.buildstate.name >> 'NEEDSBUILD' >> >>> job.builder is None >> True >> - >>> job.buildstart is None >> + >>> job.job.date_started is None >> True >> - >>> job.is_virtualized >> + >>> build.is_virtualized >> False >> >> The build start time is not set yet either. >> >> - >>> print job.build.date_first_dispatched >> + >>> print build.date_first_dispatched >> None >> >> Update the SourcePackageReleaseFile corresponding to this job: >> @@ -154,7 +156,7 @@ >> >>> alias_id = librarian_client.addFile( >> ... 'foo.dsc', len(content), StringIO(content), 'application/dsc') >> >> - >>> sprf = job.build.sourcepackagerelease.files[0] >> + >>> sprf = build.sourcepackagerelease.files[0] >> >>> from zope.security.proxy import removeSecurityProxy >> >>> naked_sprf = removeSecurityProxy(sprf) >> >>> naked_sprf.libraryfile = getUtility(ILibraryFileAliasSet)[alias_id] >> @@ -167,35 +169,20 @@ >> >> Verify if the job (BuildQueue) was updated appropriately: >> >> - >>> def checkTimes(expected, actual): >> - ... if expected != actual: >> - ... return "expected: %s, actual: %s" % (expected, actual) >> - ... else: >> - ... return "OK" >> - >> >>> job.builder.id == bob_builder.id >> True >> >> - >>> job.build.buildstate.name >> + >>> build = getUtility(IBuildSet).getByQueueEntry(job) >> + >>> build.buildstate.name >> 'BUILDING' >> >> - >>> from canonical.database.sqlbase import get_transaction_timestamp >> - >>> checkTimes(get_transaction_timestamp(), job.buildstart) >> - 'OK' >> - >> -The build start time will be set to the same value. >> - >> - >>> checkTimes(get_transaction_timestamp(), >> - ... job.build.date_first_dispatched) >> - 'OK' >> - >> Shutdown builder, mark the build record as failed and remove the >> buildqueue record, so the build was eliminated: >> >> >>> BuilddSlaveTestSetup().tearDown() >> >> >>> from lp.soyuz.interfaces.build import BuildStatus >> - >>> job.build.buildstate = BuildStatus.FAILEDTOBUILD >> + >>> build.buildstate = BuildStatus.FAILEDTOBUILD >> >>> job.destroySelf() >> >>> flush_database_updates() >> >> @@ -217,12 +204,13 @@ >> 3 >> >>> ppa_job.builder == None >> True >> - >>> ppa_job.buildstart == None >> + >>> ppa_job.job.date_started == None >> True >> >> The build job's archive requires virtualized builds. >> >> - >>> ppa_job.build.archive.require_virtualized >> + >>> build = getUtility(IBuildSet).getByQueueEntry(ppa_job) >> + >>> build.archive.require_virtualized >> True >> >> But the builder is not virtualized. >> @@ -249,10 +237,10 @@ >> >>> from lp.soyuz.model.publishing import ( >> ... SourcePackagePublishingHistory) >> >>> [old_pub] = SourcePackagePublishingHistory.selectBy( >> - ... distroseries=ppa_job.build.distroseries, >> - ... sourcepackagerelease=ppa_job.build.sourcepackagerelease) >> + ... distroseries=build.distroseries, >> + ... sourcepackagerelease=build.sourcepackagerelease) >> >>> new_pub = old_pub.copyTo( >> - ... old_pub.distroseries, old_pub.pocket, ppa_job.build.archive) >> + ... old_pub.distroseries, old_pub.pocket, build.archive) >> >> >>> bob_builder.virtualized = True >> >>> syncUpdate(bob_builder) >> @@ -293,19 +281,16 @@ >> >>> ppa_job.builder.name >> u'bob' >> >> - >>> ppa_job.build.buildstate.name >> + >>> build.buildstate.name >> 'BUILDING' >> >> - >>> ppa_job.buildstart == get_transaction_timestamp() >> - True >> - >> Shutdown builder slave, mark the ppa build record as failed, remove the >> buildqueue record and make 'bob' builder non-virtual again, so the >> environment is back to the initial state. >> >> >>> BuilddSlaveTestSetup().tearDown() >> >> - >>> ppa_job.build.buildstate = BuildStatus.FAILEDTOBUILD >> + >>> build.buildstate = BuildStatus.FAILEDTOBUILD >> >>> ppa_job.destroySelf() >> >>> bob_builder.virtualized = False >> >>> flush_database_updates() >> @@ -332,9 +317,9 @@ >> 4 >> >>> print sec_job.builder >> None >> - >>> print sec_job.buildstart >> + >>> print sec_job.job.date_started >> None >> - >>> sec_job.is_virtualized >> + >>> sec_build.is_virtualized >> False >> >> In normal conditions the next available candidate would be the job >> >> === modified file 'lib/lp/soyuz/doc/buildd-scoring.txt' >> --- lib/lp/soyuz/doc/buildd-scoring.txt 2009-08-30 23:57:41 +0000 >> +++ lib/lp/soyuz/doc/buildd-scoring.txt 2009-11-13 16:42:17 +0000 >> @@ -49,7 +49,7 @@ >> >>> def setUpBuildQueueEntry( >> ... component_name='main', urgency=SourcePackageUrgency.HIGH, >> ... pocket=PackagePublishingPocket.RELEASE, >> - ... date_created=LOCAL_NOW, manual=False): >> + ... date_created=LOCAL_NOW, manual=False, archive=None): >> ... global version >> ... commit() >> ... LaunchpadZopelessLayer.switchDbUser('launchpad') >> @@ -57,7 +57,7 @@ >> ... sourcename='test-build', version=str(version), >> ... distroseries=hoary, component=component_name, >> ... urgency=urgency, pocket=pocket, >> - ... status=PackagePublishingStatus.PUBLISHED) >> + ... status=PackagePublishingStatus.PUBLISHED, archive=archive) >> ... commit() >> ... LaunchpadZopelessLayer.switchDbUser(test_dbuser) >> ... version += 1 >> @@ -65,7 +65,7 @@ >> ... hoary386, pub.pocket, pub.archive) >> ... >> ... build_queue = build.createBuildQueueEntry() >> - ... build_queue.created = date_created >> + ... build_queue.job.date_created = date_created >> ... build_queue.manual = manual >> ... >> ... return build_queue >> @@ -86,8 +86,10 @@ >> >> >>> commit() >> >>> LaunchpadZopelessLayer.switchDbUser('launchpad') >> - >>> bq0.build.archive.buildd_secret = "secret" >> - >>> bq0.build.archive.private = True >> + >>> from lp.soyuz.interfaces.build import IBuildSet >> + >>> build = getUtility(IBuildSet).getByQueueEntry(bq0) >> + >>> build.archive.buildd_secret = "secret" >> + >>> build.archive.private = True >> >>> bq0.score() >> >>> bq0.lastscore >> 12515 >> @@ -96,19 +98,19 @@ >> IArchive.relative_build_score to boost by 100 changes the lastscore value >> appropriately. >> >> - >>> bq0.build.archive.relative_build_score = 100 >> + >>> build.archive.relative_build_score = 100 >> >>> bq0.score() >> >>> bq0.lastscore >> 12615 >> >> The delta can also be negative. >> >> - >>> bq0.build.archive.relative_build_score = -100 >> + >>> build.archive.relative_build_score = -100 >> >>> bq0.score() >> >>> bq0.lastscore >> 12415 >> >> - >>> bq0.build.archive.relative_build_score = 0 >> + >>> build.archive.relative_build_score = 0 >> >>> LaunchpadZopelessLayer.switchDbUser(test_dbuser) >> >> >> @@ -250,9 +252,15 @@ >> they all have a fixed score of -10. They will get built in the order >> they were created. >> >> - >>> from canonical.launchpad.interfaces import ArchivePurpose >> - >>> bqc = setUpBuildQueueEntry() >> - >>> bqc.build.archive.purpose = ArchivePurpose.COPY >> + >>> LaunchpadZopelessLayer.switchDbUser('launchpad') >> + >>> from canonical.launchpad.interfaces import ( >> + ... ArchivePurpose, IArchiveSet) >> + >>> copy = getUtility(IArchiveSet).new( >> + ... owner=ubuntu.owner, purpose=ArchivePurpose.COPY, >> + ... name='test-rebuild') >> + >> + >>> bqc = setUpBuildQueueEntry(archive=copy) >> + >>> build = getUtility(IBuildSet).getByQueueEntry(bqc) >> >>> bqc.score() >> >>> bqc.lastscore >> -10 >> >> === modified file 'lib/lp/soyuz/doc/buildd-slavescanner.txt' >> --- lib/lp/soyuz/doc/buildd-slavescanner.txt 2009-11-05 10:51:36 +0000 >> +++ lib/lp/soyuz/doc/buildd-slavescanner.txt 2009-11-13 16:42:17 +0000 >> @@ -188,10 +188,11 @@ >> To make testing easier we provide a convenience function to put a BuildQueue >> object into a preset fixed state: >> >> + >>> from zope.security.proxy import removeSecurityProxy > > This isn't used anywhere is it? There are a few tests (I did not need to touch) that still use removeSecurityProxy(). >> >>> default_start = datetime.datetime(2005, 1, 1, 8, 0, 0, tzinfo=UTC) >> >>> def setupBuildQueue(build_queue, builder): >> ... build_queue.builder = builder >> - ... build_queue.buildstart = default_start >> + ... build_queue.setDateStarted(default_start) >> >> Remove any previous buildmaster ROOT directory, to avoid any garbage >> lock conflict (it would be recreated automatically if necessary) >> @@ -216,7 +217,7 @@ >> >>> from canonical.launchpad.ftests import syncUpdate >> >>> if a_builder.currentjob is not None: >> ... currentjob = a_builder.currentjob >> - ... currentjob.buildstart = None >> + ... currentjob.setDateStarted(None) >> ... currentjob.builder = None >> ... syncUpdate(currentjob) >> >> @@ -236,17 +237,18 @@ >> Do the test execution: >> >> >>> buildergroup.updateBuild(bqItem3) >> - >>> bqItem3.build.builder is not None >> - True >> - >>> bqItem3.build.datebuilt is not None >> - True >> - >>> bqItem3.build.buildduration is not None >> - True >> - >>> bqItem3.build.buildlog is not None >> + >>> build = getUtility(IBuildSet).getByQueueEntry(bqItem3) >> + >>> build.builder is not None >> + True >> + >>> build.datebuilt is not None >> + True >> + >>> build.buildduration is not None >> + True >> + >>> build.buildlog is not None >> True >> >>> check_mail_sent(last_stub_mail_count) >> True >> - >>> bqItem3.build.buildstate.title >> + >>> build.buildstate.title >> 'Failed to build' >> >> Cleanup in preparation for the next test: >> @@ -270,19 +272,20 @@ >> >> >>> buildergroup.updateBuild(bqItem4) >> CRITICAL:root:***** bob is MANUALDEPWAIT ***** >> - >>> bqItem4.build.builder is not None >> - True >> - >>> bqItem4.build.datebuilt is not None >> - True >> - >>> bqItem4.build.buildduration is not None >> - True >> - >>> bqItem4.build.buildlog is not None >> + >>> build = getUtility(IBuildSet).getByQueueEntry(bqItem4) >> + >>> build.builder is not None >> + True >> + >>> build.datebuilt is not None >> + True >> + >>> build.buildduration is not None >> + True >> + >>> build.buildlog is not None >> True >> >>> check_mail_sent(last_stub_mail_count) >> False >> - >>> bqItem4.build.dependencies >> + >>> build.dependencies >> u'baz (>= 1.0.1)' >> - >>> bqItem4.build.buildstate.title >> + >>> build.buildstate.title >> 'Dependency wait' >> >> Cleanup in preparation for the next test: >> @@ -302,17 +305,18 @@ >> ... WaitingSlave('BuildStatus.CHROOTFAIL')) >> >>> buildergroup.updateBuild(bqItem5) >> CRITICAL:root:***** bob is CHROOTWAIT ***** >> - >>> bqItem5.build.builder is not None >> - True >> - >>> bqItem5.build.datebuilt is not None >> - True >> - >>> bqItem5.build.buildduration is not None >> - True >> - >>> bqItem5.build.buildlog is not None >> + >>> build = getUtility(IBuildSet).getByQueueEntry(bqItem5) >> + >>> build.builder is not None >> + True >> + >>> build.datebuilt is not None >> + True >> + >>> build.buildduration is not None >> + True >> + >>> build.buildlog is not None >> True >> >>> check_mail_sent(last_stub_mail_count) >> True >> - >>> bqItem5.build.buildstate.title >> + >>> build.buildstate.title >> 'Chroot problem' >> >> Cleanup in preparation for the next test: >> @@ -343,7 +347,8 @@ >> True >> >>> check_mail_sent(last_stub_mail_count) >> False >> - >>> bqItem6.build.buildstate.title >> + >>> build = getUtility(IBuildSet).getByQueueEntry(bqItem6) >> + >>> build.buildstate.title >> 'Needs building' >> >> Cleanup in preparation for the next test: >> @@ -384,6 +389,8 @@ >> >>> setupBuildQueue(bqItem8, a_builder) >> >>> last_stub_mail_count = len(stub.test_emails) >> >> + >>> bqItem8.builder.setSlaveForTesting(BuildingSlave()) >> + >>> buildergroup.updateBuild(bqItem8) >> >>> bqItem8.builder.setSlaveForTesting(AbortedSlave()) >> >>> bqItem8.builder.name >> u'bob' >> @@ -445,17 +452,18 @@ >> FAILEDTOUPLOAD: >> >> >>> buildergroup.updateBuild(bqItem10) >> - >>> bqItem10.build.builder is not None >> - True >> - >>> bqItem10.build.datebuilt is not None >> - True >> - >>> bqItem10.build.buildduration is not None >> - True >> - >>> bqItem10.build.buildlog is not None >> + >>> build = getUtility(IBuildSet).getByQueueEntry(bqItem10) >> + >>> build.builder is not None >> + True >> + >>> build.datebuilt is not None >> + True >> + >>> build.buildduration is not None >> + True >> + >>> build.buildlog is not None >> True >> >>> check_mail_sent(last_stub_mail_count) >> True >> - >>> bqItem10.build.buildstate.title >> + >>> build.buildstate.title >> 'Failed to upload' >> >> Let's check the emails generated by this 'failure' >> @@ -493,7 +501,7 @@ >> output is both emailed in an immediate notification, and stored in the >> librarian for future reference. >> >> - >>> bqItem10.build.upload_log is not None >> + >>> build.upload_log is not None >> True >> >> What we can clearly notice is that the buildlog is still containing >> @@ -514,16 +522,16 @@ >> >> >>> bqItem10 = getUtility(IBuildSet).getByBuildID( >> ... 6).createBuildQueueEntry() >> + >>> build = getUtility(IBuildSet).getByQueueEntry(bqItem10) >> >> XXX: The pocket attribute is not intended to be changed in regular code, but >> for this test we want to change it on the fly. An alternative would be to add >> new sample data for a build that can be uploaded with binary packages attached >> to it. >> >> - >>> from zope.security.proxy import removeSecurityProxy >> >>> from lp.registry.interfaces.pocket import PackagePublishingPocket >> >>> removeSecurityProxy( >> - ... bqItem10.build).pocket = PackagePublishingPocket.UPDATES >> + ... build).pocket = PackagePublishingPocket.UPDATES >> >>> setupBuildQueue(bqItem10, a_builder) >> >>> last_stub_mail_count = len(stub.test_emails) >> >> @@ -535,22 +543,22 @@ >> the build record to FULLYBUILT, as the process-upload would do: >> >> >>> from canonical.launchpad.interfaces import BuildStatus >> - >>> bqItem10.build.buildstate = BuildStatus.FULLYBUILT >> + >>> build.buildstate = BuildStatus.FULLYBUILT >> >> Now the updateBuild should recognize this build record as a >> Successfully built and uploaded procedure, not sending any >> notification and updating the build information: >> >> >>> buildergroup.updateBuild(bqItem10) >> - >>> bqItem10.build.builder is not None >> - True >> - >>> bqItem10.build.datebuilt is not None >> - True >> - >>> bqItem10.build.buildduration is not None >> - True >> - >>> bqItem10.build.buildlog is not None >> - True >> - >>> bqItem10.build.buildstate.title >> + >>> build.builder is not None >> + True >> + >>> build.datebuilt is not None >> + True >> + >>> build.buildduration is not None >> + True >> + >>> build.buildlog is not None >> + True >> + >>> build.buildstate.title >> 'Successfully built' >> >>> check_mail_sent(last_stub_mail_count) >> False >> @@ -558,7 +566,7 @@ >> We do not store any build log information when the binary upload >> processing succeeded. >> >> - >>> bqItem10.build.upload_log is None >> + >>> build.upload_log is None >> True >> >> Cleanup in preparation for the next test: >> @@ -585,13 +593,14 @@ >> >> >>> bqItem11.builder is None >> True >> - >>> bqItem11.buildstart is None >> + >>> bqItem11.job.date_started is None >> True >> >>> bqItem11.lastscore >> 0 >> >>> check_mail_sent(last_stub_mail_count) >> False >> - >>> bqItem11.build.buildstate.title >> + >>> build = getUtility(IBuildSet).getByQueueEntry(bqItem11) >> + >>> build.buildstate.title >> 'Needs building' >> >> Cleanup in preparation for the next test: >> @@ -790,11 +799,11 @@ >> tests. >> >> >>> current_job = a_builder.currentjob >> - >>> resurrect_build = current_job.build >> + >>> resurrect_build = getUtility(IBuildSet).getByQueueEntry(current_job) >> >>> resurrect_build.buildstate = BuildStatus.NEEDSBUILD >> >>> syncUpdate(resurrect_build) >> >>> current_job.builder = None >> - >>> current_job.buildstart = None >> + >>> current_job.setDateStarted(None) >> >>> syncUpdate(current_job) >> >> IBuilder.findCandidate also identifies if there are builds for >> @@ -802,7 +811,8 @@ >> corresponding build record as SUPERSEDED. >> >> >>> old_candidate = a_builder.findBuildCandidate() >> - >>> print old_candidate.build.buildstate.name >> + >>> build = getUtility(IBuildSet).getByQueueEntry(old_candidate) >> + >>> print build.buildstate.name >> NEEDSBUILD >> >> The 'candidate' is constant until we dispatch it. >> @@ -814,7 +824,7 @@ >> Now let's disable the archive of the associated build record and see >> whether the candidate will still be found. >> >> - >>> old_candidate.build.archive.enabled = False >> + >>> build.archive.enabled = False >> >>> new_candidate = a_builder.findBuildCandidate() >> >>> new_candidate is None >> True >> @@ -823,7 +833,7 @@ >> archives are ignored. Now let's re-enable that archive and the build >> candidate will be found again. >> >> - >>> old_candidate.build.archive.enabled = True >> + >>> build.archive.enabled = True >> >>> new_candidate = a_builder.findBuildCandidate() >> >>> new_candidate.id == old_candidate.id >> True >> @@ -836,9 +846,9 @@ >> >>> from canonical.launchpad.interfaces import PackagePublishingStatus >> >>> from canonical.testing.layers import LaunchpadZopelessLayer >> >> - >>> spr = old_candidate.build.sourcepackagerelease >> + >>> spr = build.sourcepackagerelease >> >>> secure_pub = removeSecurityProxy( >> - ... old_candidate).build.current_source_publication.secure_record >> + ... build).current_source_publication.secure_record >> >>> commit() >> >>> LaunchpadZopelessLayer.switchDbUser('launchpad') >> >>> secure_pub.status = PackagePublishingStatus.SUPERSEDED >> @@ -854,7 +864,7 @@ >> Because the 'previous' candidate was marked as superseded, so it's not >> part of the candidates list anymore. >> >> - >>> print old_candidate.build.buildstate.name >> + >>> print build.buildstate.name >> SUPERSEDED >> >> If the candidate is for a private build whose source has not been >> @@ -862,9 +872,10 @@ >> published. We need to tweak the status of the publishing record again >> to demonstrate this, and also make the archive private: >> >> - >>> source = new_candidate.build.sourcepackagerelease >> + >>> build = getUtility(IBuildSet).getByQueueEntry(new_candidate) >> + >>> source = build.sourcepackagerelease >> >>> secure_pub = removeSecurityProxy( >> - ... new_candidate).build.current_source_publication.secure_record >> + ... build).current_source_publication.secure_record >> >>> commit() >> >>> LaunchpadZopelessLayer.switchDbUser('launchpad') >> >>> secure_pub.status = PackagePublishingStatus.PENDING >> @@ -903,22 +914,23 @@ >> >> >>> LaunchpadZopelessLayer.switchDbUser('launchpad') >> >>> secure_pub = removeSecurityProxy( >> - ... new_candidate).build.current_source_publication.secure_record >> + ... build).current_source_publication.secure_record >> >>> secure_pub.status = PackagePublishingStatus.DELETED >> >>> secure_pub = removeSecurityProxy( >> - ... new_candidate).build.current_source_publication.secure_record >> + ... build).current_source_publication.secure_record >> >>> secure_pub.status = PackagePublishingStatus.SUPERSEDED >> >>> commit() >> >>> LaunchpadZopelessLayer.switchDbUser(config.builddmaster.dbuser) >> >> - >>> print current_job.build.buildstate.name >> + >>> build = getUtility(IBuildSet).getByQueueEntry(current_job) >> + >>> print build.buildstate.name >> NEEDSBUILD >> >> >>> another_candidate = a_builder.findBuildCandidate() >> >>> print another_candidate >> None >> >> - >>> print current_job.build.buildstate.name >> + >>> print build.buildstate.name >> SUPERSEDED >> >> We'll reset the archive back to non-private for further tests: >> @@ -950,7 +962,7 @@ >> >>> a_builder.dispatchBuildCandidate(candidate) >> ensurepresent called, url=... >> ensurepresent called, >> - url=http://localhost:58000/3/firefox_0.9.2.orig.tar.gz >> + url=http://localhost:58000/3/firefox-0.9.2.orig.tar.gz > > wgrant recently changed this package name and these tests so that it uses > the _ instead of a - > > I think your change is wrong, we need to work out why this test was failing > without the change you made. > > Same for all the others below too. I did a "make schema" with outdated sample data (before wgrant's change). I have corrected this and all the others. >> OkSlave BUILDING >> Archives: >> deb http://ftpmaster.internal/ubuntu hoary main >> @@ -978,7 +990,7 @@ >> >>> a_builder.dispatchBuildCandidate(candidate) >> ensurepresent called, url=... >> ensurepresent called, >> - url=http://localhost:58000/3/firefox_0.9.2.orig.tar.gz >> + url=http://localhost:58000/3/firefox-0.9.2.orig.tar.gz >> OkSlave BUILDING >> Archives: >> deb http://ftpmaster.internal/ubuntu hoary main >> @@ -1030,7 +1042,7 @@ >> >>> a_builder.dispatchBuildCandidate(candidate) >> ensurepresent called, url=... >> ensurepresent called, >> - url=http://localhost:58000/3/firefox_0.9.2.orig.tar.gz >> + url=http://localhost:58000/3/firefox-0.9.2.orig.tar.gz >> OkSlave BUILDING >> Archives: >> deb http://ftpmaster.internal/ubuntu hoary main restricted universe multiverse >> @@ -1122,7 +1134,7 @@ >> >>> a_builder.dispatchBuildCandidate(candidate) >> ensurepresent called, url=... >> ensurepresent called, >> - url=http://localhost:58000/3/firefox_0.9.2.orig.tar.gz >> + url=http://localhost:58000/3/firefox-0.9.2.orig.tar.gz >> OkSlave BUILDING >> Archives: >> deb http://ftpmaster.internal/ubuntu hoary main restricted universe multiverse >> @@ -1147,7 +1159,8 @@ >> >>> cprov_archive.private = True >> >>> cprov_archive.buildd_secret = "secret" >> >>> cprov_archive.require_virtualized = False >> - >>> for build_file in candidate.files: >> + >>> build = getUtility(IBuildSet).getByQueueEntry(candidate) >> + >>> for build_file in build.sourcepackagerelease.files: >> ... removeSecurityProxy(build_file).libraryfile.restricted = True >> >>> commit() >> >>> LaunchpadZopelessLayer.switchDbUser(test_dbuser) >> @@ -1169,7 +1182,8 @@ >> archive and not the one from the PPA, which on the absence of ancestry >> defaults to 'universe'. >> >> - >>> print candidate.build.current_component.name >> + >>> build = getUtility(IBuildSet).getByQueueEntry(candidate) >> + >>> print build.current_component.name >> main >> >> This is so that the mangling tools will run over the built packages. >> @@ -1177,7 +1191,7 @@ >> >>> a_builder.dispatchBuildCandidate(candidate) >> ensurepresent called, url=... >> ensurepresent called, >> - url=http://private-ppa.launchpad.dev/cprov/ppa/ubuntu/pool/main/m/mozilla-firefox/firefox_0.9.2.orig.tar.gz >> + url=http://private-ppa.launchpad.dev/cprov/ppa/ubuntu/pool/main/m/mozilla-firefox/firefox-0.9.2.orig.tar.gz >> URL authorisation with buildd/secret >> OkSlave BUILDING >> Archives: >> @@ -1196,7 +1210,7 @@ >> We will create an ancestry in the primary archive target to the 'main' >> component and this time the dispatching will follow that component. >> >> - >>> sourcename = candidate.build.sourcepackagerelease.name >> + >>> sourcename = build.sourcepackagerelease.name >> >> >>> LaunchpadZopelessLayer.switchDbUser('launchpad') >> >>> login('