13194.1.7
by Jeroen Vermeulen
Cosmetic. |
1 |
# Copyright 2009-2011 Canonical Ltd. This software is licensed under the
|
8687.15.17
by Karl Fogel
Add the copyright header block to the rest of the files under lib/lp/. |
2 |
# GNU Affero General Public License version 3 (see the file LICENSE).
|
3 |
||
4983.1.1
by Curtis Hovey
Added lint exceptions to __init__.py and interface/*.py. |
4 |
# pylint: disable-msg=E0211,E0213
|
2068
by Canonical.com Patch Queue Manager
[r=SteveA/trivial] import fascism, kill translationeffort, kill sshkey browser code, add __all__s to interfaces, other cleanings-up |
5 |
|
6 |
"""Queue interfaces."""
|
|
7 |
||
8 |
__metaclass__ = type |
|
9 |
||
10 |
__all__ = [ |
|
6269.10.4
by Celso Providelo
applying review comments, r=salgado. |
11 |
'IHasQueueItems', |
3496.1.120
by Celso Providelo
unify the permissions for a DistroReleaseQueue in an abstract model called IPackageUploadQueue. |
12 |
'IPackageUploadQueue', |
3691.441.21
by Malcolm Cleaton
More stuff |
13 |
'IPackageUpload', |
14 |
'IPackageUploadBuild', |
|
15 |
'IPackageUploadSource', |
|
16 |
'IPackageUploadCustom', |
|
17 |
'IPackageUploadSet', |
|
6269.10.4
by Celso Providelo
applying review comments, r=salgado. |
18 |
'NonBuildableSourceUploadError', |
19 |
'QueueBuildAcceptError', |
|
20 |
'QueueInconsistentStateError', |
|
21 |
'QueueSourceAcceptError', |
|
22 |
'QueueStateWriteProtectedError', |
|
2068
by Canonical.com Patch Queue Manager
[r=SteveA/trivial] import fascism, kill translationeffort, kill sshkey browser code, add __all__s to interfaces, other cleanings-up |
23 |
]
|
24 |
||
13211.1.1
by Jeroen Vermeulen
Lint. |
25 |
from lazr.enum import DBEnumeratedType |
8731.1.2
by Julian Edwards
Export IPackageUpload on the webservice. |
26 |
from lazr.restful.declarations import ( |
11403.1.4
by Henning Eggers
Reformatted imports using format-imports script r32. |
27 |
export_as_webservice_entry, |
28 |
exported, |
|
29 |
)
|
|
8697.13.13
by Julian Edwards
Move getPackageUploads to the PackageUploadSet utility. |
30 |
from lazr.restful.fields import Reference |
11403.1.4
by Henning Eggers
Reformatted imports using format-imports script r32. |
31 |
from zope.interface import ( |
32 |
Attribute, |
|
33 |
Interface, |
|
34 |
)
|
|
35 |
from zope.schema import ( |
|
36 |
Choice, |
|
37 |
Datetime, |
|
38 |
Int, |
|
39 |
List, |
|
40 |
TextLine, |
|
41 |
)
|
|
42 |
||
43 |
from canonical.launchpad import _ |
|
13211.1.1
by Jeroen Vermeulen
Lint. |
44 |
from lp.soyuz.enums import PackageUploadStatus |
7675.1164.4
by Julian Edwards
add tests, not working yet |
45 |
from lp.soyuz.interfaces.packagecopyjob import IPackageCopyJob |
11411.6.9
by Julian Edwards
Move PackageUploadStatus and PackageUploadCustomFormat |
46 |
|
1102
by Canonical.com Patch Queue Manager
Lucille had some XXXs which should have been NOTEs |
47 |
|
2865.2.22
by Celso Providelo
Land state-machine for DRQ content class, deny direcly write access for DRQ.status, fix tests and callsites properly, reduce soyuz-upload test verbosity. |
48 |
class QueueStateWriteProtectedError(Exception): |
49 |
"""This exception prevent directly set operation in queue state.
|
|
50 |
||
51 |
The queue state machine is controlled by its specific provided methods,
|
|
3147.2.62
by Celso Providelo
Applying review comments (take 1) |
52 |
like: setNew, setAccepted and so on.
|
2865.2.22
by Celso Providelo
Land state-machine for DRQ content class, deny direcly write access for DRQ.status, fix tests and callsites properly, reduce soyuz-upload test verbosity. |
53 |
"""
|
54 |
||
55 |
||
56 |
class QueueInconsistentStateError(Exception): |
|
57 |
"""Queue state machine error.
|
|
58 |
||
3023.4.1
by Christian Reis
Handle review comments from Salgado and Spiv |
59 |
It's generated when the solicited state makes the record
|
60 |
inconsistent against the current system constraints.
|
|
2865.2.22
by Celso Providelo
Land state-machine for DRQ content class, deny direcly write access for DRQ.status, fix tests and callsites properly, reduce soyuz-upload test verbosity. |
61 |
"""
|
62 |
||
63 |
||
6269.10.4
by Celso Providelo
applying review comments, r=salgado. |
64 |
class NonBuildableSourceUploadError(QueueInconsistentStateError): |
65 |
"""Source upload will not result in any build record.
|
|
66 |
||
67 |
This error is raised when trying to accept a source upload that is
|
|
68 |
consistent but will not build in any of the architectures supported
|
|
69 |
in its targeted distroseries.
|
|
70 |
"""
|
|
71 |
||
72 |
||
2865.2.22
by Celso Providelo
Land state-machine for DRQ content class, deny direcly write access for DRQ.status, fix tests and callsites properly, reduce soyuz-upload test verbosity. |
73 |
class QueueSourceAcceptError(Exception): |
3691.441.21
by Malcolm Cleaton
More stuff |
74 |
"""It prevents a PackageUploadSource from being ACCEPTED.
|
2865.2.58
by Celso Providelo
Extend DRQ state machine for builds and tests, also workarround buildd upload policy to acceptevery existent component. |
75 |
|
4285.2.1
by Mark Shuttleworth
Massive renaming of distrorelease to distroseries |
76 |
It is generated by Component and/or Section mismatching in a DistroSeries.
|
2865.2.58
by Celso Providelo
Extend DRQ state machine for builds and tests, also workarround buildd upload policy to acceptevery existent component. |
77 |
"""
|
78 |
||
6269.10.4
by Celso Providelo
applying review comments, r=salgado. |
79 |
|
2865.2.58
by Celso Providelo
Extend DRQ state machine for builds and tests, also workarround buildd upload policy to acceptevery existent component. |
80 |
class QueueBuildAcceptError(Exception): |
3691.441.21
by Malcolm Cleaton
More stuff |
81 |
"""It prevents a PackageUploadBuild from being ACCEPTED.
|
2865.2.22
by Celso Providelo
Land state-machine for DRQ content class, deny direcly write access for DRQ.status, fix tests and callsites properly, reduce soyuz-upload test verbosity. |
82 |
|
4285.2.1
by Mark Shuttleworth
Massive renaming of distrorelease to distroseries |
83 |
It is generated by Component and/or Section mismatching in a DistroSeries.
|
2865.2.22
by Celso Providelo
Land state-machine for DRQ content class, deny direcly write access for DRQ.status, fix tests and callsites properly, reduce soyuz-upload test verbosity. |
84 |
"""
|
85 |
||
86 |
||
3496.1.120
by Celso Providelo
unify the permissions for a DistroReleaseQueue in an abstract model called IPackageUploadQueue. |
87 |
class IPackageUploadQueue(Interface): |
88 |
"""Used to establish permission to a group of package uploads.
|
|
89 |
||
4285.2.1
by Mark Shuttleworth
Massive renaming of distrorelease to distroseries |
90 |
Recieves an IDistroSeries and a PackageUploadStatus dbschema
|
13194.2.1
by Gavin Panella
Change all uses of 'initialise' to 'initialize'. |
91 |
on initialization.
|
3496.1.120
by Celso Providelo
unify the permissions for a DistroReleaseQueue in an abstract model called IPackageUploadQueue. |
92 |
No attributes exposed via interface, only used to check permissions.
|
93 |
"""
|
|
94 |
||
95 |
||
3691.441.21
by Malcolm Cleaton
More stuff |
96 |
class IPackageUpload(Interface): |
10529.1.6
by Jonathan Lange
Fewer mentions of lucille |
97 |
"""A Queue item for the archive uploader."""
|
98 |
||
12243.5.8
by Leonard Richardson
Added web_links to the tests for objects that have them, and removed them from objects that don't. |
99 |
export_as_webservice_entry(publish_web_link=False) |
1102
by Canonical.com Patch Queue Manager
Lucille had some XXXs which should have been NOTEs |
100 |
|
101 |
id = Int( |
|
2713
by Canonical.com Patch Queue Manager
Various fixes to queue, build etc. add zcml for queue, DB patch included. r=stevea,stub. Also fix dbschema security proxy bug (bug 1971) r=stevea |
102 |
title=_("ID"), required=True, readonly=True, |
1102
by Canonical.com Patch Queue Manager
Lucille had some XXXs which should have been NOTEs |
103 |
)
|
104 |
||
8731.1.2
by Julian Edwards
Export IPackageUpload on the webservice. |
105 |
status = exported( |
106 |
Choice( |
|
107 |
vocabulary=PackageUploadStatus, |
|
108 |
description=_("The status of this upload."), |
|
3147.2.62
by Celso Providelo
Applying review comments (take 1) |
109 |
title=_("Queue status"), required=False, readonly=True, |
8731.1.2
by Julian Edwards
Export IPackageUpload on the webservice. |
110 |
))
|
1102
by Canonical.com Patch Queue Manager
Lucille had some XXXs which should have been NOTEs |
111 |
|
8731.1.2
by Julian Edwards
Export IPackageUpload on the webservice. |
112 |
distroseries = exported( |
113 |
Reference( |
|
8697.13.16
by Julian Edwards
fix circular imports |
114 |
# Really IDistroSeries, patched in
|
115 |
# _schema_circular_imports.py
|
|
116 |
schema=Interface, |
|
8731.1.2
by Julian Edwards
Export IPackageUpload on the webservice. |
117 |
description=_("The distroseries targeted by this upload."), |
4285.2.1
by Mark Shuttleworth
Massive renaming of distrorelease to distroseries |
118 |
title=_("Series"), required=True, readonly=False, |
8731.1.2
by Julian Edwards
Export IPackageUpload on the webservice. |
119 |
))
|
2713
by Canonical.com Patch Queue Manager
Various fixes to queue, build etc. add zcml for queue, DB patch included. r=stevea,stub. Also fix dbschema security proxy bug (bug 1971) r=stevea |
120 |
|
8731.1.2
by Julian Edwards
Export IPackageUpload on the webservice. |
121 |
pocket = exported( |
122 |
Choice( |
|
8697.13.16
by Julian Edwards
fix circular imports |
123 |
# Really PackagePublishingPocket, patched in
|
124 |
# _schema_circular_imports.py
|
|
125 |
vocabulary=DBEnumeratedType, |
|
8731.1.2
by Julian Edwards
Export IPackageUpload on the webservice. |
126 |
description=_("The pocket targeted by this upload."), |
2713
by Canonical.com Patch Queue Manager
Various fixes to queue, build etc. add zcml for queue, DB patch included. r=stevea,stub. Also fix dbschema security proxy bug (bug 1971) r=stevea |
127 |
title=_("The pocket"), required=True, readonly=False, |
8697.13.10
by Julian Edwards
Add export of PackageUpload. |
128 |
))
|
2733
by Canonical.com Patch Queue Manager
Upload processor. r=stevea |
129 |
|
8731.1.2
by Julian Edwards
Export IPackageUpload on the webservice. |
130 |
date_created = exported( |
131 |
Datetime( |
|
132 |
title=_('Date created'), |
|
133 |
description=_("The date this package upload was done."))) |
|
7675.218.1
by Celso Providelo
Creating PackageUploadSet.createDelayedCopy() and adjusting PackageUpload to use its 'date_created' DB column instead of the property based on the changesfile creation date. |
134 |
|
3032.1.1
by Celso Providelo
Workaround for the Soyuz Production database and test fixing. |
135 |
changesfile = Attribute("The librarian alias for the changes file " |
136 |
"associated with this upload") |
|
2865.2.49
by Celso Providelo
Fix IDistroReleaseQueue.count() to accept an optional distrorelease argument, use this feature in queue tool to display a proper queue counter. |
137 |
|
3691.424.5
by Celso Providelo
applying review comments (r=bjornt) |
138 |
signing_key = Attribute("Changesfile Signing Key.") |
7675.1164.1
by Julian Edwards
Add package_copy_job field to PackageUpload model and interface. |
139 |
|
140 |
package_copy_job = Reference( |
|
7675.1164.4
by Julian Edwards
add tests, not working yet |
141 |
schema=IPackageCopyJob, |
7675.1164.1
by Julian Edwards
Add package_copy_job field to PackageUpload model and interface. |
142 |
description=_("The PackageCopyJob for this upload, if it has one."), |
13287.2.2
by Jeroen Vermeulen
IPackageCopyJobSource. |
143 |
title=_("Raw Package Copy Job"), required=False, readonly=True) |
144 |
||
145 |
concrete_package_copy_job = Reference( |
|
146 |
schema=IPackageCopyJob, |
|
147 |
description=_("Concrete IPackageCopyJob implementation, if any."), |
|
7675.1164.1
by Julian Edwards
Add package_copy_job field to PackageUpload model and interface. |
148 |
title=_("Package Copy Job"), required=False, readonly=True) |
149 |
||
8731.1.2
by Julian Edwards
Export IPackageUpload on the webservice. |
150 |
archive = exported( |
151 |
Reference( |
|
8697.13.16
by Julian Edwards
fix circular imports |
152 |
# Really IArchive, patched in _schema_circular_imports.py
|
153 |
schema=Interface, |
|
8731.1.2
by Julian Edwards
Export IPackageUpload on the webservice. |
154 |
description=_("The archive for this upload."), |
155 |
title=_("Archive"), required=True, readonly=True)) |
|
2821.3.1
by Daniel Silverstone
Added a queue ftpmaster script and sundry extra bits. |
156 |
sources = Attribute("The queue sources associated with this queue item") |
157 |
builds = Attribute("The queue builds associated with the queue item") |
|
3048.5.39
by Celso Providelo
fix DRQ interface for carlos |
158 |
customfiles = Attribute("Custom upload files associated with this " |
159 |
"queue item") |
|
2821.3.1
by Daniel Silverstone
Added a queue ftpmaster script and sundry extra bits. |
160 |
|
8697.13.11
by Julian Edwards
Export of custom_file_urls and a new webservice test. Bug still left in getPackageUploads, will fix in next revision. |
161 |
custom_file_urls = exported( |
162 |
List( |
|
163 |
title=_("Custom File URLs"), |
|
164 |
description=_("Librarian URLs for all the custom files attached " |
|
165 |
"to this upload."), |
|
166 |
value_type=TextLine(), |
|
167 |
required=False, |
|
168 |
readonly=True)) |
|
169 |
||
8731.1.2
by Julian Edwards
Export IPackageUpload on the webservice. |
170 |
displayname = exported( |
171 |
TextLine( |
|
8697.13.10
by Julian Edwards
Add export of PackageUpload. |
172 |
title=_("Generic displayname for a queue item"), readonly=True), |
173 |
exported_as="display_name") |
|
8731.1.2
by Julian Edwards
Export IPackageUpload on the webservice. |
174 |
displayversion = exported( |
175 |
TextLine( |
|
13211.2.1
by Jeroen Vermeulen
Prepare queue script and +queue page for copy-job package uploads. |
176 |
title=_("This item's displayable source package version"), |
8697.13.10
by Julian Edwards
Add export of PackageUpload. |
177 |
readonly=True), |
178 |
exported_as="display_version") |
|
8731.1.2
by Julian Edwards
Export IPackageUpload on the webservice. |
179 |
displayarchs = exported( |
180 |
TextLine( |
|
8697.13.10
by Julian Edwards
Add export of PackageUpload. |
181 |
title=_("Architectures related to this item"), readonly=True), |
182 |
exported_as="display_arches") |
|
3496.1.78
by Celso Providelo
clean up unused helper properties in IDistroReleaseQueue. |
183 |
|
184 |
sourcepackagerelease = Attribute( |
|
185 |
"The source package release for this item") |
|
186 |
||
13211.2.1
by Jeroen Vermeulen
Prepare queue script and +queue page for copy-job package uploads. |
187 |
package_name = TextLine( |
188 |
title=_("Name of the uploaded source package"), readonly=True) |
|
189 |
||
190 |
package_version = TextLine( |
|
191 |
title=_("Source package version"), readonly=True) |
|
192 |
||
193 |
component_name = TextLine( |
|
194 |
title=_("Source package component name"), readonly=True) |
|
195 |
||
4974.4.3
by Julian Edwards
Kiko's review comments: |
196 |
contains_source = Attribute("whether or not this upload contains sources") |
197 |
contains_build = Attribute("whether or not this upload contains binaries") |
|
198 |
contains_installer = Attribute( |
|
3147.2.85
by Celso Providelo
Implementing Queue tool actions UI |
199 |
"whether or not this upload contains installers images") |
4974.4.3
by Julian Edwards
Kiko's review comments: |
200 |
contains_translation = Attribute( |
3147.2.85
by Celso Providelo
Implementing Queue tool actions UI |
201 |
"whether or not this upload contains translations") |
4974.4.3
by Julian Edwards
Kiko's review comments: |
202 |
contains_upgrader = Attribute( |
3147.2.85
by Celso Providelo
Implementing Queue tool actions UI |
203 |
"wheter or not this upload contains upgrader images") |
4974.4.3
by Julian Edwards
Kiko's review comments: |
204 |
contains_ddtp = Attribute( |
3686.1.13
by Celso Providelo
Implementing DDTP (Debian Description Translation Project) custom format support in soyuz, as suggested in bug #54795 |
205 |
"wheter or not this upload contains DDTP images") |
4204.2.20
by Julian Edwards
Address remaining review issues and fix some affected tests. |
206 |
isPPA = Attribute( |
207 |
"Return True if this PackageUpload is a PPA upload.") |
|
7675.235.2
by Celso Providelo
IPackageUpload.{acceptFromCopy, realiseUpload} adjusted and tested for delayed-copies. |
208 |
is_delayed_copy = Attribute( |
209 |
"Whether or not this PackageUpload record is a delayed-copy.") |
|
2821.3.1
by Daniel Silverstone
Added a queue ftpmaster script and sundry extra bits. |
210 |
|
6269.6.10
by Julian Edwards
Fix test bustage. |
211 |
components = Attribute( |
6269.6.11
by Julian Edwards
gmb's review comments. |
212 |
"""The set of components used in this upload.
|
6269.6.10
by Julian Edwards
Fix test bustage. |
213 |
|
214 |
For sources, this is the component on the associated
|
|
215 |
sourcepackagerelease. For binaries, this is all the components
|
|
216 |
on all the binarypackagerelease records arising from the build.
|
|
217 |
""") |
|
218 |
||
13211.2.1
by Jeroen Vermeulen
Prepare queue script and +queue page for copy-job package uploads. |
219 |
section_name = TextLine( |
220 |
title=_("Source package sectio name"), readonly=True) |
|
221 |
||
3147.2.62
by Celso Providelo
Applying review comments (take 1) |
222 |
def setNew(): |
3023.4.1
by Christian Reis
Handle review comments from Salgado and Spiv |
223 |
"""Set queue state to NEW."""
|
2865.2.49
by Celso Providelo
Fix IDistroReleaseQueue.count() to accept an optional distrorelease argument, use this feature in queue tool to display a proper queue counter. |
224 |
|
3147.2.62
by Celso Providelo
Applying review comments (take 1) |
225 |
def setUnapproved(): |
3023.4.1
by Christian Reis
Handle review comments from Salgado and Spiv |
226 |
"""Set queue state to UNAPPROVED."""
|
2865.2.22
by Celso Providelo
Land state-machine for DRQ content class, deny direcly write access for DRQ.status, fix tests and callsites properly, reduce soyuz-upload test verbosity. |
227 |
|
3147.2.62
by Celso Providelo
Applying review comments (take 1) |
228 |
def setAccepted(): |
3023.4.1
by Christian Reis
Handle review comments from Salgado and Spiv |
229 |
"""Set queue state to ACCEPTED.
|
2865.2.22
by Celso Providelo
Land state-machine for DRQ content class, deny direcly write access for DRQ.status, fix tests and callsites properly, reduce soyuz-upload test verbosity. |
230 |
|
3691.442.27
by Celso Providelo
applying review comments (r=jamesh) |
231 |
Perform the required checks on its content, so we guarantee data
|
2865.2.22
by Celso Providelo
Land state-machine for DRQ content class, deny direcly write access for DRQ.status, fix tests and callsites properly, reduce soyuz-upload test verbosity. |
232 |
integrity by code.
|
233 |
"""
|
|
234 |
||
3147.2.62
by Celso Providelo
Applying review comments (take 1) |
235 |
def setDone(): |
3023.4.1
by Christian Reis
Handle review comments from Salgado and Spiv |
236 |
"""Set queue state to DONE."""
|
2865.2.22
by Celso Providelo
Land state-machine for DRQ content class, deny direcly write access for DRQ.status, fix tests and callsites properly, reduce soyuz-upload test verbosity. |
237 |
|
3147.2.62
by Celso Providelo
Applying review comments (take 1) |
238 |
def setRejected(): |
3023.4.1
by Christian Reis
Handle review comments from Salgado and Spiv |
239 |
"""Set queue state to REJECTED."""
|
2865.2.49
by Celso Providelo
Fix IDistroReleaseQueue.count() to accept an optional distrorelease argument, use this feature in queue tool to display a proper queue counter. |
240 |
|
5663.3.3
by Celso Providelo
Encapsulating acceptance procedure in upload-time into IPackageUpload.acceptFromUploader method. |
241 |
def acceptFromUploader(changesfile_path, logger=None): |
242 |
"""Perform upload acceptance during upload-time.
|
|
243 |
||
7675.235.5
by Celso Providelo
applying review comments, r=abentley. |
244 |
* Move the upload to accepted queue in all cases.
|
245 |
* Publish and close bugs for 'single-source' uploads.
|
|
5663.3.6
by Celso Providelo
applying review comments, r=sinzui. |
246 |
* Skip bug-closing for PPA uploads.
|
7675.235.2
by Celso Providelo
IPackageUpload.{acceptFromCopy, realiseUpload} adjusted and tested for delayed-copies. |
247 |
* Grant karma to people involved with the upload.
|
7675.262.1
by Celso Providelo
Relying on bug-closing done by process-accepted for delayed-copies. No need to have local bug closing in IPackageUpload.acceptFromCopy(). |
248 |
|
249 |
:raises: AssertionError if the context is a delayed-copy.
|
|
7675.235.2
by Celso Providelo
IPackageUpload.{acceptFromCopy, realiseUpload} adjusted and tested for delayed-copies. |
250 |
"""
|
251 |
||
252 |
def acceptFromCopy(): |
|
253 |
"""Perform upload acceptance for a delayed-copy record.
|
|
254 |
||
7675.235.5
by Celso Providelo
applying review comments, r=abentley. |
255 |
* Move the upload to accepted queue in all cases.
|
7675.262.1
by Celso Providelo
Relying on bug-closing done by process-accepted for delayed-copies. No need to have local bug closing in IPackageUpload.acceptFromCopy(). |
256 |
|
257 |
:raises: AssertionError if the context is not a delayed-copy or
|
|
258 |
has no sources associated to it.
|
|
5663.3.3
by Celso Providelo
Encapsulating acceptance procedure in upload-time into IPackageUpload.acceptFromUploader method. |
259 |
"""
|
260 |
||
13144.1.1
by Steve Kowalik
Drop announce_list from notify() and acceptFromQueue(). |
261 |
def acceptFromQueue(logger=None, dry_run=False): |
7675.235.2
by Celso Providelo
IPackageUpload.{acceptFromCopy, realiseUpload} adjusted and tested for delayed-copies. |
262 |
"""Call setAccepted, do a syncUpdate, and send notification email.
|
263 |
||
264 |
* Grant karma to people involved with the upload.
|
|
7675.262.1
by Celso Providelo
Relying on bug-closing done by process-accepted for delayed-copies. No need to have local bug closing in IPackageUpload.acceptFromCopy(). |
265 |
|
266 |
:raises: AssertionError if the context is a delayed-copy.
|
|
7675.235.2
by Celso Providelo
IPackageUpload.{acceptFromCopy, realiseUpload} adjusted and tested for delayed-copies. |
267 |
"""
|
5094.3.3
by Julian Edwards
Refactor the queue acceptance/rejection code that was in the UI and the |
268 |
|
5094.3.6
by Julian Edwards
Clean up the interface declarations. |
269 |
def rejectFromQueue(logger=None, dry_run=False): |
270 |
"""Call setRejected, do a syncUpdate, and send notification email."""
|
|
5094.3.3
by Julian Edwards
Refactor the queue acceptance/rejection code that was in the UI and the |
271 |
|
2756
by Canonical.com Patch Queue Manager
Queue-Accepted processor and some upload tweaks to fit it. r=stevea |
272 |
def realiseUpload(logger=None): |
273 |
"""Take this ACCEPTED upload and create the publishing records for it
|
|
274 |
as appropriate.
|
|
275 |
||
276 |
When derivation is taken into account, this may result in queue items
|
|
277 |
being created for derived distributions.
|
|
278 |
||
279 |
If a logger is provided, messages will be written to it as the upload
|
|
280 |
is entered into the publishing records.
|
|
5663.3.4
by Celso Providelo
Immediatelly creating build ready to be dispatched for PPA uploads. Some tests are pending fixes. |
281 |
|
282 |
Return a list containing the publishing records created.
|
|
2756
by Canonical.com Patch Queue Manager
Queue-Accepted processor and some upload tweaks to fit it. r=stevea |
283 |
"""
|
2865.2.49
by Celso Providelo
Fix IDistroReleaseQueue.count() to accept an optional distrorelease argument, use this feature in queue tool to display a proper queue counter. |
284 |
|
2733
by Canonical.com Patch Queue Manager
Upload processor. r=stevea |
285 |
def addSource(spr): |
286 |
"""Add the provided source package release to this queue entry."""
|
|
287 |
||
288 |
def addBuild(build): |
|
289 |
"""Add the provided build to this queue entry."""
|
|
290 |
||
291 |
def addCustom(library_file, custom_type): |
|
292 |
"""Add the provided library file alias as a custom queue entry of
|
|
293 |
the given custom type.
|
|
294 |
"""
|
|
2865.2.49
by Celso Providelo
Fix IDistroReleaseQueue.count() to accept an optional distrorelease argument, use this feature in queue tool to display a proper queue counter. |
295 |
|
3500.2.13
by Celso Providelo
Replace flush_database_updates in browser/queue.py by simpler syncUpdate build-in method as suggested by spiv in bug #47239 |
296 |
def syncUpdate(): |
297 |
"""Write updates made on this object to the database.
|
|
298 |
||
299 |
This should be used when you can't wait until the transaction is
|
|
300 |
committed to have some updates actually written to the database.
|
|
301 |
"""
|
|
4204.2.10
by Julian Edwards
- Rejections added to drq.notify(). |
302 |
|
13144.1.1
by Steve Kowalik
Drop announce_list from notify() and acceptFromQueue(). |
303 |
def notify(summary_text=None, changes_file_object=None, logger=None): |
4285.2.10
by Mark Shuttleworth
Merge RF |
304 |
"""Notify by email when there is a new distroseriesqueue entry.
|
4204.2.5
by Julian Edwards
Commit work done so far at UDS. |
305 |
|
306 |
This will send new, accept, announce and rejection messages as
|
|
307 |
appropriate.
|
|
4204.2.18
by Julian Edwards
Merge RF and address review comments. Forgot to commit after the RF merge since |
308 |
|
309 |
:param summary_text: Any additional text to append to the auto-
|
|
310 |
generated summary. This is also the only text used if there is
|
|
311 |
a rejection message generated.
|
|
312 |
||
313 |
:param changes_file_object: An open file object pointing at the
|
|
314 |
changes file. Current, only nascentupload need supply this
|
|
315 |
as the transaction is not committed to the DB at that point so
|
|
316 |
data needs to be obtained from the changes file.
|
|
317 |
||
318 |
:param logger: Specify a logger object if required. Mainly for tests.
|
|
4204.2.5
by Julian Edwards
Commit work done so far at UDS. |
319 |
"""
|
3500.2.13
by Celso Providelo
Replace flush_database_updates in browser/queue.py by simpler syncUpdate build-in method as suggested by spiv in bug #47239 |
320 |
|
6269.6.2
by Julian Edwards
Allow queue admin by those people specified in ArchivePermission, with the |
321 |
def overrideSource(new_component, new_section, allowed_components): |
5985.12.6
by Julian Edwards
Add code that does the overriding, if selected in the UI. |
322 |
"""Override the source package contained in this queue item.
|
323 |
||
324 |
:param new_component: An IComponent to replace the existing one
|
|
325 |
in the upload's source.
|
|
326 |
:param new_section: An ISection to replace the existing one
|
|
327 |
in the upload's source.
|
|
6269.6.2
by Julian Edwards
Allow queue admin by those people specified in ArchivePermission, with the |
328 |
:param allowed_components: A sequence of components that the
|
329 |
callsite is allowed to override from and to.
|
|
330 |
||
331 |
:raises QueueInconsistentStateError: if either the existing
|
|
332 |
or the new_component are not in the allowed_components
|
|
333 |
sequence.
|
|
5985.12.6
by Julian Edwards
Add code that does the overriding, if selected in the UI. |
334 |
|
335 |
The override values may be None, in which case they are not
|
|
336 |
changed.
|
|
337 |
||
338 |
:return: True if the source was overridden.
|
|
339 |
"""
|
|
340 |
||
6269.6.7
by Julian Edwards
Fix doc tests for IPackageUpload.override{Source.Binary} with allowed_components. |
341 |
def overrideBinaries(new_component, new_section, new_priority, |
342 |
allowed_components): |
|
5985.12.6
by Julian Edwards
Add code that does the overriding, if selected in the UI. |
343 |
"""Override all the binaries in a binary queue item.
|
344 |
||
345 |
:param new_component: An IComponent to replace the existing one
|
|
346 |
in the upload's source.
|
|
347 |
:param new_section: An ISection to replace the existing one
|
|
348 |
in the upload's source.
|
|
349 |
:param new_priority: A valid PackagePublishingPriority to replace
|
|
350 |
the existing one in the upload's binaries.
|
|
6269.6.2
by Julian Edwards
Allow queue admin by those people specified in ArchivePermission, with the |
351 |
:param allowed_components: A sequence of components that the
|
352 |
callsite is allowed to override from and to.
|
|
353 |
||
354 |
:raises QueueInconsistentStateError: if either the existing
|
|
355 |
or the new_component are not in the allowed_components
|
|
356 |
sequence.
|
|
5985.12.6
by Julian Edwards
Add code that does the overriding, if selected in the UI. |
357 |
|
358 |
The override values may be None, in which case they are not
|
|
359 |
changed.
|
|
360 |
||
361 |
:return: True if the binaries were overridden.
|
|
362 |
"""
|
|
363 |
||
1102
by Canonical.com Patch Queue Manager
Lucille had some XXXs which should have been NOTEs |
364 |
|
3691.441.21
by Malcolm Cleaton
More stuff |
365 |
class IPackageUploadBuild(Interface): |
10529.1.6
by Jonathan Lange
Fewer mentions of lucille |
366 |
"""A Queue item's related builds."""
|
1102
by Canonical.com Patch Queue Manager
Lucille had some XXXs which should have been NOTEs |
367 |
|
368 |
id = Int( |
|
2713
by Canonical.com Patch Queue Manager
Various fixes to queue, build etc. add zcml for queue, DB patch included. r=stevea,stub. Also fix dbschema security proxy bug (bug 1971) r=stevea |
369 |
title=_("ID"), required=True, readonly=True, |
1102
by Canonical.com Patch Queue Manager
Lucille had some XXXs which should have been NOTEs |
370 |
)
|
371 |
||
3691.441.21
by Malcolm Cleaton
More stuff |
372 |
packageupload = Int( |
373 |
title=_("PackageUpload"), required=True, |
|
2713
by Canonical.com Patch Queue Manager
Various fixes to queue, build etc. add zcml for queue, DB patch included. r=stevea,stub. Also fix dbschema security proxy bug (bug 1971) r=stevea |
374 |
readonly=False, |
1102
by Canonical.com Patch Queue Manager
Lucille had some XXXs which should have been NOTEs |
375 |
)
|
376 |
||
377 |
build = Int( |
|
2713
by Canonical.com Patch Queue Manager
Various fixes to queue, build etc. add zcml for queue, DB patch included. r=stevea,stub. Also fix dbschema security proxy bug (bug 1971) r=stevea |
378 |
title=_("The related build"), required=True, readonly=False, |
1102
by Canonical.com Patch Queue Manager
Lucille had some XXXs which should have been NOTEs |
379 |
)
|
380 |
||
2756
by Canonical.com Patch Queue Manager
Queue-Accepted processor and some upload tweaks to fit it. r=stevea |
381 |
def publish(logger=None): |
4285.2.1
by Mark Shuttleworth
Massive renaming of distrorelease to distroseries |
382 |
"""Publish this queued source in the distroseries referred to by
|
2756
by Canonical.com Patch Queue Manager
Queue-Accepted processor and some upload tweaks to fit it. r=stevea |
383 |
the parent queue item.
|
384 |
||
4285.2.1
by Mark Shuttleworth
Massive renaming of distrorelease to distroseries |
385 |
We determine the distroarchseries by matching architecturetags against
|
386 |
the distroarchseries the build was compiled for.
|
|
2756
by Canonical.com Patch Queue Manager
Queue-Accepted processor and some upload tweaks to fit it. r=stevea |
387 |
|
388 |
This method can raise NotFoundError if the architecturetag can't be
|
|
4285.2.1
by Mark Shuttleworth
Massive renaming of distrorelease to distroseries |
389 |
matched up in the queue item's distroseries.
|
2756
by Canonical.com Patch Queue Manager
Queue-Accepted processor and some upload tweaks to fit it. r=stevea |
390 |
|
391 |
Returns a list of the secure binary package publishing history
|
|
392 |
objects in case it is of use to the caller. This may include records
|
|
4285.2.1
by Mark Shuttleworth
Massive renaming of distrorelease to distroseries |
393 |
published into other distroarchseriess if this build contained arch
|
2756
by Canonical.com Patch Queue Manager
Queue-Accepted processor and some upload tweaks to fit it. r=stevea |
394 |
independant packages.
|
395 |
||
396 |
If a logger is provided, information pertaining to the publishing
|
|
397 |
process will be logged to it.
|
|
398 |
"""
|
|
2733
by Canonical.com Patch Queue Manager
Upload processor. r=stevea |
399 |
|
12611.3.1
by Abel Deuring
Disable POTemplate/POFile imports from source packages if upstream translation sharing is enabled. |
400 |
|
3691.441.21
by Malcolm Cleaton
More stuff |
401 |
class IPackageUploadSource(Interface): |
10529.1.6
by Jonathan Lange
Fewer mentions of lucille |
402 |
"""A Queue item's related sourcepackagereleases."""
|
1102
by Canonical.com Patch Queue Manager
Lucille had some XXXs which should have been NOTEs |
403 |
|
404 |
id = Int( |
|
2713
by Canonical.com Patch Queue Manager
Various fixes to queue, build etc. add zcml for queue, DB patch included. r=stevea,stub. Also fix dbschema security proxy bug (bug 1971) r=stevea |
405 |
title=_("ID"), required=True, readonly=True, |
1102
by Canonical.com Patch Queue Manager
Lucille had some XXXs which should have been NOTEs |
406 |
)
|
407 |
||
3691.441.21
by Malcolm Cleaton
More stuff |
408 |
packageupload = Int( |
409 |
title=_("PackageUpload"), required=True, |
|
2713
by Canonical.com Patch Queue Manager
Various fixes to queue, build etc. add zcml for queue, DB patch included. r=stevea,stub. Also fix dbschema security proxy bug (bug 1971) r=stevea |
410 |
readonly=False, |
1102
by Canonical.com Patch Queue Manager
Lucille had some XXXs which should have been NOTEs |
411 |
)
|
412 |
||
413 |
sourcepackagerelease = Int( |
|
2713
by Canonical.com Patch Queue Manager
Various fixes to queue, build etc. add zcml for queue, DB patch included. r=stevea,stub. Also fix dbschema security proxy bug (bug 1971) r=stevea |
414 |
title=_("The related source package release"), required=True, |
415 |
readonly=False, |
|
416 |
)
|
|
3691.442.27
by Celso Providelo
applying review comments (r=jamesh) |
417 |
|
6149.4.2
by Celso Providelo
Requesting Diffs in upload-time. |
418 |
def getSourceAncestry(): |
419 |
"""Return a suitable ancestry publication for this context.
|
|
420 |
||
421 |
The possible ancestries locations for a give source upload, assuming
|
|
422 |
that only PRIMARY archive allows post-RELEASE pockets are:
|
|
423 |
||
6455.1.2
by Celso Providelo
applying review comments, r=barry. |
424 |
1. original archive, original distroseries and pocket (old
|
7675.235.5
by Celso Providelo
applying review comments, r=abentley. |
425 |
DEVELOPMENT/SRU/PPA uploads).
|
6455.1.2
by Celso Providelo
applying review comments, r=barry. |
426 |
2. primary archive, original distroseries and release pocket (NEW
|
7675.235.5
by Celso Providelo
applying review comments, r=abentley. |
427 |
SRU/PPA uploads fallback).
|
6455.1.2
by Celso Providelo
applying review comments, r=barry. |
428 |
3. primary_archive, any distroseries and release pocket (BACKPORTS)
|
6149.4.2
by Celso Providelo
Requesting Diffs in upload-time. |
429 |
|
430 |
We lookup a source publication with the same name in those location
|
|
431 |
and in that order. If an ancestry is found it is returned, otherwise
|
|
432 |
it returns None.
|
|
433 |
||
6455.1.2
by Celso Providelo
applying review comments, r=barry. |
434 |
:return: `ISourcePackagePublishingHistory` for the corresponding
|
6149.4.2
by Celso Providelo
Requesting Diffs in upload-time. |
435 |
ancestry or None if it wasn't found.
|
436 |
"""
|
|
437 |
||
4359.1.7
by Celso Providelo
Using a more AOP (informally) approach to identify archive inconsistencies in PackageUpload time. Introducing PackageUploadSource.{checkBeforeAccepted, checkBeforePublish} methods. |
438 |
def verifyBeforeAccept(): |
439 |
"""Perform overall checks before promoting source to ACCEPTED queue.
|
|
4359.1.1
by Celso Providelo
Code fix for bug #119753, pending tests. |
440 |
|
441 |
If two queue items have the same (name, version) pair there is
|
|
4359.1.7
by Celso Providelo
Using a more AOP (informally) approach to identify archive inconsistencies in PackageUpload time. Introducing PackageUploadSource.{checkBeforeAccepted, checkBeforePublish} methods. |
442 |
an inconsistency. To identify this situation we check the accepted
|
443 |
& done queue items for each distroseries for such duplicates and
|
|
444 |
raise an exception if any are found.
|
|
445 |
See bug #31038 & #62976 for details.
|
|
446 |
"""
|
|
447 |
||
448 |
def verifyBeforePublish(): |
|
449 |
"""Perform overall checks before publishing a source queue record.
|
|
450 |
||
4359.1.9
by Celso Providelo
more review comments (r=flacoste). |
451 |
Check if the source package files do not collide with the
|
4359.1.1
by Celso Providelo
Code fix for bug #119753, pending tests. |
452 |
ones already published in the archive. We need this to catch
|
453 |
inaccurate *epoched* versions, which would pass the upload version
|
|
4359.1.9
by Celso Providelo
more review comments (r=flacoste). |
454 |
check but would collide with diff(s) or dsc(s) previously published
|
455 |
on disk. This inconsistency is well known in debian-like archives
|
|
4359.1.7
by Celso Providelo
Using a more AOP (informally) approach to identify archive inconsistencies in PackageUpload time. Introducing PackageUploadSource.{checkBeforeAccepted, checkBeforePublish} methods. |
456 |
and happens because filenames do not contain epoch. For further
|
457 |
information see bug #119753.
|
|
4359.1.1
by Celso Providelo
Code fix for bug #119753, pending tests. |
458 |
"""
|
459 |
||
2865.2.22
by Celso Providelo
Land state-machine for DRQ content class, deny direcly write access for DRQ.status, fix tests and callsites properly, reduce soyuz-upload test verbosity. |
460 |
def checkComponentAndSection(): |
461 |
"""Verify the current Component and Section via Selection table.
|
|
462 |
||
463 |
Check if the current sourcepackagerelease component and section
|
|
4285.2.1
by Mark Shuttleworth
Massive renaming of distrorelease to distroseries |
464 |
matches with those included in the target distribution series,
|
2865.2.22
by Celso Providelo
Land state-machine for DRQ content class, deny direcly write access for DRQ.status, fix tests and callsites properly, reduce soyuz-upload test verbosity. |
465 |
if not raise QueueSourceAcceptError exception.
|
466 |
"""
|
|
2713
by Canonical.com Patch Queue Manager
Various fixes to queue, build etc. add zcml for queue, DB patch included. r=stevea,stub. Also fix dbschema security proxy bug (bug 1971) r=stevea |
467 |
|
2756
by Canonical.com Patch Queue Manager
Queue-Accepted processor and some upload tweaks to fit it. r=stevea |
468 |
def publish(logger=None): |
4285.2.1
by Mark Shuttleworth
Massive renaming of distrorelease to distroseries |
469 |
"""Publish this queued source in the distroseries referred to by
|
2756
by Canonical.com Patch Queue Manager
Queue-Accepted processor and some upload tweaks to fit it. r=stevea |
470 |
the parent queue item.
|
471 |
||
472 |
Returns the secure source package publishing history object in case
|
|
473 |
it is of use to the caller.
|
|
474 |
||
475 |
If a logger is provided, information pertaining to the publishing
|
|
476 |
process will be logged to it.
|
|
477 |
"""
|
|
478 |
||
2733
by Canonical.com Patch Queue Manager
Upload processor. r=stevea |
479 |
|
3691.441.21
by Malcolm Cleaton
More stuff |
480 |
class IPackageUploadCustom(Interface): |
3500.3.49
by Celso Providelo
improve DRQC docstring, got definitive r=spiv |
481 |
"""Stores anything else than source and binaries that needs publication.
|
482 |
||
4285.2.1
by Mark Shuttleworth
Massive renaming of distrorelease to distroseries |
483 |
It is essentially a map between DistroSeries/Pocket/LibrarianFileAlias.
|
3500.3.49
by Celso Providelo
improve DRQC docstring, got definitive r=spiv |
484 |
|
485 |
The LibrarianFileAlias usually is a TGZ containing an specific format.
|
|
486 |
Currently we support:
|
|
487 |
[Debian-Installer, Rosetta-Translation, Dist-Upgrader, DDTP-Tarball]
|
|
488 |
||
489 |
Each one has an processor which is invoked by the publish method.
|
|
490 |
"""
|
|
2713
by Canonical.com Patch Queue Manager
Various fixes to queue, build etc. add zcml for queue, DB patch included. r=stevea,stub. Also fix dbschema security proxy bug (bug 1971) r=stevea |
491 |
|
492 |
id = Int( |
|
493 |
title=_("ID"), required=True, readonly=True, |
|
494 |
)
|
|
495 |
||
3691.441.21
by Malcolm Cleaton
More stuff |
496 |
packageupload = Int( |
497 |
title=_("PackageUpload"), required=True, |
|
2713
by Canonical.com Patch Queue Manager
Various fixes to queue, build etc. add zcml for queue, DB patch included. r=stevea,stub. Also fix dbschema security proxy bug (bug 1971) r=stevea |
498 |
readonly=False, |
499 |
)
|
|
500 |
||
501 |
customformat = Int( |
|
502 |
title=_("The custom format for the file"), required=True, |
|
503 |
readonly=False, |
|
504 |
)
|
|
505 |
||
506 |
libraryfilealias = Int( |
|
507 |
title=_("The file"), required=True, readonly=False, |
|
950
by Canonical.com Patch Queue Manager
Queue tables for Lucille |
508 |
)
|
509 |
||
3627.2.5
by Daniel Silverstone
temp_filename is no longer a property, use full_suite_name since it's not really a distroreleasename |
510 |
def temp_filename(): |
511 |
"""Return a filename containing the libraryfile for this upload.
|
|
512 |
||
513 |
This filename will be in a temporary directory and can be the
|
|
514 |
ensure dir can be deleted once whatever needed the file is finished
|
|
515 |
with it.
|
|
516 |
"""
|
|
517 |
||
2756
by Canonical.com Patch Queue Manager
Queue-Accepted processor and some upload tweaks to fit it. r=stevea |
518 |
def publish(logger=None): |
519 |
"""Publish this custom item directly into the filesystem.
|
|
520 |
||
521 |
This can only be run by a process which has filesystem access to
|
|
522 |
the archive (or wherever else the content will go).
|
|
523 |
||
524 |
If a logger is provided, information pertaining to the publishing
|
|
525 |
process will be logged to it.
|
|
526 |
"""
|
|
527 |
||
12611.3.1
by Abel Deuring
Disable POTemplate/POFile imports from source packages if upstream translation sharing is enabled. |
528 |
def publishDebianInstaller(logger=None): |
2756
by Canonical.com Patch Queue Manager
Queue-Accepted processor and some upload tweaks to fit it. r=stevea |
529 |
"""Publish this custom item as a raw installer tarball.
|
530 |
||
531 |
This will write the installer tarball out to the right part of
|
|
532 |
the archive.
|
|
533 |
||
534 |
If a logger is provided, information pertaining to the publishing
|
|
535 |
process will be logged to it.
|
|
536 |
"""
|
|
537 |
||
12611.3.1
by Abel Deuring
Disable POTemplate/POFile imports from source packages if upstream translation sharing is enabled. |
538 |
def publishDistUpgrader(logger=None): |
3147.2.37
by Celso Providelo
DistUpgraderUpload implementation and fixing some tests |
539 |
"""Publish this custom item as a raw dist-upgrader tarball.
|
540 |
||
541 |
This will write the dist-upgrader tarball out to the right part of
|
|
542 |
the archive.
|
|
543 |
||
544 |
If a logger is provided, information pertaining to the publishing
|
|
545 |
process will be logged to it.
|
|
546 |
"""
|
|
547 |
||
12611.3.1
by Abel Deuring
Disable POTemplate/POFile imports from source packages if upstream translation sharing is enabled. |
548 |
def publishDdtpTarball(logger=None): |
3500.3.49
by Celso Providelo
improve DRQC docstring, got definitive r=spiv |
549 |
"""Publish this custom item as a raw ddtp-tarball.
|
550 |
||
551 |
This will write the ddtp-tarball out to the right part of
|
|
552 |
the archive.
|
|
553 |
||
554 |
If a logger is provided, information pertaining to the publishing
|
|
555 |
process will be logged to it.
|
|
556 |
"""
|
|
557 |
||
12611.3.1
by Abel Deuring
Disable POTemplate/POFile imports from source packages if upstream translation sharing is enabled. |
558 |
def publishRosettaTranslations(logger=None): |
2756
by Canonical.com Patch Queue Manager
Queue-Accepted processor and some upload tweaks to fit it. r=stevea |
559 |
"""Publish this custom item as a rosetta tarball.
|
560 |
||
561 |
Essentially this imports the tarball into rosetta.
|
|
562 |
||
563 |
If a logger is provided, information pertaining to the publishing
|
|
564 |
process will be logged to it.
|
|
565 |
"""
|
|
2865.2.31
by Celso Providelo
Infrasctructure for new queue plans, readding GPGV wrapper. |
566 |
|
12611.3.1
by Abel Deuring
Disable POTemplate/POFile imports from source packages if upstream translation sharing is enabled. |
567 |
def publishStaticTranslations(logger): |
8697.13.2
by Julian Edwards
Add interface declaration. |
568 |
"""Publish this custom item as a static translations tarball.
|
569 |
||
570 |
This is currently a no-op as we don't publish these files, they only
|
|
571 |
reside in the librarian for later retrieval using the webservice.
|
|
572 |
"""
|
|
573 |
||
12611.3.1
by Abel Deuring
Disable POTemplate/POFile imports from source packages if upstream translation sharing is enabled. |
574 |
def publishMetaData(logger): |
11015.1.4
by Julian Edwards
Add the interface definition for publish_META_DATA |
575 |
"""Publish this custom item as a meta-data file.
|
576 |
||
577 |
This method writes the meta-data custom file to the archive in
|
|
578 |
the location matching this schema:
|
|
579 |
/<person>/meta/<ppa_name>/<filename>
|
|
580 |
||
581 |
It's not written to the main archive location because that could be
|
|
582 |
protected by htaccess in the case of private archives.
|
|
583 |
"""
|
|
584 |
||
8697.13.2
by Julian Edwards
Add interface declaration. |
585 |
|
3691.441.21
by Malcolm Cleaton
More stuff |
586 |
class IPackageUploadSet(Interface): |
587 |
"""Represents a set of IPackageUploads"""
|
|
2865.2.31
by Celso Providelo
Infrasctructure for new queue plans, readding GPGV wrapper. |
588 |
|
589 |
def __iter__(): |
|
3691.441.21
by Malcolm Cleaton
More stuff |
590 |
"""IPackageUpload iterator"""
|
2865.2.31
by Celso Providelo
Infrasctructure for new queue plans, readding GPGV wrapper. |
591 |
|
592 |
def __getitem__(queue_id): |
|
3691.441.21
by Malcolm Cleaton
More stuff |
593 |
"""Retrieve an IPackageUpload by a given id"""
|
2865.2.31
by Celso Providelo
Infrasctructure for new queue plans, readding GPGV wrapper. |
594 |
|
595 |
def get(queue_id): |
|
3691.441.21
by Malcolm Cleaton
More stuff |
596 |
"""Retrieve an IPackageUpload by a given id"""
|
2865.2.31
by Celso Providelo
Infrasctructure for new queue plans, readding GPGV wrapper. |
597 |
|
4285.2.1
by Mark Shuttleworth
Massive renaming of distrorelease to distroseries |
598 |
def count(status=None, distroseries=None, pocket=None): |
3691.441.21
by Malcolm Cleaton
More stuff |
599 |
"""Number of IPackageUpload present in a given status.
|
2865.2.31
by Celso Providelo
Infrasctructure for new queue plans, readding GPGV wrapper. |
600 |
|
2865.2.49
by Celso Providelo
Fix IDistroReleaseQueue.count() to accept an optional distrorelease argument, use this feature in queue tool to display a proper queue counter. |
601 |
If status is ommitted return the number of all entries.
|
4285.2.1
by Mark Shuttleworth
Massive renaming of distrorelease to distroseries |
602 |
'distroseries' is optional and restrict the results in given
|
603 |
distroseries, same for pocket.
|
|
2865.2.31
by Celso Providelo
Infrasctructure for new queue plans, readding GPGV wrapper. |
604 |
"""
|
3147.2.75
by Celso Providelo
Converge IDistroRelease.getFancyQueueItem in IHasQueueItems.getQueueItem, experimental 'View Queue' page for Distroreleases, IDRQ.queue_icon attribute and test fixing. |
605 |
|
7675.218.1
by Celso Providelo
Creating PackageUploadSet.createDelayedCopy() and adjusting PackageUpload to use its 'date_created' DB column instead of the property based on the changesfile creation date. |
606 |
def createDelayedCopy(archive, distroseries, pocket, signing_key): |
607 |
"""Return a `PackageUpload` record for a delayed-copy operation.
|
|
608 |
||
609 |
:param archive: target `IArchive`,
|
|
610 |
:param distroseries: target `IDistroSeries`,
|
|
611 |
:param pocket: target `PackagePublishingPocket`,
|
|
612 |
:param signing_key: `IGPGKey` of the user requesting this copy.
|
|
613 |
||
614 |
:return: an `IPackageUpload` record in NEW state.
|
|
615 |
"""
|
|
616 |
||
8697.13.13
by Julian Edwards
Move getPackageUploads to the PackageUploadSet utility. |
617 |
def getAll(distroseries, created_since_date=None, status=None, |
13194.1.8
by Jeroen Vermeulen
Update interface for package name filter. |
618 |
archive=None, pocket=None, custom_type=None, |
13222.3.2
by Jeroen Vermeulen
Refactored a bit to facilitate version match. |
619 |
name=None, version=None, exact_match=False): |
8697.13.13
by Julian Edwards
Move getPackageUploads to the PackageUploadSet utility. |
620 |
"""Get package upload records for a series with optional filtering.
|
621 |
||
13636.4.2
by Raphael Badin
Also limit the checks to the optional source names selected for the initialization. |
622 |
:param distroseries: the `IDistroSeries` to consider.
|
13233.3.5
by Jeroen Vermeulen
Cosmetic. |
623 |
:param status: Filter results by this `PackageUploadStatus`, or list
|
624 |
of statuses.
|
|
8697.13.13
by Julian Edwards
Move getPackageUploads to the PackageUploadSet utility. |
625 |
:param created_since_date: If specified, only returns items uploaded
|
626 |
since the timestamp supplied.
|
|
627 |
:param archive: Filter results for this `IArchive`
|
|
628 |
:param pocket: Filter results by this `PackagePublishingPocket`
|
|
629 |
:param custom_type: Filter results by this `PackageUploadCustomFormat`
|
|
13222.3.1
by Jeroen Vermeulen
Full name-substring match. |
630 |
:param name: Filter results by this package or file name.
|
631 |
:param version: Filter results by this version number string.
|
|
632 |
:param exact_match: If True, look for exact string matches on the
|
|
633 |
`name` and `version` filters. If False, look for a substring
|
|
634 |
match so that e.g. a package "kspreadsheetplusplus" would match
|
|
635 |
the search string "spreadsheet". Defaults to False.
|
|
8697.13.13
by Julian Edwards
Move getPackageUploads to the PackageUploadSet utility. |
636 |
:return: A result set containing `IPackageUpload`s
|
637 |
"""
|
|
638 |
||
8750.2.1
by Celso Providelo
Isolating upload queue conflict detection code, so it can be used while checking delayed copy candidates. |
639 |
def findSourceUpload(name, version, archive, distribution): |
640 |
"""Return a `PackageUpload` for a matching source.
|
|
641 |
||
642 |
:param name: a string with the exact source name.
|
|
643 |
:param version: a string with the exact source version.
|
|
644 |
:param archive: source upload target `IArchive`.
|
|
645 |
:param distribution: source upload target `IDistribution`.
|
|
646 |
||
647 |
:return: a matching `IPackageUpload` object.
|
|
648 |
"""
|
|
649 |
||
13636.4.12
by Raphael Badin
Fix interface. |
650 |
def getBuildsForSources(distroseries, status=None, pockets=None, |
13636.4.2
by Raphael Badin
Also limit the checks to the optional source names selected for the initialization. |
651 |
names=None): |
13636.4.9
by Raphael Badin
Fix branch as per MP's comments. |
652 |
"""Return binary package upload records for a series with optional
|
13636.4.2
by Raphael Badin
Also limit the checks to the optional source names selected for the initialization. |
653 |
filtering.
|
654 |
||
655 |
:param distroseries: the `IDistroSeries` to consider.
|
|
13636.4.3
by Raphael Badin
Fix doc. |
656 |
:param status: Filter results by this list of `PackageUploadStatus`s.
|
13636.4.2
by Raphael Badin
Also limit the checks to the optional source names selected for the initialization. |
657 |
:param pockets: Filter results by this list of
|
13636.4.3
by Raphael Badin
Fix doc. |
658 |
`PackagePublishingPocket`s.
|
13636.4.2
by Raphael Badin
Also limit the checks to the optional source names selected for the initialization. |
659 |
:param names: Filter results by this list of package names.
|
660 |
||
661 |
:return: A result set containing `IPackageUpload`s.
|
|
662 |
"""
|
|
663 |
||
6557.3.1
by Julian Edwards
Pre-fetch package upload builds and remove a query caused by count() in |
664 |
def getBuildByBuildIDs(build_ids): |
665 |
"""Return `PackageUploadBuilds`s for the supplied build IDs."""
|
|
666 |
||
6557.3.4
by Julian Edwards
Speed up display of source uploads. |
667 |
def getSourceBySourcePackageReleaseIDs(spr_ids): |
668 |
"""Return `PackageUploadSource`s for the sourcepackagerelease IDs."""
|
|
669 |
||
7675.1191.14
by Julian Edwards
Add getByPackageCopyJobIDs |
670 |
def getByPackageCopyJobIDs(pcj_ids): |
671 |
"""Return `PackageUpload`s using `PackageCopyJob`s.
|
|
672 |
||
673 |
:param pcj_ids: A list of `PackageCopyJob` IDs.
|
|
674 |
:return: all the `PackageUpload`s that reference the supplied IDs.
|
|
675 |
"""
|
|
676 |
||
6557.3.1
by Julian Edwards
Pre-fetch package upload builds and remove a query caused by count() in |
677 |
|
3147.2.75
by Celso Providelo
Converge IDistroRelease.getFancyQueueItem in IHasQueueItems.getQueueItem, experimental 'View Queue' page for Distroreleases, IDRQ.queue_icon attribute and test fixing. |
678 |
class IHasQueueItems(Interface): |
679 |
"""An Object that has queue items"""
|
|
680 |
||
3496.1.120
by Celso Providelo
unify the permissions for a DistroReleaseQueue in an abstract model called IPackageUploadQueue. |
681 |
def getPackageUploadQueue(state): |
682 |
"""Return an IPackageUploadeQueue occording the given state."""
|