43
45
def create(cls, child, parents, arches=(), packagesets=(),
44
46
rebuild=False, overlays=(), overlay_pockets=(),
45
47
overlay_components=()):
46
"""See `IInitializeDistroSeriesJob`."""
48
"""Create a new `InitializeDistroSeriesJob`.
50
:param child: The child `IDistroSeries` to initialize
51
:param parents: An iterable of `IDistroSeries` of parents to
53
:param arches: An iterable of architecture tags which lists the
54
architectures to enable in the child.
55
:param packagesets: An iterable of `PackageSet` IDs from which to
56
copy packages in parents.
57
:param rebuild: A boolean to say whether the child should rebuild
58
all the copied sources (if True), or to copy the parents'
60
:param overlays: An iterable of booleans corresponding exactly to
61
each parent in the "parents" parameter. Each boolean says
62
whether this corresponding parent is an overlay for the child
63
or not. An overlay allows the child to use the parent's
64
packages for build dependencies, and the overlay_pockets and
65
overlay_components parameters dictate from where the
66
dependencies may be used in the parent.
67
:param overlay_pockets: An iterable of textual pocket names
68
corresponding exactly to each parent. The name *must* be set
69
if the corresponding overlays boolean is True.
70
:param overlay_components: An iterable of textual component names
71
corresponding exactly to each parent. The name *must* be set
72
if the corresponding overlays boolean is True.
47
74
store = IMasterStore(DistributionJob)
48
75
# Only one InitializeDistroSeriesJob can be present at a time.
49
76
distribution_job = store.find(
84
111
DistributionJob.distroseries_id == distroseries.id).one()
85
112
return None if distribution_job is None else cls(distribution_job)
115
"""Returns an informative representation of the job."""
116
# This code assumes the job is referentially intact with good data,
117
# or it will blow up.
118
parts = "%s for" % self.__class__.__name__
119
parts += " distribution: %s" % self.distribution.name
120
parts += ", distroseries: %s" % self.distroseries.name
121
parts += ", parent[overlay?/pockets/components]: "
123
for i in range(len(self.overlays)):
124
series = DistroSeries.get(self.parents[i])
125
parents.append("%s[%s/%s/%s]" % (
128
self.overlay_pockets[i],
129
self.overlay_components[i]))
130
parts += ",".join(parents)
132
IStore(Packageset).get(Packageset, int(pkgsetid)).name
133
for pkgsetid in self.packagesets]
134
parts += ", architectures: %s" % (self.arches,)
135
parts += ", packagesets: %s" % pkgsets
136
parts += ", rebuild: %s" % self.rebuild
137
return "<%s>" % parts
88
140
def parents(self):
89
141
return tuple(self.metadata['parents'])