launchpad-reviewers team mailing list archive
-
launchpad-reviewers team
-
Mailing list archive
-
Message #20210
[Merge] lp:~cjwatson/launchpad/fix-refactor-component-dependencies into lp:launchpad
Colin Watson has proposed merging lp:~cjwatson/launchpad/fix-refactor-component-dependencies into lp:launchpad.
Commit message:
Consistently return an IComponent from get_primary_current_component.
Requested reviews:
Launchpad code reviewers (launchpad-reviewers)
Related bugs:
Bug #1567132 in Launchpad itself: "r17979 causes package build dispatch failures in devirtualised PPAs"
https://bugs.launchpad.net/launchpad/+bug/1567132
For more details, see:
https://code.launchpad.net/~cjwatson/launchpad/fix-refactor-component-dependencies/+merge/291190
Consistently return an IComponent from get_primary_current_component. This was a regression caused by https://code.launchpad.net/~cjwatson/launchpad/refactor-component-dependencies/+merge/290532.
I also added a few functional tests for situations that should have caught the previous bug but didn't.
--
Your team Launchpad code reviewers is requested to review the proposed merge of lp:~cjwatson/launchpad/fix-refactor-component-dependencies into lp:launchpad.
=== modified file 'lib/lp/soyuz/adapters/archivedependencies.py'
--- lib/lp/soyuz/adapters/archivedependencies.py 2016-04-04 16:48:04 +0000
+++ lib/lp/soyuz/adapters/archivedependencies.py 2016-04-07 00:15:28 +0000
@@ -138,7 +138,7 @@
distroseries=distroseries, exact_match=True).first()
if ancestry is not None:
- return ancestry.component.name
+ return ancestry.component
else:
return getUtility(IComponentSet)['universe']
=== modified file 'lib/lp/soyuz/doc/archive-dependencies.txt'
--- lib/lp/soyuz/doc/archive-dependencies.txt 2016-04-04 16:48:04 +0000
+++ lib/lp/soyuz/doc/archive-dependencies.txt 2016-04-07 00:15:28 +0000
@@ -386,6 +386,21 @@
deb http://archive.launchpad.dev/ubuntu hoary-security
main universe
+ >>> _ = test_publisher.getPubSource(
+ ... sourcename='with-ancestry', version='1.0',
+ ... archive=ubuntu.main_archive)
+ >>> [build_with_ancestry] = test_publisher.getPubSource(
+ ... sourcename='with-ancestry', version='1.1',
+ ... archive=cprov.archive).createMissingBuilds()
+ >>> print get_primary_current_component(
+ ... build_with_ancestry.archive, build_with_ancestry.distro_series,
+ ... build_with_ancestry.source_package_release.name).name
+ main
+ >>> print_building_sources_list(build_with_ancestry)
+ deb http://ppa.launchpad.dev/cprov/ppa/ubuntu hoary main
+ deb http://archive.launchpad.dev/ubuntu hoary main
+ deb http://archive.launchpad.dev/ubuntu hoary-security main
+
>>> cprov.archive.removeArchiveDependency(ubuntu.main_archive)
It's also possible to modify the PPA to act as a super-free and
=== modified file 'lib/lp/soyuz/tests/test_archive.py'
--- lib/lp/soyuz/tests/test_archive.py 2016-04-04 16:48:04 +0000
+++ lib/lp/soyuz/tests/test_archive.py 2016-04-07 00:15:28 +0000
@@ -1735,6 +1735,33 @@
self.assertDep('i386', 'foo-main', [main_bins[0]])
self.assertDep('i386', 'foo-universe', [universe_bins[0]])
+ def test_obeys_dependency_components_with_primary_ancestry(self):
+ # When the dependency component is undefined, only packages
+ # published in a component matching the primary archive ancestry
+ # should be found.
+ primary = self.archive.distribution.main_archive
+ self.publisher.getPubSource(
+ sourcename='something-new', version='1', archive=primary,
+ component='main', status=PackagePublishingStatus.PUBLISHED)
+ main_bins = self.publisher.getPubBinaries(
+ binaryname='foo-main', archive=primary, component='main',
+ status=PackagePublishingStatus.PUBLISHED)
+ universe_bins = self.publisher.getPubBinaries(
+ binaryname='foo-universe', archive=primary,
+ component='universe',
+ status=PackagePublishingStatus.PUBLISHED)
+
+ self.archive.addArchiveDependency(
+ primary, PackagePublishingPocket.RELEASE)
+ self.assertDep('i386', 'foo-main', [main_bins[0]])
+ self.assertDep('i386', 'foo-universe', [])
+
+ self.publisher.getPubSource(
+ sourcename='something-new', version='2', archive=primary,
+ component='universe', status=PackagePublishingStatus.PUBLISHED)
+ self.assertDep('i386', 'foo-main', [main_bins[0]])
+ self.assertDep('i386', 'foo-universe', [universe_bins[0]])
+
class TestOverlays(TestCaseWithFactory):
=== modified file 'lib/lp/soyuz/tests/test_binarypackagebuildbehaviour.py'
--- lib/lp/soyuz/tests/test_binarypackagebuildbehaviour.py 2016-02-15 01:06:56 +0000
+++ lib/lp/soyuz/tests/test_binarypackagebuildbehaviour.py 2016-04-07 00:15:28 +0000
@@ -1,4 +1,4 @@
-# Copyright 2010-2014 Canonical Ltd. This software is licensed under the
+# Copyright 2010-2016 Canonical Ltd. This software is licensed under the
# GNU Affero General Public License version 3 (see the file LICENSE).
"""Tests for BinaryPackageBuildBehaviour."""
@@ -167,6 +167,35 @@
lf, archive, ArchivePurpose.PRIMARY, 'universe')
return d
+ def test_non_virtual_ppa_dispatch_with_primary_ancestry(self):
+ # If there is a primary component override, it is honoured for
+ # non-virtual PPA builds too.
+ archive = self.factory.makeArchive(virtualized=False)
+ slave = OkSlave()
+ builder = self.factory.makeBuilder(virtualized=False)
+ builder.setCleanStatus(BuilderCleanStatus.CLEAN)
+ vitals = extract_vitals_from_db(builder)
+ build = self.factory.makeBinaryPackageBuild(
+ builder=builder, archive=archive)
+ self.factory.makeSourcePackagePublishingHistory(
+ distroseries=build.distro_series,
+ archive=archive.distribution.main_archive,
+ sourcepackagename=build.source_package_release.sourcepackagename,
+ component='main')
+ lf = self.factory.makeLibraryFileAlias()
+ transaction.commit()
+ build.distro_arch_series.addOrUpdateChroot(lf)
+ bq = build.queueBuild()
+ bq.markAsBuilding(builder)
+ interactor = BuilderInteractor()
+ d = interactor._startBuild(
+ bq, vitals, builder, slave,
+ interactor.getBuildBehaviour(bq, builder, slave), BufferLogger())
+ d.addCallback(
+ self.assertExpectedInteraction, slave.call_log, builder, build,
+ lf, archive, ArchivePurpose.PRIMARY, 'main')
+ return d
+
def test_virtual_ppa_dispatch(self):
archive = self.factory.makeArchive(virtualized=True)
slave = OkSlave()
Follow ups