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
|
# Copyright 2009 Canonical Ltd. This software is licensed under the
# GNU Affero General Public License version 3 (see the file LICENSE).
# pylint: disable-msg=E0211,E0213
"""Binary package release interfaces."""
__metaclass__ = type
__all__ = [
'IBinaryPackageRelease',
'IBinaryPackageReleaseDownloadCount',
]
from lazr.restful.declarations import (
export_as_webservice_entry,
exported,
)
from lazr.restful.fields import (
Reference,
ReferenceChoice,
)
from zope.interface import (
Attribute,
Interface,
)
from zope.schema import (
Bool,
Date,
Datetime,
Int,
List,
Object,
Text,
TextLine,
)
from lp import _
from lp.app.validators.version import valid_debian_version
from lp.services.worlddata.interfaces.country import ICountry
from lp.soyuz.interfaces.archive import IArchive
class IBinaryPackageRelease(Interface):
id = Int(title=_('ID'), required=True)
binarypackagename = Int(required=True)
binarypackagenameID = Int(required=True)
version = TextLine(required=True, constraint=valid_debian_version)
summary = Text(required=True)
description = Text(required=True)
build = Int(required=True)
binpackageformat = Int(required=True)
component = Int(required=True)
section = Int(required=True)
priority = Int(required=False)
shlibdeps = TextLine(required=False)
depends = TextLine(required=False)
recommends = TextLine(required=False)
suggests = TextLine(required=False)
conflicts = TextLine(required=False)
replaces = TextLine(required=False)
provides = TextLine(required=False)
pre_depends = TextLine(required=False)
enhances = TextLine(required=False)
breaks = TextLine(required=False)
essential = Bool(required=False)
installedsize = Int(required=False)
architecturespecific = Bool(required=True)
datecreated = Datetime(required=True, readonly=True)
debug_package = Object(
title=_("Debug package"), schema=Interface, required=False,
description=_("The corresponding package containing debug symbols "
"for this binary."))
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)
files = Attribute("Related list of IBinaryPackageFile entries")
title = TextLine(required=True, readonly=True)
name = Attribute("Binary Package Name")
sourcepackagename = Attribute(
"The name of the source package from where this binary was built.")
# Properties.
distributionsourcepackagerelease = Attribute(
"The sourcepackage release in this distribution from which this "
"binary was built.")
is_new = Bool(
title=_("New Binary."),
description=_("True if there binary version was never published for "
"the architeture it was built for. False otherwise."))
def addFile(file):
"""Create a BinaryPackageFile record referencing this build
and attach the provided library file alias (file).
"""
def override(component=None, section=None, priority=None):
"""Uniform method to override binarypackagerelease attribute.
All arguments are optional and can be set individually. A non-passed
argument remains untouched.
"""
class IBinaryPackageReleaseDownloadCount(Interface):
"""Daily download count of a binary package release in an archive."""
export_as_webservice_entry()
id = Int(title=_('ID'), required=True, readonly=True)
archive = exported(Reference(
title=_('Archive'), schema=IArchive, required=True,
readonly=True))
binary_package_release = Reference(
title=_('The binary package release'), schema=IBinaryPackageRelease,
required=True, readonly=True)
binary_package_name = exported(
TextLine(
title=_("Binary package name"),
required=False, readonly=True))
binary_package_version = exported(
TextLine(
title=_("Binary package version"),
required=False, readonly=True))
day = exported(
Date(title=_('Day of the downloads'), required=True, readonly=True))
count = exported(
Int(title=_('Number of downloads'), required=True, readonly=True))
country = exported(
ReferenceChoice(
title=_('Country'), required=False, readonly=True,
vocabulary='CountryName', schema=ICountry))
|