1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
|
# Copyright 2009-2010 Canonical Ltd. This software is licensed under the
# GNU Affero General Public License version 3 (see the file LICENSE).
# pylint: disable-msg=E0211,E0213
"""Source package release interfaces."""
__metaclass__ = type
__all__ = [
'ISourcePackageRelease',
'PackageDiffAlreadyRequestedError',
]
from lazr.restful.fields import Reference
from zope.interface import (
Attribute,
Interface,
)
from zope.schema import (
List,
TextLine,
)
from lp import _
class ISourcePackageRelease(Interface):
"""A source package release, e.g. apache-utils 2.0.48-3"""
id = Attribute("SourcePackageRelease identifier")
creatorID = Attribute("DB ID of creator")
creator = Attribute("Person that created this release")
maintainerID = Attribute("DB ID of the maintainer")
maintainer = Attribute("The person in general responsible for this "
"release")
version = Attribute("A version string")
dateuploaded = Attribute("Date of Upload")
urgency = Attribute("Source Package Urgency")
dscsigningkeyID = Attribute("DB ID of the DSC Signing Key")
dscsigningkey = Attribute("DSC Signing Key")
component = Attribute("Source Package Component")
format = Attribute("The Source Package Format")
changelog = Attribute("LibraryFileAlias containing debian/changelog.")
changelog_entry = Attribute("Source Package Change Log Entry")
change_summary = Attribute(
"The message on the latest change in this release. This is usually "
"a snippet from the changelog")
builddepends = TextLine(
title=_("DSC build depends"),
description=_("A comma-separated list of packages on which this "
"package depends to build"),
required=False)
builddependsindep = TextLine(
title=_("DSC build depends"),
description=_("Same as builddepends, but the list is of "
"arch-independent packages"),
required=False)
build_conflicts = TextLine(
title=_("DSC build conflicts"),
description=_("Binaries that will conflict when building this "
"source."),
required=False)
build_conflicts_indep = TextLine(
title=_("DSC arch-independent build conflicts"),
description=_("Same as build-conflicts but only lists "
"arch-independent binaries."),
required=False)
architecturehintlist = TextLine(
title=_("Architecture Hint List"),
description=_(
"Architectures where this packages is supposed to be built"),
required=True)
dsc_maintainer_rfc822 = TextLine(
title=_("DSC maintainers identification in RFC-822"),
description=_(
"Original maintainer line contained in the DSC file."),
required=True)
dsc_standards_version = TextLine(
title=_("DSC Standards version"),
description=_(
"DSC standards version used to build this source."),
required=True)
dsc_format = TextLine(
title=_("DSC format"),
description=_(
"DSC file format used to upload this source"),
required=True)
dsc_binaries = TextLine(
title=_("DSC proposed binaries"),
description=_(
"Binaries claimed to be generated by this source."),
required=True)
dsc = Attribute("The DSC file for this SourcePackageRelease")
copyright = Attribute(
"Copyright information for this SourcePackageRelease, if available.")
section = Attribute("Section this Source Package Release belongs to")
builds = Attribute("Builds for this sourcepackagerelease excluding PPA "
"archives.")
files = Attribute("IBinaryPackageFile entries for this "
"sourcepackagerelease")
sourcepackagename = Attribute("SourcePackageName table reference")
sourcepackagenameID = Attribute("SourcePackageName id.")
upload_distroseries = Attribute("The distroseries in which this package "
"was first uploaded in Launchpad")
publishings = Attribute("MultipleJoin on SourcepackagePublishing")
user_defined_fields = List(
title=_("Sequence of user-defined fields as key-value pairs."))
homepage = TextLine(
title=_("Homepage"),
description=_(
"Upstream project homepage as set in the package. This URL is not "
"sanitized."),
required=False)
# read-only properties
name = Attribute('The sourcepackagename for this release, as text')
title = Attribute('The title of this sourcepackagerelease')
age = Attribute('Time passed since the source package release '
'is present in Launchpad')
latest_build = Attribute("The latest build of this source package "
"release, or None")
failed_builds = Attribute("A (potentially empty) list of build "
"failures that happened for this source package " "release, or None")
needs_building = Attribute(
"A boolean that indicates whether this package still needs to be "
"built (on any architecture)")
sourcepackage = Attribute(
"The magic SourcePackage for the sourcepackagename and "
"distroseries of this object.")
distrosourcepackage = Attribute(
"The magic DistroSourcePackage for the sourcepackagename and "
"distribution of this object.")
productrelease = Attribute("The best guess we have as to the Launchpad "
"ProductRelease associated with this SourcePackageRelease.")
current_publishings = Attribute("A list of the current places where "
"this source package is published, in the form of a list of "
"DistroSeriesSourcePackageReleases.")
published_archives = Attribute("A set of all the archives that this "
"source package is published in.")
upload_archive = Attribute(
"The archive for which this package was first uploaded in Launchpad")
upload_changesfile = Attribute(
"The `LibraryFileAlias` object containing the changes file which "
"was originally uploaded with this source package release. It's "
"'None' if it is a source imported by Gina.")
package_upload = Attribute(
"The `PackageUpload` record corresponding to original upload of "
"this source package release. It's 'None' if it is a source "
"imported by Gina.")
uploader = Attribute(
"The user who uploaded the package.")
# Really ISourcePackageRecipeBuild -- see _schema_circular_imports.
source_package_recipe_build = Reference(
schema=Interface,
description=_("The `SourcePackageRecipeBuild` which produced this "
"source package release, or None if it was created from a "
"traditional upload."),
title=_("Source package recipe build"),
required=False, readonly=True)
def addFile(file):
"""Add the provided library file alias (file) to the list of files
in this package.
"""
def createBuild(distroarchseries, pocket, archive, processor=None,
status=None):
"""Create a build for a given distroarchseries/pocket/archive
If the processor isn't given, guess it from the distroarchseries.
If the status isn't given, use NEEDSBUILD.
Return the just created IBuild.
"""
def getBuildByArch(distroarchseries, archive):
"""Return build for the given distroarchseries/archive.
It looks for a build in any state registered *directly* for the
given distroarchseries and archive.
Returns None if a suitable build could not be found.
"""
def override(component=None, section=None, urgency=None):
"""Uniform method to override sourcepackagerelease attribute.
All arguments are optional and can be set individually. A non-passed
argument remains untouched.
"""
def attachTranslationFiles(tarball_alias, by_maintainer, importer=None):
"""Attach a tarball with translations to be imported into Rosetta.
:tarball_alias: is a Librarian alias that references to a tarball with
translations.
:by_maintainer: indicates if the imported files where uploaded by
the maintainer of the project or package.
:importer: is the person that did the import.
raise DownloadFailed if we are not able to fetch the file from
:tarball_alias:.
"""
package_diffs = Attribute(
"All `IPackageDiff` generated from this context.")
def getDiffTo(to_sourcepackagerelease):
"""Return an `IPackageDiff` to a given `ISourcePackageRelease`.
Return None if it was not yet requested.
"""
def requestDiffTo(requester, to_sourcepackagerelease):
"""Request a package diff from the context source to a given source.
:param: requester: it's the diff requester, any valid `IPerson`;
:param: to_source: it's the `ISourcePackageRelease` to diff against.
:raise `PackageDiffAlreadyRequested`: when there is already a
`PackageDiff` record matching the request being made.
:return: the corresponding `IPackageDiff` record.
"""
def getPackageSize():
"""Get the size total (in KB) of files comprising this package.
Please note: empty packages (i.e. ones with no files or with
files that are all empty) have a size of zero.
:return: total size (in KB) of this package
"""
def aggregate_changelog(since_version):
"""Get all the changelogs since the version specified.
:param since_version: Return changelogs of all versions
after since_version up to and including the version of the
sourcepackagerelease for this publication.
:return: A concatenated set of changelogs of all the required
versions, with a blank line between each. If there is no
changelog, or there is an error parsing it, None is returned.
"""
class PackageDiffAlreadyRequestedError(Exception):
"""Raised when an `IPackageDiff` request already exists."""
|