8687.15.17
by Karl Fogel
Add the copyright header block to the rest of the files under lib/lp/. |
1 |
# Copyright 2009 Canonical Ltd. This software is licensed under the
|
2 |
# GNU Affero General Public License version 3 (see the file LICENSE).
|
|
3 |
||
4983.1.2
by Curtis Hovey
Added pylint exceptions to database classes. |
4 |
# pylint: disable-msg=E0611,W0212
|
2705
by Canonical.com Patch Queue Manager
r=spiv, mark's soyuz loving. |
5 |
|
6 |
"""Classes to represent binary package releases in a
|
|
7 |
distributionarchitecture release."""
|
|
8 |
||
9 |
__metaclass__ = type |
|
10 |
||
11 |
__all__ = [ |
|
4285.2.1
by Mark Shuttleworth
Massive renaming of distrorelease to distroseries |
12 |
'DistroArchSeriesBinaryPackageRelease', |
2705
by Canonical.com Patch Queue Manager
r=spiv, mark's soyuz loving. |
13 |
]
|
14 |
||
15 |
from zope.interface import implements |
|
16 |
||
11403.1.4
by Henning Eggers
Reformatted imports using format-imports script r32. |
17 |
from canonical.database.sqlbase import sqlvalues |
14550.1.1
by Steve Kowalik
Run format-imports over lib/lp and lib/canonical/launchpad |
18 |
from lp.soyuz.enums import PackagePublishingStatus |
8294.6.1
by Julian Edwards
First stab at code-reorg. Still got a discrepancy on stuff I assigned to registry but not migrated yet. |
19 |
from lp.soyuz.interfaces.distroarchseriesbinarypackagerelease import ( |
11403.1.4
by Henning Eggers
Reformatted imports using format-imports script r32. |
20 |
IDistroArchSeriesBinaryPackageRelease, |
21 |
)
|
|
8294.6.1
by Julian Edwards
First stab at code-reorg. Still got a discrepancy on stuff I assigned to registry but not migrated yet. |
22 |
from lp.soyuz.model.distributionsourcepackagerelease import ( |
11403.1.4
by Henning Eggers
Reformatted imports using format-imports script r32. |
23 |
DistributionSourcePackageRelease, |
24 |
)
|
|
25 |
from lp.soyuz.model.publishing import BinaryPackagePublishingHistory |
|
26 |
||
2705
by Canonical.com Patch Queue Manager
r=spiv, mark's soyuz loving. |
27 |
|
4285.2.1
by Mark Shuttleworth
Massive renaming of distrorelease to distroseries |
28 |
class DistroArchSeriesBinaryPackageRelease: |
29 |
||
30 |
implements(IDistroArchSeriesBinaryPackageRelease) |
|
31 |
||
32 |
def __init__(self, distroarchseries, binarypackagerelease): |
|
33 |
self.distroarchseries = distroarchseries |
|
2705
by Canonical.com Patch Queue Manager
r=spiv, mark's soyuz loving. |
34 |
self.binarypackagerelease = binarypackagerelease |
35 |
||
36 |
@property
|
|
37 |
def name(self): |
|
6476.3.18
by Matthew Paul Thomas
Applies fixes from Julian Edwards' review. |
38 |
"""See `IDistroArchSeriesBinaryPackageRelease`."""
|
2705
by Canonical.com Patch Queue Manager
r=spiv, mark's soyuz loving. |
39 |
return self.binarypackagerelease.binarypackagename.name |
40 |
||
41 |
@property
|
|
42 |
def version(self): |
|
6476.3.18
by Matthew Paul Thomas
Applies fixes from Julian Edwards' review. |
43 |
"""See `IDistroArchSeriesBinaryPackageRelease`."""
|
2705
by Canonical.com Patch Queue Manager
r=spiv, mark's soyuz loving. |
44 |
return self.binarypackagerelease.version |
45 |
||
46 |
@property
|
|
4285.2.1
by Mark Shuttleworth
Massive renaming of distrorelease to distroseries |
47 |
def distroseries(self): |
6476.3.18
by Matthew Paul Thomas
Applies fixes from Julian Edwards' review. |
48 |
"""See `IDistroArchSeriesBinaryPackageRelease`."""
|
4285.2.1
by Mark Shuttleworth
Massive renaming of distrorelease to distroseries |
49 |
return self.distroarchseries.distroseries |
2705
by Canonical.com Patch Queue Manager
r=spiv, mark's soyuz loving. |
50 |
|
51 |
@property
|
|
52 |
def distribution(self): |
|
6476.3.18
by Matthew Paul Thomas
Applies fixes from Julian Edwards' review. |
53 |
"""See `IDistroArchSeriesBinaryPackageRelease`."""
|
4285.2.1
by Mark Shuttleworth
Massive renaming of distrorelease to distroseries |
54 |
return self.distroarchseries.distroseries.distribution |
2705
by Canonical.com Patch Queue Manager
r=spiv, mark's soyuz loving. |
55 |
|
56 |
@property
|
|
57 |
def displayname(self): |
|
6476.3.18
by Matthew Paul Thomas
Applies fixes from Julian Edwards' review. |
58 |
"""See `IDistroArchSeriesBinaryPackageRelease`."""
|
2705
by Canonical.com Patch Queue Manager
r=spiv, mark's soyuz loving. |
59 |
return '%s %s' % (self.name, self.version) |
60 |
||
61 |
@property
|
|
62 |
def title(self): |
|
6476.3.18
by Matthew Paul Thomas
Applies fixes from Julian Edwards' review. |
63 |
"""See `IDistroArchSeriesBinaryPackageRelease`."""
|
2705
by Canonical.com Patch Queue Manager
r=spiv, mark's soyuz loving. |
64 |
return '%s %s (%s binary) in %s %s' % ( |
4285.2.1
by Mark Shuttleworth
Massive renaming of distrorelease to distroseries |
65 |
self.name, self.version, self.distroarchseries.architecturetag, |
66 |
self.distribution.name, self.distroseries.name) |
|
2705
by Canonical.com Patch Queue Manager
r=spiv, mark's soyuz loving. |
67 |
|
68 |
@property
|
|
69 |
def distributionsourcepackagerelease(self): |
|
6476.3.18
by Matthew Paul Thomas
Applies fixes from Julian Edwards' review. |
70 |
"""See `IDistroArchSeriesBinaryPackageRelease`."""
|
2705
by Canonical.com Patch Queue Manager
r=spiv, mark's soyuz loving. |
71 |
return DistributionSourcePackageRelease( |
72 |
self.distribution, |
|
7675.687.93
by Michael Nelson
distroarchseries.txt |
73 |
self.build.source_package_release) |
2705
by Canonical.com Patch Queue Manager
r=spiv, mark's soyuz loving. |
74 |
|
6476.3.7
by Matthew Paul Thomas
Adds distroarchseriesbinarypackage property. Code from Celso Providelo. |
75 |
@property
|
76 |
def distroarchseriesbinarypackage(self): |
|
6476.3.18
by Matthew Paul Thomas
Applies fixes from Julian Edwards' review. |
77 |
"""See `IDistroArchSeriesBinaryPackage`."""
|
6476.3.7
by Matthew Paul Thomas
Adds distroarchseriesbinarypackage property. Code from Celso Providelo. |
78 |
return self.distroarchseries.getBinaryPackage( |
79 |
self.binarypackagename) |
|
80 |
||
4664.1.1
by Curtis Hovey
Normalized comments for bug 3732. |
81 |
# XXX: kiko, 2006-02-01: I'd like to rename this to
|
3024.1.14
by Christian Reis
Attempt to fix distroarchreleasebinarypackagerelease's idea of status (and current_published_record) which at the moment harcodes status to PUBLISHED always -- some packages just aren't published, uhh.. |
82 |
# current_published_publishing_record, because that's what it
|
83 |
# returns, but I don't want to do that right now.
|
|
2705
by Canonical.com Patch Queue Manager
r=spiv, mark's soyuz loving. |
84 |
@property
|
85 |
def current_publishing_record(self): |
|
6476.3.18
by Matthew Paul Thomas
Applies fixes from Julian Edwards' review. |
86 |
"""See `IDistroArchSeriesBinaryPackageRelease`."""
|
5890.1.1
by Celso Providelo
Partially fixing bug #180218 (Override race-conditions). First we will consider PENDING publishing records as PUBLISHED for all override related operations. |
87 |
status = [ |
88 |
PackagePublishingStatus.PENDING, |
|
89 |
PackagePublishingStatus.PUBLISHED] |
|
3024.1.14
by Christian Reis
Attempt to fix distroarchreleasebinarypackagerelease's idea of status (and current_published_record) which at the moment harcodes status to PUBLISHED always -- some packages just aren't published, uhh.. |
90 |
record = self._latest_publishing_record(status=status) |
91 |
return record |
|
92 |
||
3500.4.27
by Celso Providelo
applying review comments, r=kiko. |
93 |
# XXX cprov 20071026: heavy queries should be moved near to the related
|
94 |
# content classes in order to be better maintained. In this specific case
|
|
95 |
# the publishing queries should live in publishing.py.
|
|
3024.1.16
by Christian Reis
Add a test to ensure this thing stays fixed |
96 |
def _latest_publishing_record(self, status=None): |
5890.1.1
by Celso Providelo
Partially fixing bug #180218 (Override race-conditions). First we will consider PENDING publishing records as PUBLISHED for all override related operations. |
97 |
query = """ |
98 |
binarypackagerelease = %s AND |
|
99 |
distroarchseries = %s AND |
|
100 |
archive IN %s |
|
101 |
""" % sqlvalues(self.binarypackagerelease, self.distroarchseries, |
|
102 |
self.distribution.all_distro_archive_ids) |
|
103 |
||
3024.1.14
by Christian Reis
Attempt to fix distroarchreleasebinarypackagerelease's idea of status (and current_published_record) which at the moment harcodes status to PUBLISHED always -- some packages just aren't published, uhh.. |
104 |
if status is not None: |
5890.1.1
by Celso Providelo
Partially fixing bug #180218 (Override race-conditions). First we will consider PENDING publishing records as PUBLISHED for all override related operations. |
105 |
if not isinstance(status, list): |
106 |
status = [status] |
|
107 |
query += " AND status IN %s" % sqlvalues(status) |
|
3024.1.14
by Christian Reis
Attempt to fix distroarchreleasebinarypackagerelease's idea of status (and current_published_record) which at the moment harcodes status to PUBLISHED always -- some packages just aren't published, uhh.. |
108 |
|
1716.5.54
by kiko
Fix for bug 28615: Errors accessing linux-source-2.6.15 package releases. The DARBPR details portlet's data came from a query that didn't consider Removed packages, which of course are legal. Added test and fixed query |
109 |
return BinaryPackagePublishingHistory.selectFirst( |
3500.4.21
by Celso Providelo
More reliable ordering when inspecting publishing records from DRSPR and DASBPR. Using -datecreated and disambiguating with -id (yes, sampledata sucks and has duplicated datecreated). |
110 |
query, orderBy=['-datecreated', '-id']) |
2705
by Canonical.com Patch Queue Manager
r=spiv, mark's soyuz loving. |
111 |
|
112 |
@property
|
|
113 |
def publishing_history(self): |
|
6476.3.18
by Matthew Paul Thomas
Applies fixes from Julian Edwards' review. |
114 |
"""See `IDistroArchSeriesBinaryPackage`."""
|
2705
by Canonical.com Patch Queue Manager
r=spiv, mark's soyuz loving. |
115 |
return BinaryPackagePublishingHistory.select(""" |
5121.2.6
by Stuart Bishop
Some required code updates |
116 |
distroarchseries = %s AND |
4376.2.6
by Julian Edwards
Fix mistakes from previous commit. |
117 |
archive IN %s AND |
2705
by Canonical.com Patch Queue Manager
r=spiv, mark's soyuz loving. |
118 |
binarypackagerelease = %s |
4376.2.73
by Julian Edwards
Apply review comments. |
119 |
""" % sqlvalues( |
120 |
self.distroarchseries, |
|
121 |
self.distribution.all_distro_archive_ids, |
|
122 |
self.binarypackagerelease), |
|
3500.4.21
by Celso Providelo
More reliable ordering when inspecting publishing records from DRSPR and DASBPR. Using -datecreated and disambiguating with -id (yes, sampledata sucks and has duplicated datecreated). |
123 |
orderBy=['-datecreated', '-id']) |
2705
by Canonical.com Patch Queue Manager
r=spiv, mark's soyuz loving. |
124 |
|
125 |
@property
|
|
126 |
def pocket(self): |
|
6476.3.18
by Matthew Paul Thomas
Applies fixes from Julian Edwards' review. |
127 |
"""See `IDistroArchSeriesBinaryPackageRelease`."""
|
3024.1.14
by Christian Reis
Attempt to fix distroarchreleasebinarypackagerelease's idea of status (and current_published_record) which at the moment harcodes status to PUBLISHED always -- some packages just aren't published, uhh.. |
128 |
pub = self._latest_publishing_record() |
2705
by Canonical.com Patch Queue Manager
r=spiv, mark's soyuz loving. |
129 |
if pub is None: |
130 |
return None |
|
131 |
return pub.pocket |
|
132 |
||
133 |
@property
|
|
134 |
def status(self): |
|
6476.3.18
by Matthew Paul Thomas
Applies fixes from Julian Edwards' review. |
135 |
"""See `IDistroArchSeriesBinaryPackageRelease`."""
|
3024.1.14
by Christian Reis
Attempt to fix distroarchreleasebinarypackagerelease's idea of status (and current_published_record) which at the moment harcodes status to PUBLISHED always -- some packages just aren't published, uhh.. |
136 |
pub = self._latest_publishing_record() |
2705
by Canonical.com Patch Queue Manager
r=spiv, mark's soyuz loving. |
137 |
if pub is None: |
138 |
return None |
|
139 |
return pub.status |
|
140 |
||
141 |
@property
|
|
142 |
def section(self): |
|
6476.3.18
by Matthew Paul Thomas
Applies fixes from Julian Edwards' review. |
143 |
"""See `IDistroArchSeriesBinaryPackageRelease`."""
|
3024.1.14
by Christian Reis
Attempt to fix distroarchreleasebinarypackagerelease's idea of status (and current_published_record) which at the moment harcodes status to PUBLISHED always -- some packages just aren't published, uhh.. |
144 |
pub = self._latest_publishing_record() |
2705
by Canonical.com Patch Queue Manager
r=spiv, mark's soyuz loving. |
145 |
if pub is None: |
146 |
return None |
|
147 |
return pub.section |
|
148 |
||
149 |
@property
|
|
150 |
def component(self): |
|
6476.3.18
by Matthew Paul Thomas
Applies fixes from Julian Edwards' review. |
151 |
"""See `IDistroArchSeriesBinaryPackageRelease`."""
|
3024.1.14
by Christian Reis
Attempt to fix distroarchreleasebinarypackagerelease's idea of status (and current_published_record) which at the moment harcodes status to PUBLISHED always -- some packages just aren't published, uhh.. |
152 |
pub = self._latest_publishing_record() |
2705
by Canonical.com Patch Queue Manager
r=spiv, mark's soyuz loving. |
153 |
if pub is None: |
154 |
return None |
|
155 |
return pub.component |
|
156 |
||
157 |
@property
|
|
158 |
def priority(self): |
|
6476.3.18
by Matthew Paul Thomas
Applies fixes from Julian Edwards' review. |
159 |
"""See `IDistroArchSeriesBinaryPackageRelease`."""
|
3024.1.14
by Christian Reis
Attempt to fix distroarchreleasebinarypackagerelease's idea of status (and current_published_record) which at the moment harcodes status to PUBLISHED always -- some packages just aren't published, uhh.. |
160 |
pub = self._latest_publishing_record() |
2705
by Canonical.com Patch Queue Manager
r=spiv, mark's soyuz loving. |
161 |
if pub is None: |
162 |
return None |
|
163 |
return pub.priority |
|
164 |
||
165 |
# map the BinaryPackageRelease attributes up to this class so it
|
|
166 |
# responds to the same interface
|
|
167 |
||
168 |
@property
|
|
169 |
def binarypackagename(self): |
|
6476.3.18
by Matthew Paul Thomas
Applies fixes from Julian Edwards' review. |
170 |
"""See `IBinaryPackageRelease`."""
|
2705
by Canonical.com Patch Queue Manager
r=spiv, mark's soyuz loving. |
171 |
return self.binarypackagerelease.binarypackagename |
172 |
||
173 |
@property
|
|
174 |
def summary(self): |
|
6476.3.18
by Matthew Paul Thomas
Applies fixes from Julian Edwards' review. |
175 |
"""See `IBinaryPackageRelease`."""
|
2705
by Canonical.com Patch Queue Manager
r=spiv, mark's soyuz loving. |
176 |
return self.binarypackagerelease.summary |
177 |
||
178 |
@property
|
|
179 |
def description(self): |
|
6476.3.18
by Matthew Paul Thomas
Applies fixes from Julian Edwards' review. |
180 |
"""See `IBinaryPackageRelease`."""
|
2705
by Canonical.com Patch Queue Manager
r=spiv, mark's soyuz loving. |
181 |
return self.binarypackagerelease.description |
182 |
||
183 |
@property
|
|
184 |
def build(self): |
|
6476.3.18
by Matthew Paul Thomas
Applies fixes from Julian Edwards' review. |
185 |
"""See `IBinaryPackageRelease`."""
|
2705
by Canonical.com Patch Queue Manager
r=spiv, mark's soyuz loving. |
186 |
return self.binarypackagerelease.build |
187 |
||
188 |
@property
|
|
189 |
def binpackageformat(self): |
|
6476.3.18
by Matthew Paul Thomas
Applies fixes from Julian Edwards' review. |
190 |
"""See `IPackageRelease`."""
|
2705
by Canonical.com Patch Queue Manager
r=spiv, mark's soyuz loving. |
191 |
return self.binarypackagerelease.binpackageformat |
192 |
||
193 |
@property
|
|
194 |
def shlibdeps(self): |
|
6476.3.18
by Matthew Paul Thomas
Applies fixes from Julian Edwards' review. |
195 |
"""See `IBinaryPackageRelease`."""
|
2705
by Canonical.com Patch Queue Manager
r=spiv, mark's soyuz loving. |
196 |
return self.binarypackagerelease.shlibdeps |
197 |
||
198 |
@property
|
|
199 |
def depends(self): |
|
6476.3.18
by Matthew Paul Thomas
Applies fixes from Julian Edwards' review. |
200 |
"""See `IBinaryPackageRelease`."""
|
2705
by Canonical.com Patch Queue Manager
r=spiv, mark's soyuz loving. |
201 |
return self.binarypackagerelease.depends |
202 |
||
203 |
@property
|
|
204 |
def recommends(self): |
|
6476.3.18
by Matthew Paul Thomas
Applies fixes from Julian Edwards' review. |
205 |
"""See `IBinaryPackageRelease`."""
|
2705
by Canonical.com Patch Queue Manager
r=spiv, mark's soyuz loving. |
206 |
return self.binarypackagerelease.recommends |
207 |
||
208 |
@property
|
|
209 |
def replaces(self): |
|
6476.3.18
by Matthew Paul Thomas
Applies fixes from Julian Edwards' review. |
210 |
"""See `IBinaryPackageRelease`."""
|
2705
by Canonical.com Patch Queue Manager
r=spiv, mark's soyuz loving. |
211 |
return self.binarypackagerelease.replaces |
212 |
||
213 |
@property
|
|
214 |
def conflicts(self): |
|
6476.3.18
by Matthew Paul Thomas
Applies fixes from Julian Edwards' review. |
215 |
"""See `IBinaryPackageRelease`."""
|
2705
by Canonical.com Patch Queue Manager
r=spiv, mark's soyuz loving. |
216 |
return self.binarypackagerelease.conflicts |
217 |
||
218 |
@property
|
|
219 |
def provides(self): |
|
6476.3.18
by Matthew Paul Thomas
Applies fixes from Julian Edwards' review. |
220 |
"""See `IBinaryPackageRelease`."""
|
2705
by Canonical.com Patch Queue Manager
r=spiv, mark's soyuz loving. |
221 |
return self.binarypackagerelease.provides |
222 |
||
223 |
@property
|
|
224 |
def suggests(self): |
|
6476.3.18
by Matthew Paul Thomas
Applies fixes from Julian Edwards' review. |
225 |
"""See `IBinaryPackageRelease`."""
|
2705
by Canonical.com Patch Queue Manager
r=spiv, mark's soyuz loving. |
226 |
return self.binarypackagerelease.suggests |
227 |
||
228 |
@property
|
|
229 |
def essential(self): |
|
6476.3.18
by Matthew Paul Thomas
Applies fixes from Julian Edwards' review. |
230 |
"""See `IBinaryPackageRelease`."""
|
2705
by Canonical.com Patch Queue Manager
r=spiv, mark's soyuz loving. |
231 |
return self.binarypackagerelease.essential |
232 |
||
233 |
@property
|
|
234 |
def installedsize(self): |
|
6476.3.18
by Matthew Paul Thomas
Applies fixes from Julian Edwards' review. |
235 |
"""See `IBinaryPackageRelease`."""
|
2705
by Canonical.com Patch Queue Manager
r=spiv, mark's soyuz loving. |
236 |
return self.binarypackagerelease.installedsize |
237 |
||
238 |
@property
|
|
239 |
def architecturespecific(self): |
|
6476.3.18
by Matthew Paul Thomas
Applies fixes from Julian Edwards' review. |
240 |
"""See `IBinaryPackageRelease`."""
|
2705
by Canonical.com Patch Queue Manager
r=spiv, mark's soyuz loving. |
241 |
return self.binarypackagerelease.architecturespecific |
242 |
||
243 |
@property
|
|
244 |
def datecreated(self): |
|
6476.3.18
by Matthew Paul Thomas
Applies fixes from Julian Edwards' review. |
245 |
"""See `IBinaryPackageRelease`."""
|
2705
by Canonical.com Patch Queue Manager
r=spiv, mark's soyuz loving. |
246 |
return self.binarypackagerelease.datecreated |
247 |
||
248 |
@property
|
|
249 |
def files(self): |
|
6476.3.18
by Matthew Paul Thomas
Applies fixes from Julian Edwards' review. |
250 |
"""See `IBinaryPackageRelease`."""
|
2705
by Canonical.com Patch Queue Manager
r=spiv, mark's soyuz loving. |
251 |
return self.binarypackagerelease.files |