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
|
# 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
"""Packaging interfaces."""
__metaclass__ = type
__all__ = [
'IPackaging',
'IPackagingUtil',
'PackagingType',
]
from lazr.enum import (
DBEnumeratedType,
DBItem,
)
from zope.interface import (
Attribute,
Interface,
)
from zope.schema import (
Choice,
Datetime,
Int,
)
from canonical.launchpad import _
from lp.registry.interfaces.role import IHasOwner
class PackagingType(DBEnumeratedType):
"""Source packages.
Source packages include software from one or more Upstream open source
projects. This schema shows the relationship between a source package
and the upstream open source products that it might incorporate. This
schema is used in the Packaging table.
"""
PRIME = DBItem(1, """
Primary Project
This is the primary project packaged in this source package. For
example, a source package "apache2" would have a "prime" packaging
relationship with the "apache2" product from the Apache Project.
The project and package don't have to have the same name.
""")
INCLUDES = DBItem(2, """
SourcePackage Includes Project
This source package includes some part or all of the project. For
example, the "cadaver" source package has an "includes" packaging
relationship with the libneon project.
""")
class IPackaging(IHasOwner):
"""
A Packaging entry. It relates a SourcePackageName, DistroSeries
and ProductSeries, with a packaging type. So, for example, we use this
table to specify that the mozilla-firefox package in hoary is actually a
primary packaging of firefox 1.0 series releases.
"""
id = Int(title=_('Packaging ID'))
productseries = Choice(
title=_('Upstream Series'), required=True,
vocabulary="ProductSeries", description=_(
"The series for this source package. The same distribution "
"release may package two different series of the same project as "
"different source packages. For example: python2.4 and python2.5"))
sourcepackagename = Choice(
title=_("Source Package Name"), required=True,
vocabulary='SourcePackageName')
distroseries = Choice(
title=_("Distribution Series"), required=True,
vocabulary='DistroSeries')
packaging = Choice(
title=_('Packaging'), required=True, vocabulary=PackagingType,
description=_(
"Is the project the primary content of the source package, "
"or does the source package include the work of other projects?"))
datecreated = Datetime(
title=_('Date Created'), required=True, readonly=True)
sourcepackage = Attribute(_("A source package that is constructed from "
"the distroseries and sourcepackagename of this packaging record."))
def userCanDelete():
"""True, if the current user is allowed to delete this packaging,
else False.
People who created the packaging can delete it, as well as
people with upload rights for a source package, distribution
owners, members of the registry team and LP admin team.
"""
class IPackagingUtil(Interface):
"""Utilities to handle Packaging."""
def createPackaging(productseries, sourcepackagename,
distroseries, packaging, owner):
"""Create Packaging entry."""
def deletePackaging(productseries, sourcepackagename, distroseries):
"""Delete a packaging entry."""
def packagingEntryExists(sourcepackagename, distroseries,
productseries=None):
"""Does this packaging entry already exists?
A sourcepackagename is unique to a distroseries. Passing the
productseries argument verifies that the packaging entry exists and
that it is for the productseries
"""
|