Merge lp:~michael.nelson/launchpad/567922-binarypackagebuild-new-table-2 into lp:launchpad/db-devel
- 567922-binarypackagebuild-new-table-2
- Merge into db-devel
Status: | Merged | ||||
---|---|---|---|---|---|
Approved by: | Michael Nelson | ||||
Approved revision: | no longer in the source branch. | ||||
Merged at revision: | 9405 | ||||
Proposed branch: | lp:~michael.nelson/launchpad/567922-binarypackagebuild-new-table-2 | ||||
Merge into: | lp:launchpad/db-devel | ||||
Prerequisite: | lp:~michael.nelson/launchpad/567922-binarypackagebuild-new-table-1 | ||||
Diff against target: |
756 lines (+188/-86) (has conflicts) 17 files modified
lib/lp/buildmaster/interfaces/buildbase.py (+7/-1) lib/lp/buildmaster/interfaces/packagebuild.py (+7/-0) lib/lp/buildmaster/model/buildbase.py (+6/-5) lib/lp/buildmaster/model/buildfarmjob.py (+1/-1) lib/lp/buildmaster/model/packagebuild.py (+11/-4) lib/lp/code/model/sourcepackagerecipe.py (+1/-1) lib/lp/code/tests/test_sourcepackagerecipebuild.py (+1/-1) lib/lp/soyuz/interfaces/binarypackagebuild.py (+2/-1) lib/lp/soyuz/model/binarypackagebuild.py (+48/-29) lib/lp/soyuz/model/buildfarmbuildjob.py (+50/-0) lib/lp/soyuz/model/buildpackagejob.py (+7/-7) lib/lp/soyuz/model/publishing.py (+1/-1) lib/lp/soyuz/model/sourcepackagerelease.py (+15/-8) lib/lp/soyuz/tests/test_binarypackagebuild.py (+11/-9) lib/lp/soyuz/tests/test_hasbuildrecords.py (+3/-1) lib/lp/soyuz/tests/test_publishing.py (+14/-14) lib/lp/soyuz/tests/test_publishing_models.py (+3/-3) Text conflict in lib/lp/buildmaster/interfaces/buildbase.py Text conflict in lib/lp/buildmaster/model/buildbase.py Text conflict in lib/lp/buildmaster/tests/test_buildbase.py |
||||
To merge this branch: | bzr merge lp:~michael.nelson/launchpad/567922-binarypackagebuild-new-table-2 | ||||
Related bugs: |
|
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Brad Crittenden (community) | code | Approve | |
Review via email: mp+24688@code.launchpad.net |
Commit message
Description of the change
This branch is part of a pipeline for
https:/
https:/
Overview
========
This branch continues the work to switch our BinaryPackageBuild class to the new binarypackagebuild table (using the delegated PackageBuild/
Details
=======
Renames test_build to test_binarypack
This branch is dependent on the pending schema patch in a previous branch.
To test
=======
First update the test db schema (required as the db patch still needs to be updated to remove the old build table):
psql launchpad_
bin/py database/
And then:
bin/test -vv -m test_binarypack
The next branch will continue to update the BinaryPackageBuild implementation to get the rest of the tests working.
Michael Nelson (michael.nelson) wrote : | # |
Brad Crittenden (bac) wrote : | # |
Hi Michael,
Man I know you're going to be happy to get these changes all wrapped
up. Thanks for doing a very tedious series of branches.
I'm glad to see soyuzvariablenames expanded. thank_you.
--bac
> === modified file 'lib/lp/
> --- lib/lp/
> +++ lib/lp/
> @@ -151,6 +151,13 @@
> :param slave_status: A dict as returned by IBuilder.
> """
>
> + def queueBuild(
> + """Create a BuildQueue entry for this build.
> +
> + :param suspended: Whether the associated `Job` instance should be
> + created in a suspended state.
> + """
So interface method specifications leave off the 'self' argument but
as a staticmethod there is no self, so the first argument 'build' is
dropped? That's no good.
>
> class IPackageBuildSo
> """A utility of this interface used to create _things_."""
> === modified file 'lib/lp/
> --- lib/lp/
> +++ lib/lp/
> @@ -189,7 +189,7 @@
> def __init__(self, job_type, status=
> processor=None, virtualized=None):
> super(BuildFarmJob, self).__init__()
> - self.job_type, self.status, self.process, self.virtualized = (
> + self.job_type, self.status, self.processor, self.virtualized = (
> job_type,
> status,
> processor,
> === modified file 'lib/lp/
> --- lib/lp/
> +++ lib/lp/
> @@ -778,7 +791,7 @@
>
> # This code MUST match the logic in the Build security adapter,
> # otherwise users are likely to get 403 errors, or worse.
If it MUST match then perhaps it should be refactored and shared?
(Not a requirement for this branch.)
> === renamed file 'lib/lp/
> --- lib/lp/
> +++ lib/lp/
> @@ -7,6 +7,7 @@
>
> from storm.store import Store
> from zope.component import getUtility
> +from zope.security.proxy import removeSecurityProxy
>
> from canonical.
> from canonical.testing import LaunchpadZopele
> @@ -81,7 +82,7 @@
>
> [depwait_build] = depwait_
> depwait_
> - depwait_
> + depwait_
Why did you need to convert these strings to unicode?
Michael Nelson (michael.nelson) wrote : | # |
On Tue, May 4, 2010 at 7:52 PM, Brad Crittenden <email address hidden> wrote:
> Review: Approve code
> Hi Michael,
>
> Man I know you're going to be happy to get these changes all wrapped
> up. Thanks for doing a very tedious series of branches.
>
> I'm glad to see soyuzvariablenames expanded. thank_you.
>
> --bac
Thanks for the review bac, a few comments below.
>
>
>> === modified file 'lib/lp/
>> --- lib/lp/
>> +++ lib/lp/
>> @@ -151,6 +151,13 @@
>> :param slave_status: A dict as returned by IBuilder.
>> """
>>
>> + def queueBuild(
>> + """Create a BuildQueue entry for this build.
>> +
>> + :param suspended: Whether the associated `Job` instance should be
>> + created in a suspended state.
>> + """
>
> So interface method specifications leave off the 'self' argument but
> as a staticmethod there is no self, so the first argument 'build' is
> dropped? That's no good.
It's not a static method on PackageBuild... the
PackageBuild.
a static method (so the implementation can be shared in the transition
by old BuildBase-based classes and the new PackageBuild classes).
Let me know if that was obvious to you and there is still something
you'd like to see changed?
>
>>
>> class IPackageBuildSo
>> """A utility of this interface used to create _things_."""
>
>> === modified file 'lib/lp/
>> --- lib/lp/
>> +++ lib/lp/
>> @@ -189,7 +189,7 @@
>> def __init__(self, job_type, status=
>> processor=None, virtualized=None):
>> super(BuildFarmJob, self).__init__()
>> - self.job_type, self.status, self.process, self.virtualized = (
>> + self.job_type, self.status, self.processor, self.virtualized = (
>> job_type,
>> status,
>> processor,
>
>> === modified file 'lib/lp/
>> --- lib/lp/
>> +++ lib/lp/
>
>> @@ -778,7 +791,7 @@
>>
>> # This code MUST match the logic in the Build security adapter,
>> # otherwise users are likely to get 403 errors, or worse.
>
> If it MUST match then perhaps it should be refactored and shared?
> (Not a requirement for this branch.)
Yeah, I thought the same thing when I moved that comment.
>
>> === renamed file 'lib/lp/
>> --- lib/lp/
>> +++ lib/lp/
>> @@ -7,6 +7,7 @@
>>
>> from storm.store import Store
>> from zope.component import getUtility
>> +from zope.security.proxy import r...
Preview Diff
1 | === modified file 'lib/lp/buildmaster/interfaces/buildbase.py' | |||
2 | --- lib/lp/buildmaster/interfaces/buildbase.py 2010-05-05 15:51:54 +0000 | |||
3 | +++ lib/lp/buildmaster/interfaces/buildbase.py 2010-05-05 15:51:57 +0000 | |||
4 | @@ -20,6 +20,7 @@ | |||
5 | 20 | from lazr.restful.fields import Reference | 20 | from lazr.restful.fields import Reference |
6 | 21 | 21 | ||
7 | 22 | from lp.buildmaster.interfaces.builder import IBuilder | 22 | from lp.buildmaster.interfaces.builder import IBuilder |
8 | 23 | from lp.buildmaster.interfaces.buildfarmjob import BuildFarmJobType | ||
9 | 23 | from lp.buildmaster.interfaces.buildqueue import IBuildQueue | 24 | from lp.buildmaster.interfaces.buildqueue import IBuildQueue |
10 | 24 | from lp.registry.interfaces.distribution import IDistribution | 25 | from lp.registry.interfaces.distribution import IDistribution |
11 | 25 | from lp.registry.interfaces.pocket import PackagePublishingPocket | 26 | from lp.registry.interfaces.pocket import PackagePublishingPocket |
12 | @@ -117,6 +118,11 @@ | |||
13 | 117 | # can be removed once all *Build classes inherit from | 118 | # can be removed once all *Build classes inherit from |
14 | 118 | # IBuildFarmJob/IPackageBuild. | 119 | # IBuildFarmJob/IPackageBuild. |
15 | 119 | 120 | ||
16 | 121 | build_farm_job_type = Choice( | ||
17 | 122 | title=_("Job type"), required=True, readonly=True, | ||
18 | 123 | vocabulary=BuildFarmJobType, | ||
19 | 124 | description=_("The specific type of job.")) | ||
20 | 125 | |||
21 | 120 | # XXX: wgrant 2010-01-20 bug=507712: Most of these attribute names | 126 | # XXX: wgrant 2010-01-20 bug=507712: Most of these attribute names |
22 | 121 | # are bad. | 127 | # are bad. |
23 | 122 | datecreated = exported( | 128 | datecreated = exported( |
24 | @@ -241,7 +247,7 @@ | |||
25 | 241 | Invoke getFileFromSlave method with 'buildlog' identifier. | 247 | Invoke getFileFromSlave method with 'buildlog' identifier. |
26 | 242 | """ | 248 | """ |
27 | 243 | 249 | ||
29 | 244 | def queueBuild(suspended=False): | 250 | def queueBuild(build, suspended=False): |
30 | 245 | """Create a BuildQueue entry for this build. | 251 | """Create a BuildQueue entry for this build. |
31 | 246 | 252 | ||
32 | 247 | :param suspended: Whether the associated `Job` instance should be | 253 | :param suspended: Whether the associated `Job` instance should be |
33 | 248 | 254 | ||
34 | === modified file 'lib/lp/buildmaster/interfaces/packagebuild.py' | |||
35 | --- lib/lp/buildmaster/interfaces/packagebuild.py 2010-05-05 15:51:54 +0000 | |||
36 | +++ lib/lp/buildmaster/interfaces/packagebuild.py 2010-05-05 15:51:57 +0000 | |||
37 | @@ -151,6 +151,13 @@ | |||
38 | 151 | :param slave_status: A dict as returned by IBuilder.slaveStatus | 151 | :param slave_status: A dict as returned by IBuilder.slaveStatus |
39 | 152 | """ | 152 | """ |
40 | 153 | 153 | ||
41 | 154 | def queueBuild(suspended=False): | ||
42 | 155 | """Create a BuildQueue entry for this build. | ||
43 | 156 | |||
44 | 157 | :param suspended: Whether the associated `Job` instance should be | ||
45 | 158 | created in a suspended state. | ||
46 | 159 | """ | ||
47 | 160 | |||
48 | 154 | 161 | ||
49 | 155 | class IPackageBuildSource(Interface): | 162 | class IPackageBuildSource(Interface): |
50 | 156 | """A utility of this interface used to create _things_.""" | 163 | """A utility of this interface used to create _things_.""" |
51 | 157 | 164 | ||
52 | === modified file 'lib/lp/buildmaster/model/buildbase.py' | |||
53 | --- lib/lp/buildmaster/model/buildbase.py 2010-05-05 15:51:54 +0000 | |||
54 | +++ lib/lp/buildmaster/model/buildbase.py 2010-05-05 15:51:57 +0000 | |||
55 | @@ -495,20 +495,21 @@ | |||
56 | 495 | library_file = self.createUploadLog(self, content) | 495 | library_file = self.createUploadLog(self, content) |
57 | 496 | self.upload_log = library_file | 496 | self.upload_log = library_file |
58 | 497 | 497 | ||
60 | 498 | def queueBuild(self, suspended=False): | 498 | @staticmethod |
61 | 499 | def queueBuild(build, suspended=False): | ||
62 | 499 | """See `IBuildBase`""" | 500 | """See `IBuildBase`""" |
64 | 500 | specific_job = self.makeJob() | 501 | specific_job = build.makeJob() |
65 | 501 | 502 | ||
66 | 502 | # This build queue job is to be created in a suspended state. | 503 | # This build queue job is to be created in a suspended state. |
67 | 503 | if suspended: | 504 | if suspended: |
68 | 504 | specific_job.job.suspend() | 505 | specific_job.job.suspend() |
69 | 505 | 506 | ||
71 | 506 | duration_estimate = self.estimateDuration() | 507 | duration_estimate = build.estimateDuration() |
72 | 507 | queue_entry = BuildQueue( | 508 | queue_entry = BuildQueue( |
73 | 508 | estimated_duration=duration_estimate, | 509 | estimated_duration=duration_estimate, |
75 | 509 | job_type=self.build_farm_job_type, | 510 | job_type=build.build_farm_job_type, |
76 | 510 | job=specific_job.job, processor=specific_job.processor, | 511 | job=specific_job.job, processor=specific_job.processor, |
77 | 511 | virtualized=specific_job.virtualized) | 512 | virtualized=specific_job.virtualized) |
79 | 512 | Store.of(self).add(queue_entry) | 513 | Store.of(build).add(queue_entry) |
80 | 513 | return queue_entry | 514 | return queue_entry |
81 | 514 | 515 | ||
82 | 515 | 516 | ||
83 | === modified file 'lib/lp/buildmaster/model/buildfarmjob.py' | |||
84 | --- lib/lp/buildmaster/model/buildfarmjob.py 2010-05-05 15:51:54 +0000 | |||
85 | +++ lib/lp/buildmaster/model/buildfarmjob.py 2010-05-05 15:51:57 +0000 | |||
86 | @@ -189,7 +189,7 @@ | |||
87 | 189 | def __init__(self, job_type, status=BuildStatus.NEEDSBUILD, | 189 | def __init__(self, job_type, status=BuildStatus.NEEDSBUILD, |
88 | 190 | processor=None, virtualized=None): | 190 | processor=None, virtualized=None): |
89 | 191 | super(BuildFarmJob, self).__init__() | 191 | super(BuildFarmJob, self).__init__() |
91 | 192 | self.job_type, self.status, self.process, self.virtualized = ( | 192 | self.job_type, self.status, self.processor, self.virtualized = ( |
92 | 193 | job_type, | 193 | job_type, |
93 | 194 | status, | 194 | status, |
94 | 195 | processor, | 195 | processor, |
95 | 196 | 196 | ||
96 | === modified file 'lib/lp/buildmaster/model/packagebuild.py' | |||
97 | --- lib/lp/buildmaster/model/packagebuild.py 2010-05-05 15:51:54 +0000 | |||
98 | +++ lib/lp/buildmaster/model/packagebuild.py 2010-05-05 15:51:57 +0000 | |||
99 | @@ -122,9 +122,10 @@ | |||
100 | 122 | return BuildBase.getUploaderCommand( | 122 | return BuildBase.getUploaderCommand( |
101 | 123 | package_build, distro_series, upload_leaf, upload_logfilename) | 123 | package_build, distro_series, upload_leaf, upload_logfilename) |
102 | 124 | 124 | ||
104 | 125 | def getLogFromSlave(self): | 125 | @staticmethod |
105 | 126 | def getLogFromSlave(package_build): | ||
106 | 126 | """See `IPackageBuild`.""" | 127 | """See `IPackageBuild`.""" |
108 | 127 | return BuildBase.getLogFromSlave(self) | 128 | return BuildBase.getLogFromSlave(package_build) |
109 | 128 | 129 | ||
110 | 129 | @staticmethod | 130 | @staticmethod |
111 | 130 | def getUploadLogContent(root, leaf): | 131 | def getUploadLogContent(root, leaf): |
112 | @@ -135,9 +136,11 @@ | |||
113 | 135 | """See `IPackageBuild`.""" | 136 | """See `IPackageBuild`.""" |
114 | 136 | raise NotImplementedError | 137 | raise NotImplementedError |
115 | 137 | 138 | ||
117 | 138 | def storeBuildInfo(self, librarian, slave_status): | 139 | @staticmethod |
118 | 140 | def storeBuildInfo(package_build, librarian, slave_status): | ||
119 | 139 | """See `IPackageBuild`.""" | 141 | """See `IPackageBuild`.""" |
121 | 140 | return BuildBase.storeBuildInfo(self, librarian, slave_status) | 142 | return BuildBase.storeBuildInfo(package_build, librarian, |
122 | 143 | slave_status) | ||
123 | 141 | 144 | ||
124 | 142 | def verifySuccessfulUpload(self): | 145 | def verifySuccessfulUpload(self): |
125 | 143 | """See `IPackageBuild`.""" | 146 | """See `IPackageBuild`.""" |
126 | @@ -167,6 +170,10 @@ | |||
127 | 167 | """ | 170 | """ |
128 | 168 | delegates(IPackageBuild, context="package_build") | 171 | delegates(IPackageBuild, context="package_build") |
129 | 169 | 172 | ||
130 | 173 | def queueBuild(self, suspended=False): | ||
131 | 174 | """See `IPackageBuild`.""" | ||
132 | 175 | return BuildBase.queueBuild(self, suspended=False) | ||
133 | 176 | |||
134 | 170 | def handleStatus(self, status, librarian, slave_status): | 177 | def handleStatus(self, status, librarian, slave_status): |
135 | 171 | """See `IPackageBuild`.""" | 178 | """See `IPackageBuild`.""" |
136 | 172 | return BuildBase.handleStatus(self, status, librarian, slave_status) | 179 | return BuildBase.handleStatus(self, status, librarian, slave_status) |
137 | 173 | 180 | ||
138 | === modified file 'lib/lp/code/model/sourcepackagerecipe.py' | |||
139 | --- lib/lp/code/model/sourcepackagerecipe.py 2010-04-30 12:33:16 +0000 | |||
140 | +++ lib/lp/code/model/sourcepackagerecipe.py 2010-05-05 15:51:57 +0000 | |||
141 | @@ -163,7 +163,7 @@ | |||
142 | 163 | self.sourcepackagename) | 163 | self.sourcepackagename) |
143 | 164 | build = getUtility(ISourcePackageRecipeBuildSource).new(sourcepackage, | 164 | build = getUtility(ISourcePackageRecipeBuildSource).new(sourcepackage, |
144 | 165 | self, requester, archive) | 165 | self, requester, archive) |
146 | 166 | build.queueBuild() | 166 | build.queueBuild(build) |
147 | 167 | return build | 167 | return build |
148 | 168 | 168 | ||
149 | 169 | def getBuilds(self, pending=False): | 169 | def getBuilds(self, pending=False): |
150 | 170 | 170 | ||
151 | === modified file 'lib/lp/code/tests/test_sourcepackagerecipebuild.py' | |||
152 | --- lib/lp/code/tests/test_sourcepackagerecipebuild.py 2010-04-20 05:07:52 +0000 | |||
153 | +++ lib/lp/code/tests/test_sourcepackagerecipebuild.py 2010-05-05 15:51:57 +0000 | |||
154 | @@ -58,7 +58,7 @@ | |||
155 | 58 | 58 | ||
156 | 59 | def test_queueBuild(self): | 59 | def test_queueBuild(self): |
157 | 60 | spb = self.makeSourcePackageRecipeBuild() | 60 | spb = self.makeSourcePackageRecipeBuild() |
159 | 61 | bq = spb.queueBuild() | 61 | bq = spb.queueBuild(spb) |
160 | 62 | self.assertProvides(bq, IBuildQueue) | 62 | self.assertProvides(bq, IBuildQueue) |
161 | 63 | self.assertProvides(bq.specific_job, ISourcePackageRecipeBuildJob) | 63 | self.assertProvides(bq.specific_job, ISourcePackageRecipeBuildJob) |
162 | 64 | self.assertEqual(True, bq.virtualized) | 64 | self.assertEqual(True, bq.virtualized) |
163 | 65 | 65 | ||
164 | === modified file 'lib/lp/soyuz/interfaces/binarypackagebuild.py' | |||
165 | --- lib/lp/soyuz/interfaces/binarypackagebuild.py 2010-05-05 15:51:54 +0000 | |||
166 | +++ lib/lp/soyuz/interfaces/binarypackagebuild.py 2010-05-05 15:51:57 +0000 | |||
167 | @@ -21,7 +21,8 @@ | |||
168 | 21 | 21 | ||
169 | 22 | from canonical.launchpad import _ | 22 | from canonical.launchpad import _ |
170 | 23 | from lp.buildmaster.interfaces.buildbase import BuildStatus | 23 | from lp.buildmaster.interfaces.buildbase import BuildStatus |
172 | 24 | from lp.buildmaster.interfaces.packagebuild import IPackageBuild | 24 | from lp.buildmaster.interfaces.packagebuild import ( |
173 | 25 | IPackageBuild) | ||
174 | 25 | from lp.soyuz.interfaces.processor import IProcessor | 26 | from lp.soyuz.interfaces.processor import IProcessor |
175 | 26 | from lp.soyuz.interfaces.publishing import ( | 27 | from lp.soyuz.interfaces.publishing import ( |
176 | 27 | ISourcePackagePublishingHistory) | 28 | ISourcePackagePublishingHistory) |
177 | 28 | 29 | ||
178 | === modified file 'lib/lp/soyuz/model/binarypackagebuild.py' | |||
179 | --- lib/lp/soyuz/model/binarypackagebuild.py 2010-05-05 15:51:54 +0000 | |||
180 | +++ lib/lp/soyuz/model/binarypackagebuild.py 2010-05-05 15:51:57 +0000 | |||
181 | @@ -45,9 +45,11 @@ | |||
182 | 45 | from lp.buildmaster.interfaces.buildbase import BuildStatus | 45 | from lp.buildmaster.interfaces.buildbase import BuildStatus |
183 | 46 | from lp.buildmaster.interfaces.buildfarmjob import BuildFarmJobType | 46 | from lp.buildmaster.interfaces.buildfarmjob import BuildFarmJobType |
184 | 47 | from lp.buildmaster.interfaces.packagebuild import ( | 47 | from lp.buildmaster.interfaces.packagebuild import ( |
186 | 48 | IPackageBuild, IPackageBuildSource) | 48 | IPackageBuildSource) |
187 | 49 | from lp.buildmaster.model.buildfarmjob import BuildFarmJob | ||
188 | 49 | from lp.buildmaster.model.buildqueue import BuildQueue | 50 | from lp.buildmaster.model.buildqueue import BuildQueue |
190 | 50 | from lp.buildmaster.model.packagebuild import PackageBuildDerived | 51 | from lp.buildmaster.model.packagebuild import ( |
191 | 52 | PackageBuild, PackageBuildDerived) | ||
192 | 51 | from lp.services.job.model.job import Job | 53 | from lp.services.job.model.job import Job |
193 | 52 | from lp.soyuz.adapters.archivedependencies import get_components_for_building | 54 | from lp.soyuz.adapters.archivedependencies import get_components_for_building |
194 | 53 | from lp.soyuz.interfaces.archive import ArchivePurpose | 55 | from lp.soyuz.interfaces.archive import ArchivePurpose |
195 | @@ -66,7 +68,6 @@ | |||
196 | 66 | 68 | ||
197 | 67 | class BinaryPackageBuild(PackageBuildDerived, SQLBase): | 69 | class BinaryPackageBuild(PackageBuildDerived, SQLBase): |
198 | 68 | implements(IBinaryPackageBuild) | 70 | implements(IBinaryPackageBuild) |
199 | 69 | delegates(IPackageBuild, context="package_build") | ||
200 | 70 | _table = 'BinaryPackageBuild' | 71 | _table = 'BinaryPackageBuild' |
201 | 71 | _defaultOrder = 'id' | 72 | _defaultOrder = 'id' |
202 | 72 | 73 | ||
203 | @@ -355,7 +356,7 @@ | |||
204 | 355 | name, version, relation = self._parseDependencyToken(token) | 356 | name, version, relation = self._parseDependencyToken(token) |
205 | 356 | 357 | ||
206 | 357 | dep_candidate = self.archive.findDepCandidateByName( | 358 | dep_candidate = self.archive.findDepCandidateByName( |
208 | 358 | self.distroarchseries, name) | 359 | self.distro_arch_series, name) |
209 | 359 | 360 | ||
210 | 360 | if not dep_candidate: | 361 | if not dep_candidate: |
211 | 361 | return False | 362 | return False |
212 | @@ -404,7 +405,7 @@ | |||
213 | 404 | if not self._isDependencySatisfied(token)] | 405 | if not self._isDependencySatisfied(token)] |
214 | 405 | 406 | ||
215 | 406 | # Update dependencies line | 407 | # Update dependencies line |
217 | 407 | self.dependencies = ", ".join(remaining_deps) | 408 | self.dependencies = u", ".join(remaining_deps) |
218 | 408 | 409 | ||
219 | 409 | def __getitem__(self, name): | 410 | def __getitem__(self, name): |
220 | 410 | return self.getBinaryPackageRelease(name) | 411 | return self.getBinaryPackageRelease(name) |
221 | @@ -447,30 +448,35 @@ | |||
222 | 447 | # and get the (successfully built) build records for this | 448 | # and get the (successfully built) build records for this |
223 | 448 | # package. | 449 | # package. |
224 | 449 | completed_builds = BinaryPackageBuild.select(""" | 450 | completed_builds = BinaryPackageBuild.select(""" |
228 | 450 | Build.sourcepackagerelease = SourcePackageRelease.id AND | 451 | BinaryPackageBuild.source_package_release = SourcePackageRelease.id AND |
229 | 451 | Build.id != %s AND | 452 | BinaryPackageBuild.id != %s AND |
230 | 452 | Build.buildduration IS NOT NULL AND | 453 | BinaryPackageBuild.distro_arch_series = %s AND |
231 | 453 | SourcePackageRelease.sourcepackagename = SourcePackageName.id AND | 454 | SourcePackageRelease.sourcepackagename = SourcePackageName.id AND |
232 | 454 | SourcePackageName.name = %s AND | 455 | SourcePackageName.name = %s AND |
238 | 455 | distroarchseries = %s AND | 456 | BinaryPackageBuild.package_build = PackageBuild.id AND |
239 | 456 | archive IN %s AND | 457 | PackageBuild.archive IN %s AND |
240 | 457 | buildstate = %s | 458 | PackageBuild.build_farm_job = BuildFarmJob.id AND |
241 | 458 | """ % sqlvalues(self, self.sourcepackagerelease.name, | 459 | BuildFarmJob.date_finished IS NOT NULL AND |
242 | 459 | self.distroarchseries, archives, | 460 | BuildFarmJob.status = %s |
243 | 461 | """ % sqlvalues(self, self.distro_arch_series, | ||
244 | 462 | self.source_package_release.name, archives, | ||
245 | 460 | BuildStatus.FULLYBUILT), | 463 | BuildStatus.FULLYBUILT), |
248 | 461 | orderBy=['-datebuilt', '-id'], | 464 | orderBy=['-BuildFarmJob.date_finished', '-id'], |
249 | 462 | clauseTables=['SourcePackageName', 'SourcePackageRelease']) | 465 | clauseTables=['PackageBuild', 'BuildFarmJob', 'SourcePackageName', |
250 | 466 | 'SourcePackageRelease']) | ||
251 | 463 | 467 | ||
252 | 464 | if completed_builds.count() > 0: | 468 | if completed_builds.count() > 0: |
253 | 465 | # Historic build data exists, use the most recent value. | 469 | # Historic build data exists, use the most recent value. |
254 | 466 | most_recent_build = completed_builds[0] | 470 | most_recent_build = completed_builds[0] |
256 | 467 | estimated_duration = most_recent_build.buildduration | 471 | date_finished = most_recent_build.date_finished |
257 | 472 | date_started = most_recent_build.date_started | ||
258 | 473 | estimated_duration = date_finished - date_started | ||
259 | 468 | else: | 474 | else: |
260 | 469 | # Estimate the build duration based on package size if no | 475 | # Estimate the build duration based on package size if no |
261 | 470 | # historic build data exists. | 476 | # historic build data exists. |
262 | 471 | 477 | ||
263 | 472 | # Get the package size in KB. | 478 | # Get the package size in KB. |
265 | 473 | package_size = self.sourcepackagerelease.getPackageSize() | 479 | package_size = self.source_package_release.getPackageSize() |
266 | 474 | 480 | ||
267 | 475 | if package_size > 0: | 481 | if package_size > 0: |
268 | 476 | # Analysis of previous build data shows that a build rate | 482 | # Analysis of previous build data shows that a build rate |
269 | @@ -739,19 +745,25 @@ | |||
270 | 739 | query clause if present. | 745 | query clause if present. |
271 | 740 | """ | 746 | """ |
272 | 741 | 747 | ||
273 | 748 | # Ensure the underlying buildfarmjob and package build tables | ||
274 | 749 | # are included. | ||
275 | 750 | queries.append('BinaryPackageBuild.package_build = PackageBuild.id') | ||
276 | 751 | queries.append('PackageBuild.build_farm_job = BuildFarmJob.id') | ||
277 | 752 | tables.extend(['PackageBuild', 'BuildFarmJob']) | ||
278 | 753 | |||
279 | 742 | # Add query clause that filters on build state if the latter is | 754 | # Add query clause that filters on build state if the latter is |
280 | 743 | # provided. | 755 | # provided. |
281 | 744 | if status is not None: | 756 | if status is not None: |
283 | 745 | queries.append('Build.buildstate=%s' % sqlvalues(status)) | 757 | queries.append('BuildFarmJob.status=%s' % sqlvalues(status)) |
284 | 746 | 758 | ||
285 | 747 | # Add query clause that filters on pocket if the latter is provided. | 759 | # Add query clause that filters on pocket if the latter is provided. |
286 | 748 | if pocket: | 760 | if pocket: |
288 | 749 | queries.append('Build.pocket=%s' % sqlvalues(pocket)) | 761 | queries.append('PackageBuild.pocket=%s' % sqlvalues(pocket)) |
289 | 750 | 762 | ||
290 | 751 | # Add query clause that filters on architecture tag if provided. | 763 | # Add query clause that filters on architecture tag if provided. |
291 | 752 | if arch_tag is not None: | 764 | if arch_tag is not None: |
292 | 753 | queries.append(''' | 765 | queries.append(''' |
294 | 754 | Build.distroarchseries = DistroArchSeries.id AND | 766 | BinaryPackageBuild.distro_arch_series = DistroArchSeries.id AND |
295 | 755 | DistroArchSeries.architecturetag = %s | 767 | DistroArchSeries.architecturetag = %s |
296 | 756 | ''' % sqlvalues(arch_tag)) | 768 | ''' % sqlvalues(arch_tag)) |
297 | 757 | tables.extend(['DistroArchSeries']) | 769 | tables.extend(['DistroArchSeries']) |
298 | @@ -760,7 +772,8 @@ | |||
299 | 760 | # latter is provided. | 772 | # latter is provided. |
300 | 761 | if name is not None: | 773 | if name is not None: |
301 | 762 | queries.append(''' | 774 | queries.append(''' |
303 | 763 | Build.sourcepackagerelease = SourcePackageRelease.id AND | 775 | BinaryPackageBuild.source_package_release = |
304 | 776 | SourcePackageRelease.id AND | ||
305 | 764 | SourcePackageRelease.sourcepackagename = SourcePackageName.id | 777 | SourcePackageRelease.sourcepackagename = SourcePackageName.id |
306 | 765 | AND SourcepackageName.name LIKE '%%' || %s || '%%' | 778 | AND SourcepackageName.name LIKE '%%' || %s || '%%' |
307 | 766 | ''' % quote_like(name)) | 779 | ''' % quote_like(name)) |
308 | @@ -778,7 +791,7 @@ | |||
309 | 778 | 791 | ||
310 | 779 | # This code MUST match the logic in the Build security adapter, | 792 | # This code MUST match the logic in the Build security adapter, |
311 | 780 | # otherwise users are likely to get 403 errors, or worse. | 793 | # otherwise users are likely to get 403 errors, or worse. |
313 | 781 | queries.append("Archive.id = Build.archive") | 794 | queries.append("Archive.id = PackageBuild.archive") |
314 | 782 | clauseTables.append('Archive') | 795 | clauseTables.append('Archive') |
315 | 783 | if user is not None: | 796 | if user is not None: |
316 | 784 | if not user.inTeam(getUtility(ILaunchpadCelebrities).admin): | 797 | if not user.inTeam(getUtility(ILaunchpadCelebrities).admin): |
317 | @@ -796,7 +809,7 @@ | |||
318 | 796 | 809 | ||
319 | 797 | return BinaryPackageBuild.select( | 810 | return BinaryPackageBuild.select( |
320 | 798 | " AND ".join(queries), clauseTables=clauseTables, | 811 | " AND ".join(queries), clauseTables=clauseTables, |
322 | 799 | orderBy=["-Build.datebuilt", "id"]) | 812 | orderBy=["-BuildFarmJob.date_finished", "id"]) |
323 | 800 | 813 | ||
324 | 801 | def getBuildsForArchive(self, archive, status=None, name=None, | 814 | def getBuildsForArchive(self, archive, status=None, name=None, |
325 | 802 | pocket=None, arch_tag=None): | 815 | pocket=None, arch_tag=None): |
326 | @@ -812,9 +825,9 @@ | |||
327 | 812 | # * FULLYBUILT & FAILURES by -datebuilt | 825 | # * FULLYBUILT & FAILURES by -datebuilt |
328 | 813 | # It should present the builds in a more natural order. | 826 | # It should present the builds in a more natural order. |
329 | 814 | if status == BuildStatus.SUPERSEDED or status is None: | 827 | if status == BuildStatus.SUPERSEDED or status is None: |
331 | 815 | orderBy = ["-Build.datecreated"] | 828 | orderBy = ["-BuildFarmJob.date_created"] |
332 | 816 | else: | 829 | else: |
334 | 817 | orderBy = ["-Build.datebuilt"] | 830 | orderBy = ["-BuildFarmJob.date_finished"] |
335 | 818 | # All orders fallback to id if the primary order doesn't succeed | 831 | # All orders fallback to id if the primary order doesn't succeed |
336 | 819 | orderBy.append("id") | 832 | orderBy.append("id") |
337 | 820 | 833 | ||
338 | @@ -1021,24 +1034,30 @@ | |||
339 | 1021 | origin = ( | 1034 | origin = ( |
340 | 1022 | BinaryPackageBuild, | 1035 | BinaryPackageBuild, |
341 | 1023 | LeftJoin( | 1036 | LeftJoin( |
342 | 1037 | PackageBuild, | ||
343 | 1038 | BinaryPackageBuild.package_build == PackageBuild.id), | ||
344 | 1039 | LeftJoin( | ||
345 | 1040 | BuildFarmJob, | ||
346 | 1041 | PackageBuild.build_farm_job == BuildFarmJob.id), | ||
347 | 1042 | LeftJoin( | ||
348 | 1024 | SourcePackageRelease, | 1043 | SourcePackageRelease, |
349 | 1025 | (SourcePackageRelease.id == | 1044 | (SourcePackageRelease.id == |
351 | 1026 | BinaryPackageBuild.sourcepackagereleaseID)), | 1045 | BinaryPackageBuild.source_package_releaseID)), |
352 | 1027 | LeftJoin( | 1046 | LeftJoin( |
353 | 1028 | SourcePackageName, | 1047 | SourcePackageName, |
354 | 1029 | SourcePackageName.id | 1048 | SourcePackageName.id |
355 | 1030 | == SourcePackageRelease.sourcepackagenameID), | 1049 | == SourcePackageRelease.sourcepackagenameID), |
356 | 1031 | LeftJoin(LibraryFileAlias, | 1050 | LeftJoin(LibraryFileAlias, |
358 | 1032 | LibraryFileAlias.id == BinaryPackageBuild.buildlogID), | 1051 | LibraryFileAlias.id == BuildFarmJob.log_id), |
359 | 1033 | LeftJoin(LibraryFileContent, | 1052 | LeftJoin(LibraryFileContent, |
360 | 1034 | LibraryFileContent.id == LibraryFileAlias.contentID), | 1053 | LibraryFileContent.id == LibraryFileAlias.contentID), |
361 | 1035 | LeftJoin( | 1054 | LeftJoin( |
362 | 1036 | Builder, | 1055 | Builder, |
364 | 1037 | Builder.id == BinaryPackageBuild.builderID), | 1056 | Builder.id == BuildFarmJob.builder_id), |
365 | 1038 | ) | 1057 | ) |
366 | 1039 | result_set = store.using(*origin).find( | 1058 | result_set = store.using(*origin).find( |
367 | 1040 | (SourcePackageRelease, LibraryFileAlias, SourcePackageName, | 1059 | (SourcePackageRelease, LibraryFileAlias, SourcePackageName, |
369 | 1041 | LibraryFileContent, Builder), | 1060 | LibraryFileContent, Builder, PackageBuild, BuildFarmJob), |
370 | 1042 | In(BinaryPackageBuild.id, build_ids)) | 1061 | In(BinaryPackageBuild.id, build_ids)) |
371 | 1043 | 1062 | ||
372 | 1044 | # Force query execution so that the ancillary data gets fetched | 1063 | # Force query execution so that the ancillary data gets fetched |
373 | 1045 | 1064 | ||
374 | === added file 'lib/lp/soyuz/model/buildfarmbuildjob.py' | |||
375 | --- lib/lp/soyuz/model/buildfarmbuildjob.py 1970-01-01 00:00:00 +0000 | |||
376 | +++ lib/lp/soyuz/model/buildfarmbuildjob.py 2010-05-05 15:51:57 +0000 | |||
377 | @@ -0,0 +1,50 @@ | |||
378 | 1 | # Copyright 2010 Canonical Ltd. This software is licensed under the | ||
379 | 2 | # GNU Affero General Public License version 3 (see the file LICENSE). | ||
380 | 3 | |||
381 | 4 | __metaclass__ = type | ||
382 | 5 | __all__ = [ | ||
383 | 6 | 'BuildFarmBuildJob', | ||
384 | 7 | ] | ||
385 | 8 | |||
386 | 9 | |||
387 | 10 | from zope.interface import implements | ||
388 | 11 | |||
389 | 12 | from canonical.database.constants import UTC_NOW | ||
390 | 13 | |||
391 | 14 | from lp.buildmaster.interfaces.buildbase import BuildStatus | ||
392 | 15 | from lp.buildmaster.model.buildfarmjob import BuildFarmJobOld | ||
393 | 16 | from lp.soyuz.interfaces.buildfarmbuildjob import IBuildFarmBuildJob | ||
394 | 17 | |||
395 | 18 | |||
396 | 19 | class BuildFarmBuildJob(BuildFarmJobOld): | ||
397 | 20 | """See `IBuildFaramBuildJob`.""" | ||
398 | 21 | implements(IBuildFarmBuildJob) | ||
399 | 22 | def __init__(self, build): | ||
400 | 23 | """Store the build for this package build farm job. | ||
401 | 24 | |||
402 | 25 | XXX 2010-04-12 michael.nelson bug=536700 | ||
403 | 26 | The build param will no longer be necessary once BuildFarmJob is | ||
404 | 27 | itself a concrete class. This class (PackageBuildFarmJob) | ||
405 | 28 | will also be renamed PackageBuild and turned into a concrete class. | ||
406 | 29 | """ | ||
407 | 30 | super(BuildFarmBuildJob, self).__init__() | ||
408 | 31 | self.build = build | ||
409 | 32 | |||
410 | 33 | def getTitle(self): | ||
411 | 34 | """See `IBuildFarmJob`.""" | ||
412 | 35 | return self.build.title | ||
413 | 36 | |||
414 | 37 | def jobStarted(self): | ||
415 | 38 | """See `IBuildFarmJob`.""" | ||
416 | 39 | self.build.buildstate = BuildStatus.BUILDING | ||
417 | 40 | # The build started, set the start time if not set already. | ||
418 | 41 | if self.build.date_first_dispatched is None: | ||
419 | 42 | self.build.date_first_dispatched = UTC_NOW | ||
420 | 43 | |||
421 | 44 | def jobReset(self): | ||
422 | 45 | """See `IBuildFarmJob`.""" | ||
423 | 46 | self.build.buildstate = BuildStatus.NEEDSBUILD | ||
424 | 47 | |||
425 | 48 | def jobAborted(self): | ||
426 | 49 | """See `IBuildFarmJob`.""" | ||
427 | 50 | self.build.buildstate = BuildStatus.NEEDSBUILD | ||
428 | 0 | 51 | ||
429 | === modified file 'lib/lp/soyuz/model/buildpackagejob.py' | |||
430 | --- lib/lp/soyuz/model/buildpackagejob.py 2010-05-05 15:51:54 +0000 | |||
431 | +++ lib/lp/soyuz/model/buildpackagejob.py 2010-05-05 15:51:57 +0000 | |||
432 | @@ -101,13 +101,13 @@ | |||
433 | 101 | # Please note: the score for language packs is to be zero because | 101 | # Please note: the score for language packs is to be zero because |
434 | 102 | # they unduly delay the building of packages in the main component | 102 | # they unduly delay the building of packages in the main component |
435 | 103 | # otherwise. | 103 | # otherwise. |
437 | 104 | if self.build.sourcepackagerelease.section.name == 'translations': | 104 | if self.build.source_package_release.section.name == 'translations': |
438 | 105 | pass | 105 | pass |
439 | 106 | elif self.build.archive.purpose == ArchivePurpose.COPY: | 106 | elif self.build.archive.purpose == ArchivePurpose.COPY: |
440 | 107 | score = rebuild_archive_score | 107 | score = rebuild_archive_score |
441 | 108 | else: | 108 | else: |
442 | 109 | # Calculates the urgency-related part of the score. | 109 | # Calculates the urgency-related part of the score. |
444 | 110 | urgency = score_urgency[self.build.sourcepackagerelease.urgency] | 110 | urgency = score_urgency[self.build.source_package_release.urgency] |
445 | 111 | score += urgency | 111 | score += urgency |
446 | 112 | 112 | ||
447 | 113 | # Calculates the pocket-related part of the score. | 113 | # Calculates the pocket-related part of the score. |
448 | @@ -140,13 +140,13 @@ | |||
449 | 140 | 140 | ||
450 | 141 | def getLogFileName(self): | 141 | def getLogFileName(self): |
451 | 142 | """See `IBuildPackageJob`.""" | 142 | """See `IBuildPackageJob`.""" |
454 | 143 | sourcename = self.build.sourcepackagerelease.name | 143 | sourcename = self.build.source_package_release.name |
455 | 144 | version = self.build.sourcepackagerelease.version | 144 | version = self.build.source_package_release.version |
456 | 145 | # we rely on previous storage of current buildstate | 145 | # we rely on previous storage of current buildstate |
457 | 146 | # in the state handling methods. | 146 | # in the state handling methods. |
459 | 147 | state = self.build.buildstate.name | 147 | state = self.build.status.name |
460 | 148 | 148 | ||
462 | 149 | dar = self.build.distroarchseries | 149 | dar = self.build.distro_arch_series |
463 | 150 | distroname = dar.distroseries.distribution.name | 150 | distroname = dar.distroseries.distribution.name |
464 | 151 | distroseriesname = dar.distroseries.name | 151 | distroseriesname = dar.distroseries.name |
465 | 152 | archname = dar.architecturetag | 152 | archname = dar.architecturetag |
466 | @@ -163,7 +163,7 @@ | |||
467 | 163 | 163 | ||
468 | 164 | def getName(self): | 164 | def getName(self): |
469 | 165 | """See `IBuildPackageJob`.""" | 165 | """See `IBuildPackageJob`.""" |
471 | 166 | return self.build.sourcepackagerelease.name | 166 | return self.build.source_package_release.name |
472 | 167 | 167 | ||
473 | 168 | @property | 168 | @property |
474 | 169 | def processor(self): | 169 | def processor(self): |
475 | 170 | 170 | ||
476 | === modified file 'lib/lp/soyuz/model/publishing.py' | |||
477 | --- lib/lp/soyuz/model/publishing.py 2010-04-22 08:47:32 +0000 | |||
478 | +++ lib/lp/soyuz/model/publishing.py 2010-05-05 15:51:57 +0000 | |||
479 | @@ -568,7 +568,7 @@ | |||
480 | 568 | return None | 568 | return None |
481 | 569 | 569 | ||
482 | 570 | build = self.sourcepackagerelease.createBuild( | 570 | build = self.sourcepackagerelease.createBuild( |
484 | 571 | distroarchseries=arch, archive=self.archive, pocket=self.pocket) | 571 | distro_arch_series=arch, archive=self.archive, pocket=self.pocket) |
485 | 572 | # Create the builds in suspended mode for disabled archives. | 572 | # Create the builds in suspended mode for disabled archives. |
486 | 573 | build_queue = build.queueBuild(suspended=not self.archive.enabled) | 573 | build_queue = build.queueBuild(suspended=not self.archive.enabled) |
487 | 574 | build_queue.score() | 574 | build_queue.score() |
488 | 575 | 575 | ||
489 | === modified file 'lib/lp/soyuz/model/sourcepackagerelease.py' | |||
490 | --- lib/lp/soyuz/model/sourcepackagerelease.py 2010-05-05 15:51:54 +0000 | |||
491 | +++ lib/lp/soyuz/model/sourcepackagerelease.py 2010-05-05 15:51:57 +0000 | |||
492 | @@ -347,9 +347,9 @@ | |||
493 | 347 | 'DistroArchSeries'] | 347 | 'DistroArchSeries'] |
494 | 348 | 348 | ||
495 | 349 | query = """ | 349 | query = """ |
499 | 350 | Build.sourcepackagerelease = %s AND | 350 | BinaryPackageBuild.source_package_release = %s AND |
500 | 351 | BinaryPackageRelease.build = Build.id AND | 351 | BinaryPackageRelease.build = BinaryPackageBuild.id AND |
501 | 352 | DistroArchSeries.id = Build.distroarchseries AND | 352 | DistroArchSeries.id = BinaryPackageBuild.distro_arch_series AND |
502 | 353 | DistroArchSeries.architecturetag = %s AND | 353 | DistroArchSeries.architecturetag = %s AND |
503 | 354 | BinaryPackagePublishingHistory.binarypackagerelease = | 354 | BinaryPackagePublishingHistory.binarypackagerelease = |
504 | 355 | BinaryPackageRelease.id AND | 355 | BinaryPackageRelease.id AND |
505 | @@ -360,7 +360,7 @@ | |||
506 | 360 | 360 | ||
507 | 361 | select_results = BinaryPackageBuild.select( | 361 | select_results = BinaryPackageBuild.select( |
508 | 362 | query, clauseTables=clauseTables, distinct=True, | 362 | query, clauseTables=clauseTables, distinct=True, |
510 | 363 | orderBy='-Build.id') | 363 | orderBy='-BinaryPackageBuild.id') |
511 | 364 | 364 | ||
512 | 365 | # XXX cprov 20080216: this if/elif/else block could be avoided or, | 365 | # XXX cprov 20080216: this if/elif/else block could be avoided or, |
513 | 366 | # at least, simplified if SelectOne accepts 'distinct' argument. | 366 | # at least, simplified if SelectOne accepts 'distinct' argument. |
514 | @@ -386,7 +386,11 @@ | |||
515 | 386 | # inheritance tree. See bellow. | 386 | # inheritance tree. See bellow. |
516 | 387 | pass | 387 | pass |
517 | 388 | 388 | ||
519 | 389 | queries = ["Build.sourcepackagerelease = %s" % sqlvalues(self)] | 389 | queries = [ |
520 | 390 | "BinaryPackageBuild.package_build = PackageBuild.id AND " | ||
521 | 391 | "PackageBuild.build_farm_job = BuildFarmJob.id AND " | ||
522 | 392 | "BinaryPackageBuild.source_package_release = %s" % ( | ||
523 | 393 | sqlvalues(self))] | ||
524 | 390 | 394 | ||
525 | 391 | # Find out all the possible parent DistroArchSeries | 395 | # Find out all the possible parent DistroArchSeries |
526 | 392 | # a build could be issued (then inherited). | 396 | # a build could be issued (then inherited). |
527 | @@ -417,7 +421,8 @@ | |||
528 | 417 | architectures = [ | 421 | architectures = [ |
529 | 418 | architecture.id for architecture in parent_architectures] | 422 | architecture.id for architecture in parent_architectures] |
530 | 419 | queries.append( | 423 | queries.append( |
532 | 420 | "Build.distroarchseries IN %s" % sqlvalues(architectures)) | 424 | "BinaryPackageBuild.distro_arch_series IN %s" % ( |
533 | 425 | sqlvalues(architectures))) | ||
534 | 421 | 426 | ||
535 | 422 | # Follow archive inheritance across distribution offical archives, | 427 | # Follow archive inheritance across distribution offical archives, |
536 | 423 | # for example: | 428 | # for example: |
537 | @@ -436,13 +441,15 @@ | |||
538 | 436 | archives = [archive.id, ] | 441 | archives = [archive.id, ] |
539 | 437 | 442 | ||
540 | 438 | queries.append( | 443 | queries.append( |
542 | 439 | "Build.archive IN %s" % sqlvalues(archives)) | 444 | "PackageBuild.archive IN %s" % sqlvalues(archives)) |
543 | 440 | 445 | ||
544 | 441 | # Query only the last build record for this sourcerelease | 446 | # Query only the last build record for this sourcerelease |
545 | 442 | # across all possible locations. | 447 | # across all possible locations. |
546 | 443 | query = " AND ".join(queries) | 448 | query = " AND ".join(queries) |
547 | 444 | 449 | ||
549 | 445 | return BinaryPackageBuild.selectFirst(query, orderBy=['-datecreated']) | 450 | return BinaryPackageBuild.selectFirst( |
550 | 451 | query, clauseTables=['BuildFarmJob', 'PackageBuild'], | ||
551 | 452 | orderBy=['-BuildFarmJob.date_created']) | ||
552 | 446 | 453 | ||
553 | 447 | def override(self, component=None, section=None, urgency=None): | 454 | def override(self, component=None, section=None, urgency=None): |
554 | 448 | """See ISourcePackageRelease.""" | 455 | """See ISourcePackageRelease.""" |
555 | 449 | 456 | ||
556 | === renamed file 'lib/lp/soyuz/tests/test_build.py' => 'lib/lp/soyuz/tests/test_binarypackagebuild.py' | |||
557 | --- lib/lp/soyuz/tests/test_build.py 2010-05-05 15:51:54 +0000 | |||
558 | +++ lib/lp/soyuz/tests/test_binarypackagebuild.py 2010-05-05 15:51:57 +0000 | |||
559 | @@ -7,6 +7,7 @@ | |||
560 | 7 | 7 | ||
561 | 8 | from storm.store import Store | 8 | from storm.store import Store |
562 | 9 | from zope.component import getUtility | 9 | from zope.component import getUtility |
563 | 10 | from zope.security.proxy import removeSecurityProxy | ||
564 | 10 | 11 | ||
565 | 11 | from canonical.database.constants import UTC_NOW | 12 | from canonical.database.constants import UTC_NOW |
566 | 12 | from canonical.testing import LaunchpadZopelessLayer | 13 | from canonical.testing import LaunchpadZopelessLayer |
567 | @@ -81,7 +82,7 @@ | |||
568 | 81 | 82 | ||
569 | 82 | [depwait_build] = depwait_source.createMissingBuilds() | 83 | [depwait_build] = depwait_source.createMissingBuilds() |
570 | 83 | depwait_build.buildstate = BuildStatus.MANUALDEPWAIT | 84 | depwait_build.buildstate = BuildStatus.MANUALDEPWAIT |
572 | 84 | depwait_build.dependencies = 'dep-bin' | 85 | depwait_build.dependencies = u'dep-bin' |
573 | 85 | 86 | ||
574 | 86 | return depwait_build | 87 | return depwait_build |
575 | 87 | 88 | ||
576 | @@ -159,10 +160,11 @@ | |||
577 | 159 | # valid ubuntu component. | 160 | # valid ubuntu component. |
578 | 160 | depwait_build = self._setupSimpleDepwaitContext() | 161 | depwait_build = self._setupSimpleDepwaitContext() |
579 | 161 | 162 | ||
580 | 163 | spr = depwait_build.source_package_release | ||
581 | 162 | depwait_build.current_source_publication.requestDeletion( | 164 | depwait_build.current_source_publication.requestDeletion( |
583 | 163 | depwait_build.sourcepackagerelease.creator) | 165 | spr.creator) |
584 | 164 | contrib = getUtility(IComponentSet).new('contrib') | 166 | contrib = getUtility(IComponentSet).new('contrib') |
586 | 165 | depwait_build.sourcepackagerelease.component = contrib | 167 | removeSecurityProxy(spr).component = contrib |
587 | 166 | 168 | ||
588 | 167 | depwait_build.updateDependencies() | 169 | depwait_build.updateDependencies() |
589 | 168 | self.assertEquals(depwait_build.dependencies, '') | 170 | self.assertEquals(depwait_build.dependencies, '') |
590 | @@ -218,7 +220,8 @@ | |||
591 | 218 | # Results can be filtered by architecture tag. | 220 | # Results can be filtered by architecture tag. |
592 | 219 | i386_builds = self.builds[:] | 221 | i386_builds = self.builds[:] |
593 | 220 | hppa_build = i386_builds.pop() | 222 | hppa_build = i386_builds.pop() |
595 | 221 | hppa_build.distroarchseries = self.publisher.distroseries['hppa'] | 223 | removeSecurityProxy(hppa_build).distro_arch_series = ( |
596 | 224 | self.publisher.distroseries['hppa']) | ||
597 | 222 | 225 | ||
598 | 223 | builds = self.build_set.getBuildsForArchive(self.archive, | 226 | builds = self.build_set.getBuildsForArchive(self.archive, |
599 | 224 | arch_tag="i386") | 227 | arch_tag="i386") |
600 | @@ -256,7 +259,8 @@ | |||
601 | 256 | # Results can be filtered by architecture tag. | 259 | # Results can be filtered by architecture tag. |
602 | 257 | i386_builds = self.builds[:] | 260 | i386_builds = self.builds[:] |
603 | 258 | hppa_build = i386_builds.pop() | 261 | hppa_build = i386_builds.pop() |
605 | 259 | hppa_build.distroarchseries = self.publisher.distroseries['hppa'] | 262 | removeSecurityProxy(hppa_build).distro_arch_series = ( |
606 | 263 | self.publisher.distroseries['hppa']) | ||
607 | 260 | 264 | ||
608 | 261 | builds = self.build_set.getBuildsForBuilder(self.builder.id, | 265 | builds = self.build_set.getBuildsForBuilder(self.builder.id, |
609 | 262 | arch_tag="i386") | 266 | arch_tag="i386") |
610 | @@ -296,13 +300,11 @@ | |||
611 | 296 | # Set something just to make sure that storeBuildInfo actually | 300 | # Set something just to make sure that storeBuildInfo actually |
612 | 297 | # empties it. | 301 | # empties it. |
613 | 298 | self.build.dependencies = u'something' | 302 | self.build.dependencies = u'something' |
614 | 299 | |||
615 | 300 | self.build.storeBuildInfo(self.build, None, {}) | 303 | self.build.storeBuildInfo(self.build, None, {}) |
617 | 301 | self.assertIsNot(None, self.build.buildlog) | 304 | self.assertIsNot(None, self.build.log) |
618 | 302 | self.assertEqual(self.builder, self.build.builder) | 305 | self.assertEqual(self.builder, self.build.builder) |
619 | 303 | self.assertIs(None, self.build.dependencies) | 306 | self.assertIs(None, self.build.dependencies) |
622 | 304 | self.assertIsNot(None, self.build.datebuilt) | 307 | self.assertIsNot(None, self.build.date_finished) |
621 | 305 | self.assertIsNot(None, self.build.buildduration) | ||
623 | 306 | 308 | ||
624 | 307 | 309 | ||
625 | 308 | def test_suite(): | 310 | def test_suite(): |
626 | 309 | 311 | ||
627 | === modified file 'lib/lp/soyuz/tests/test_hasbuildrecords.py' | |||
628 | --- lib/lp/soyuz/tests/test_hasbuildrecords.py 2010-01-11 23:43:59 +0000 | |||
629 | +++ lib/lp/soyuz/tests/test_hasbuildrecords.py 2010-05-05 15:51:57 +0000 | |||
630 | @@ -13,7 +13,9 @@ | |||
631 | 13 | from lp.buildmaster.interfaces.builder import IBuilderSet | 13 | from lp.buildmaster.interfaces.builder import IBuilderSet |
632 | 14 | from lp.soyuz.interfaces.buildrecords import IHasBuildRecords | 14 | from lp.soyuz.interfaces.buildrecords import IHasBuildRecords |
633 | 15 | from lp.soyuz.model.processor import ProcessorFamilySet | 15 | from lp.soyuz.model.processor import ProcessorFamilySet |
635 | 16 | from lp.soyuz.tests.test_build import BaseTestCaseWithThreeBuilds | 16 | from lp.soyuz.tests.test_binarypackagebuild import ( |
636 | 17 | BaseTestCaseWithThreeBuilds) | ||
637 | 18 | |||
638 | 17 | 19 | ||
639 | 18 | class TestHasBuildRecordsInterface(BaseTestCaseWithThreeBuilds): | 20 | class TestHasBuildRecordsInterface(BaseTestCaseWithThreeBuilds): |
640 | 19 | """Tests the implementation of IHasBuildRecords by the | 21 | """Tests the implementation of IHasBuildRecords by the |
641 | 20 | 22 | ||
642 | === modified file 'lib/lp/soyuz/tests/test_publishing.py' | |||
643 | --- lib/lp/soyuz/tests/test_publishing.py 2010-03-17 00:47:49 +0000 | |||
644 | +++ lib/lp/soyuz/tests/test_publishing.py 2010-05-05 15:51:57 +0000 | |||
645 | @@ -317,8 +317,8 @@ | |||
646 | 317 | replaces=None, provides=None, pre_depends=None, enhances=None, | 317 | replaces=None, provides=None, pre_depends=None, enhances=None, |
647 | 318 | breaks=None, format=BinaryPackageFormat.DEB): | 318 | breaks=None, format=BinaryPackageFormat.DEB): |
648 | 319 | """Return the corresponding `BinaryPackageRelease`.""" | 319 | """Return the corresponding `BinaryPackageRelease`.""" |
651 | 320 | sourcepackagerelease = build.sourcepackagerelease | 320 | sourcepackagerelease = build.source_package_release |
652 | 321 | distroarchseries = build.distroarchseries | 321 | distroarchseries = build.distro_arch_series |
653 | 322 | architecturespecific = ( | 322 | architecturespecific = ( |
654 | 323 | not sourcepackagerelease.architecturehintlist == 'all') | 323 | not sourcepackagerelease.architecturehintlist == 'all') |
655 | 324 | 324 | ||
656 | @@ -367,11 +367,11 @@ | |||
657 | 367 | build.buildduration = datetime.timedelta(minutes=5) | 367 | build.buildduration = datetime.timedelta(minutes=5) |
658 | 368 | buildlog_filename = 'buildlog_%s-%s-%s.%s_%s_%s.txt.gz' % ( | 368 | buildlog_filename = 'buildlog_%s-%s-%s.%s_%s_%s.txt.gz' % ( |
659 | 369 | build.distribution.name, | 369 | build.distribution.name, |
665 | 370 | build.distroseries.name, | 370 | build.distro_series.name, |
666 | 371 | build.distroarchseries.architecturetag, | 371 | build.distro_arch_series.architecturetag, |
667 | 372 | build.sourcepackagerelease.name, | 372 | build.source_package_release.name, |
668 | 373 | build.sourcepackagerelease.version, | 373 | build.source_package_release.version, |
669 | 374 | build.buildstate.name) | 374 | build.status.name) |
670 | 375 | build.buildlog = self.addMockFile( | 375 | build.buildlog = self.addMockFile( |
671 | 376 | buildlog_filename, filecontent='Built!', | 376 | buildlog_filename, filecontent='Built!', |
672 | 377 | restricted=build.archive.private) | 377 | restricted=build.archive.private) |
673 | @@ -384,7 +384,7 @@ | |||
674 | 384 | pocket=PackagePublishingPocket.RELEASE, | 384 | pocket=PackagePublishingPocket.RELEASE, |
675 | 385 | scheduleddeletiondate=None, dateremoved=None): | 385 | scheduleddeletiondate=None, dateremoved=None): |
676 | 386 | """Return the corresponding BinaryPackagePublishingHistory.""" | 386 | """Return the corresponding BinaryPackagePublishingHistory.""" |
678 | 387 | distroarchseries = binarypackagerelease.build.distroarchseries | 387 | distroarchseries = binarypackagerelease.build.distro_arch_series |
679 | 388 | 388 | ||
680 | 389 | # Publish the binary. | 389 | # Publish the binary. |
681 | 390 | if binarypackagerelease.architecturespecific: | 390 | if binarypackagerelease.architecturespecific: |
682 | @@ -898,7 +898,7 @@ | |||
683 | 898 | self.addFakeChroots(self.distroseries) | 898 | self.addFakeChroots(self.distroseries) |
684 | 899 | 899 | ||
685 | 900 | def getPubSource(self, architecturehintlist): | 900 | def getPubSource(self, architecturehintlist): |
687 | 901 | """Return a mock source package publishing record for the archive | 901 | """Return a mock source package publishing record for the archive |
688 | 902 | and architecture used in this testcase. | 902 | and architecture used in this testcase. |
689 | 903 | 903 | ||
690 | 904 | :param architecturehintlist: Architecture hint list (e.g. "i386 amd64") | 904 | :param architecturehintlist: Architecture hint list (e.g. "i386 amd64") |
691 | @@ -922,13 +922,13 @@ | |||
692 | 922 | def test__getAllowedArchitectures_restricted_override(self): | 922 | def test__getAllowedArchitectures_restricted_override(self): |
693 | 923 | """Test _getAllowedArchitectures honors overrides of restricted archs. | 923 | """Test _getAllowedArchitectures honors overrides of restricted archs. |
694 | 924 | 924 | ||
696 | 925 | Restricted architectures should only be allowed if there is | 925 | Restricted architectures should only be allowed if there is |
697 | 926 | an explicit ArchiveArch association with the archive. | 926 | an explicit ArchiveArch association with the archive. |
698 | 927 | """ | 927 | """ |
699 | 928 | available_archs = [self.sparc_distroarch, self.avr_distroarch] | 928 | available_archs = [self.sparc_distroarch, self.avr_distroarch] |
700 | 929 | getUtility(IArchiveArchSet).new(self.archive, self.avr_family) | 929 | getUtility(IArchiveArchSet).new(self.archive, self.avr_family) |
701 | 930 | pubrec = self.getPubSource(architecturehintlist='any') | 930 | pubrec = self.getPubSource(architecturehintlist='any') |
703 | 931 | self.assertEquals([self.sparc_distroarch, self.avr_distroarch], | 931 | self.assertEquals([self.sparc_distroarch, self.avr_distroarch], |
704 | 932 | pubrec._getAllowedArchitectures(available_archs)) | 932 | pubrec._getAllowedArchitectures(available_archs)) |
705 | 933 | 933 | ||
706 | 934 | def test_createMissingBuilds_restricts_any(self): | 934 | def test_createMissingBuilds_restricts_any(self): |
707 | @@ -941,7 +941,7 @@ | |||
708 | 941 | self.assertEquals(self.sparc_distroarch, builds[0].distroarchseries) | 941 | self.assertEquals(self.sparc_distroarch, builds[0].distroarchseries) |
709 | 942 | 942 | ||
710 | 943 | def test_createMissingBuilds_restricts_explicitlist(self): | 943 | def test_createMissingBuilds_restricts_explicitlist(self): |
712 | 944 | """createMissingBuilds() should limit builds targeted at a | 944 | """createMissingBuilds() should limit builds targeted at a |
713 | 945 | variety of architectures architecture to those allowed for the archive. | 945 | variety of architectures architecture to those allowed for the archive. |
714 | 946 | """ | 946 | """ |
715 | 947 | pubrec = self.getPubSource(architecturehintlist='sparc i386 avr') | 947 | pubrec = self.getPubSource(architecturehintlist='sparc i386 avr') |
716 | @@ -951,7 +951,7 @@ | |||
717 | 951 | 951 | ||
718 | 952 | def test_createMissingBuilds_restricts_all(self): | 952 | def test_createMissingBuilds_restricts_all(self): |
719 | 953 | """createMissingBuilds() should limit builds targeted at 'all' | 953 | """createMissingBuilds() should limit builds targeted at 'all' |
721 | 954 | architectures to the nominated independent architecture, | 954 | architectures to the nominated independent architecture, |
722 | 955 | if that is allowed for the archive. | 955 | if that is allowed for the archive. |
723 | 956 | """ | 956 | """ |
724 | 957 | pubrec = self.getPubSource(architecturehintlist='all') | 957 | pubrec = self.getPubSource(architecturehintlist='all') |
725 | @@ -961,7 +961,7 @@ | |||
726 | 961 | 961 | ||
727 | 962 | def test_createMissingBuilds_restrict_override(self): | 962 | def test_createMissingBuilds_restrict_override(self): |
728 | 963 | """createMissingBuilds() should limit builds targeted at 'any' | 963 | """createMissingBuilds() should limit builds targeted at 'any' |
730 | 964 | architecture to architectures that are unrestricted or | 964 | architecture to architectures that are unrestricted or |
731 | 965 | explicitly associated with the archive. | 965 | explicitly associated with the archive. |
732 | 966 | """ | 966 | """ |
733 | 967 | getUtility(IArchiveArchSet).new(self.archive, self.avr_family) | 967 | getUtility(IArchiveArchSet).new(self.archive, self.avr_family) |
734 | 968 | 968 | ||
735 | === modified file 'lib/lp/soyuz/tests/test_publishing_models.py' | |||
736 | --- lib/lp/soyuz/tests/test_publishing_models.py 2010-03-06 04:57:40 +0000 | |||
737 | +++ lib/lp/soyuz/tests/test_publishing_models.py 2010-05-05 15:51:57 +0000 | |||
738 | @@ -13,7 +13,7 @@ | |||
739 | 13 | from lp.buildmaster.interfaces.buildbase import BuildStatus | 13 | from lp.buildmaster.interfaces.buildbase import BuildStatus |
740 | 14 | from lp.soyuz.interfaces.publishing import (IPublishingSet, | 14 | from lp.soyuz.interfaces.publishing import (IPublishingSet, |
741 | 15 | PackagePublishingStatus) | 15 | PackagePublishingStatus) |
743 | 16 | from lp.soyuz.tests.test_build import BaseTestCaseWithThreeBuilds | 16 | from lp.soyuz.tests.test_binarypackagebuild import BaseTestCaseWithThreeBuilds |
744 | 17 | 17 | ||
745 | 18 | 18 | ||
746 | 19 | class TestPublishingSet(BaseTestCaseWithThreeBuilds): | 19 | class TestPublishingSet(BaseTestCaseWithThreeBuilds): |
747 | @@ -83,8 +83,8 @@ | |||
748 | 83 | for hist in self.sources) | 83 | for hist in self.sources) |
749 | 84 | urls = [lfa.http_url for lfa in lfas] | 84 | urls = [lfa.http_url for lfa in lfas] |
750 | 85 | self.assertEqual(urls, [ | 85 | self.assertEqual(urls, [ |
753 | 86 | 'http://localhost:58000/94/gedit_666_source.changes', | 86 | 'http://localhost:58000/94/gedit_666_source.changes', |
754 | 87 | 'http://localhost:58000/96/firefox_666_source.changes', | 87 | 'http://localhost:58000/96/firefox_666_source.changes', |
755 | 88 | 'http://localhost:58000/98/getting-things-gnome_666_source.changes' | 88 | 'http://localhost:58000/98/getting-things-gnome_666_source.changes' |
756 | 89 | ]) | 89 | ]) |
757 | 90 | 90 |
Diff here: http:// pastebin. ubuntu. com/427743/ (in case the scanner is still catching up).