139
139
keep the same component and section as their ancestor publications.
142
def calculateSourceOverrides(archive, distroseries, pocket, sources):
142
def calculateSourceOverrides(archive, distroseries, pocket, sources,
143
source_component=None):
143
144
"""Calculate source overrides.
145
146
:param archive: The target `IArchive`.
146
147
:param distroseries: The target `IDistroSeries`.
147
148
:param pocket: The target `PackagePublishingPocket`.
148
149
:param sources: A tuple of `ISourcePackageName`s.
150
:param source_component: The sources' `IComponent` (optional).
150
152
:return: A list of `ISourceOverride`
171
173
implements(IOverridePolicy)
173
175
def calculateSourceOverrides(self, archive, distroseries, pocket,
176
sources, source_component=None):
175
177
raise NotImplementedError()
177
179
def calculateBinaryOverrides(self, archive, distroseries, pocket,
188
190
for the latest published binary publication.
191
def calculateSourceOverrides(self, archive, distroseries, pocket, spns):
193
def calculateSourceOverrides(self, archive, distroseries, pocket, spns,
194
source_component=None):
192
195
# Avoid circular imports.
193
196
from lp.soyuz.model.sourcepackagerelease import SourcePackageRelease
194
197
from lp.soyuz.model.publishing import SourcePackagePublishingHistory
277
280
Override policy that assumes everything passed in doesn't exist, so
278
281
returns the defaults.
283
Newly-uploaded files have a default set of overrides to be applied.
284
This reduces the amount of work that archive admins have to do
285
since they override the majority of new uploads with the same
286
values. The rules for overriding are: (See bug #120052)
287
'contrib' -> 'multiverse'
288
'non-free' -> 'multiverse'
289
everything else -> 'universe'
290
This mainly relates to Debian syncs, where the default component
291
is 'main' but should not be in main for Ubuntu.
294
DEBIAN_COMPONENT_OVERRIDE_MAP = {
295
'contrib': 'multiverse',
296
'non-free': 'multiverse',
299
DEFAULT_OVERRIDE_COMPONENT = 'universe'
302
def getComponentOverride(cls, component=None, return_component=False):
303
# component can be a Component object or a component name.
304
if isinstance(component, Component):
305
component = component.name
306
override_component_name = cls.DEBIAN_COMPONENT_OVERRIDE_MAP.get(
307
component, cls.DEFAULT_OVERRIDE_COMPONENT)
309
return getUtility(IComponentSet)[override_component_name]
311
return override_component_name
281
313
def calculateSourceOverrides(self, archive, distroseries, pocket,
283
default_component = archive.default_component or getUtility(
284
IComponentSet)['universe']
314
sources, source_component=None):
315
default_component = (
316
archive.default_component or
317
UnknownOverridePolicy.getComponentOverride(
318
source_component, return_component=True))
286
320
SourceOverride(source, default_component, None)
287
321
for source in sources]
306
340
def calculateSourceOverrides(self, archive, distroseries, pocket,
341
sources, source_component=None):
308
342
total = set(sources)
309
343
overrides = FromExistingOverridePolicy.calculateSourceOverrides(
310
self, archive, distroseries, pocket, sources)
344
self, archive, distroseries, pocket, sources, source_component)
311
345
existing = set(override.source_package_name for override in overrides)
312
346
missing = total.difference(existing)
314
348
unknown = UnknownOverridePolicy.calculateSourceOverrides(
315
self, archive, distroseries, pocket, missing)
349
self, archive, distroseries, pocket, missing,
316
351
overrides.extend(unknown)