248
248
"""Extract the processor family from an `IArchiveArch`."""
249
249
return removeSecurityProxy(archivearch).processorfamily
252
get_family(archivearch) for archivearch
253
in getUtility(IArchiveArchSet).getByArchive(copy_archive)]
255
251
# Now instantiate the package copy request that will capture the
256
252
# archive population parameters in the database.
257
253
pcr = getUtility(IPackageCopyRequestSet).new(
269
265
if merge_copy_flag:
270
266
pkg_cloner.mergeCopy(the_origin, the_destination)
272
pkg_cloner.clonePackages(the_origin, the_destination)
274
# Create builds for the cloned packages.
275
self._createMissingBuilds(
276
the_destination.distroseries, the_destination.archive,
268
pkg_cloner.clonePackages(
269
the_origin, the_destination, proc_families=proc_families)
279
271
# Mark the package copy request as completed.
280
272
pcr.markAsCompleted()
399
391
"--nonvirtualized", dest="nonvirtualized", default=False,
400
392
action="store_true",
401
393
help='Create the archive as nonvirtual if specified.')
403
def _createMissingBuilds(
404
self, distroseries, archive, proc_families):
405
"""Create builds for all cloned source packages.
407
:param distroseries: the distro series for which to create builds.
408
:param archive: the archive for which to create builds.
409
:param proc_families: the list of processor families for
410
which to create builds.
412
# Avoid circular imports.
413
from lp.soyuz.interfaces.publishing import active_publishing_status
415
self.logger.info("Processing %s." % distroseries.name)
417
# Listify the architectures to avoid hitting this MultipleJoin
419
architectures = list(distroseries.architectures)
421
# Filter the list of DistroArchSeries so that only the ones
422
# specified on the command line remain.
423
architectures = [architecture for architecture in architectures
424
if architecture.processorfamily in proc_families]
426
if len(architectures) == 0:
428
"No DistroArchSeries left for %s, done." % distroseries.name)
432
"Supported architectures: %s." %
433
" ".join(arch_series.architecturetag
434
for arch_series in architectures))
436
# Both, PENDING and PUBLISHED sources will be considered for
437
# as PUBLISHED. It's part of the assumptions made in:
438
# https://launchpad.net/soyuz/+spec/build-unpublished-source
439
sources_published = archive.getPublishedSources(
440
distroseries=distroseries, status=active_publishing_status)
443
"Found %d source(s) published." % sources_published.count())
446
"""Return the source package name for a publishing record."""
447
return pub.sourcepackagerelease.sourcepackagename.name
449
archindep_unavailable = distroseries.nominatedarchindep not in (
452
for pubrec in sources_published:
453
if (pubrec.sourcepackagerelease.architecturehintlist == "all"
454
and archindep_unavailable):
456
"Skipping %s, arch-all package can't be built since %s "
457
"is not requested" % (
459
distroseries.nominatedarchindep.architecturetag))
462
builds = pubrec.createMissingBuilds(
463
architectures_available=architectures, logger=self.logger)
465
self.logger.info("%s has no builds." % get_spn(pubrec))
468
"%s has %s build(s)." % (get_spn(pubrec), len(builds)))