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
|
# Copyright 2009-2011 Canonical Ltd. This software is licensed under the
# GNU Affero General Public License version 3 (see the file LICENSE).
# pylint: disable-msg=E0211,E0213
"""Package file interfaces."""
__metaclass__ = type
__all__ = [
'IBinaryPackageFile',
'IBinaryPackageFileSet',
'ISourcePackageReleaseFile',
'ISourcePackageReleaseFileSet',
]
from lazr.restful.fields import Reference
from zope.interface import Interface
from zope.schema import (
Bool,
Int,
)
from lp import _
from lp.services.librarian.interfaces import ILibraryFileAlias
from lp.soyuz.interfaces.sourcepackagerelease import ISourcePackageRelease
class IBinaryPackageFile(Interface):
"""A binary package to librarian link record."""
id = Int(
title=_('ID'), required=True, readonly=True,
)
binarypackagerelease = Int(
title=_('The binarypackagerelease being published'),
required=True, readonly=False,
)
libraryfileID = Int(
title=_("The LibraryFileAlias id for this .deb"), required=True,
readonly=True)
libraryfile = Reference(
ILibraryFileAlias, title=_("The library file alias for this .deb"),
required=True, readonly=False)
filetype = Int(
title=_('The type of this file'), required=True, readonly=False,
)
class IBinaryPackageFileSet(Interface):
"""The set of all `BinaryPackageFile`s."""
def getByPackageUploadIDs(package_upload_ids):
"""Return `BinaryPackageFile`s for the `PackageUpload` IDs."""
def loadLibraryFiles(binary_files):
"""Bulk-load Librarian files associated with `binary_files`.
This loads the `LibraryFileAlias` and `LibraryFileContent` for each
of `binary_files` into the ORM cache, and returns an iterable of
`LibraryFileAlias`.
"""
class ISourcePackageReleaseFile(Interface):
"""A source package release to librarian link record."""
id = Int(
title=_('ID'), required=True, readonly=True,
)
sourcepackagerelease = Reference(
ISourcePackageRelease,
title=_("The source package release being published"),
required=True, readonly=False)
sourcepackagereleaseID = Int(
title=_('ID of the source package release being published'),
required=True,
readonly=False)
libraryfile = Int(
title=_('The library file alias for this file'), required=True,
readonly=False,
)
filetype = Int(
title=_('The type of this file'), required=True, readonly=False,
)
is_orig = Bool(
title=_('Whether this file is an original tarball'),
required=True, readonly=False,
)
class ISourcePackageReleaseFileSet(Interface):
"""The set of all `SourcePackageRelease`s."""
def getByPackageUploadIDs(package_upload_ids):
"""Return `SourcePackageReleaseFile`s for the `PackageUpload` IDs."""
|