10
10
'IDistroSeriesDifference',
11
'IDistroSeriesDifferenceAdmin',
11
12
'IDistroSeriesDifferencePublic',
12
13
'IDistroSeriesDifferenceEdit',
13
14
'IDistroSeriesDifferenceSource',
55
59
derived_series = exported(Reference(
56
60
IDistroSeries, title=_("Derived series"), required=True,
57
61
readonly=True, description=_(
58
"The distribution series which, together with its parent, "
59
"identifies the two series with the difference.")))
62
"The distribution series which identifies the derived series "
63
"with the difference.")))
65
parent_series = exported(Reference(
66
IDistroSeries, title=_("Parent series"), required=True,
67
readonly=True, description=_(
68
"The distribution series which identifies the parent series "
69
"with the difference.")))
61
71
source_package_name = Reference(
62
72
ISourcePackageName,
177
187
title=_("Title"), readonly=True, required=False, description=_(
178
188
"A human-readable name describing this difference."))
190
packagesets = Attribute("The packagesets for this source package in the "
193
parent_packagesets = Attribute("The packagesets for this source package "
194
"in the parent series.")
196
def update(manual=False):
181
197
"""Checks that difference type and status matches current publishings.
183
199
If the record is updated, a relevant comment is added.
185
201
If there is no longer a difference (ie. the versions are
186
202
the same) then the status is updated to RESOLVED.
204
:param manual: Boolean, True if this is a user-requested change.
205
This overrides auto-blacklisting.
188
206
:return: True if the record was updated, False otherwise.
191
209
latest_comment = Reference(
192
Interface, # IDistroSeriesDifferenceComment
210
Interface, # IDistroSeriesDifferenceComment
193
211
title=_("The latest comment"),
196
214
def getComments():
197
215
"""Return a result set of the comments for this difference."""
199
def getPackageSets():
200
"""Return a result set of the derived series packagesets for the
201
sourcepackagename of this difference.
204
def getParentPackageSets():
205
"""Return a result set of the parent packagesets for the
206
sourcepackagename of this difference.
210
218
class IDistroSeriesDifferenceEdit(Interface):
211
219
"""Difference attributes requiring launchpad.Edit."""
217
225
def addComment(commenter, comment):
218
226
"""Add a comment on this difference."""
228
@call_with(requestor=REQUEST_USER)
229
@export_write_operation()
230
def requestPackageDiffs(requestor):
231
"""Requests IPackageDiffs for the derived and parent version.
233
:raises DistroSeriesDifferenceError: When package diffs
237
class IDistroSeriesDifferenceAdmin(Interface):
238
"""Difference attributes requiring launchpad.Admin."""
220
240
@operation_parameters(
221
241
all=Bool(title=_("All"), required=False))
222
242
@export_write_operation()
234
254
The status will be updated based on the versions.
237
@call_with(requestor=REQUEST_USER)
238
@export_write_operation()
239
def requestPackageDiffs(requestor):
240
"""Requests IPackageDiffs for the derived and parent version.
242
:raises DistroSeriesDifferenceError: When package diffs
247
258
class IDistroSeriesDifference(IDistroSeriesDifferencePublic,
248
IDistroSeriesDifferenceEdit):
259
IDistroSeriesDifferenceEdit,
260
IDistroSeriesDifferenceAdmin):
249
261
"""An interface for a package difference between two distroseries."""
250
262
export_as_webservice_entry()
253
265
class IDistroSeriesDifferenceSource(Interface):
254
266
"""A utility of this interface can be used to create differences."""
256
def new(derived_series, source_package_name):
268
def new(derived_series, source_package_name, parent_series=None):
257
269
"""Create an `IDistroSeriesDifference`.
259
271
:param derived_series: The distribution series which was derived
263
275
:param source_package_name: A source package name identifying the
264
276
package with a difference.
265
277
:type source_package_name: `ISourcePackageName`.
278
:param parent_series: The distribution series which has the derived
279
series as a child. If there is only one parent, it does not need
281
:type parent_series: `IDistroSeries`.
266
282
:raises NotADerivedSeriesError: When the passed distro series
267
283
is not a derived series.
268
284
:return: A new `DistroSeriesDifference` object.
271
287
def getForDistroSeries(
273
difference_type=DistroSeriesDifferenceType.DIFFERENT_VERSIONS,
289
difference_type=None,
274
290
source_package_name_filter=None,
276
child_version_higher=False):
292
child_version_higher=False,
277
294
"""Return differences for the derived distro series sorted by
291
308
:param child_version_higher: Only differences for which the child's
292
309
version is higher than the parent's version will be included.
293
310
:type child_version_higher: bool.
294
:return: A result set of differences.
311
:param parent_series: The parent series to consider. Consider all
312
parent series if this parameter is None.
313
:type distro_series: `IDistroSeries`.
314
:return: A result set of `IDistroSeriesDifference`.
297
def getByDistroSeriesAndName(distro_series, source_package_name):
298
"""Returns a single difference matching the series and name.
317
def getByDistroSeriesNameAndParentSeries(distro_series,
320
"""Returns a single difference matching the series, name and parent
300
323
:param distro_series: The derived distribution series which is to be
301
324
searched for differences.
302
325
:type distro_series: `IDistroSeries`.
303
326
:param source_package_name: The name of the package difference.
304
327
:type source_package_name: unicode.
328
:param parent_series: The parent distribution series of the package
330
:type distro_series: `IDistroSeries`.
333
def getSimpleUpgrades(distro_series):
334
"""Find pending upgrades that can be performed mindlessly.
336
These are `DistroSeriesDifferences` where the parent has been
337
updated and the child still has the old version, unchanged.
339
Blacklisted items are excluded.
342
def collateDifferencesByParentArchive(differences):
343
"""Collate the given differences by parent archive.
345
The given `IDistroSeriesDifference`s are returned in a `dict`, with
346
the parent `Archive` as keys.
348
:param differences: An iterable sequence of `IDistroSeriesDifference`.
350
:return: A `dict` of iterable sequences of `IDistroSeriesDifference`
351
keyed by their parent `IArchive`.