launchpad-reviewers team mailing list archive
-
launchpad-reviewers team
-
Mailing list archive
-
Message #23943
[Merge] lp:~cjwatson/launchpad/das-filter-honour into lp:launchpad
Colin Watson has proposed merging lp:~cjwatson/launchpad/das-filter-honour into lp:launchpad with lp:~cjwatson/launchpad/das-filter-model as a prerequisite.
Commit message:
Honour DistroArchSeriesFilter rows when creating package builds.
Requested reviews:
Launchpad code reviewers (launchpad-reviewers)
Related bugs:
Bug #1842658 in Launchpad itself: "Support central filtering of which packages build for some architectures"
https://bugs.launchpad.net/launchpad/+bug/1842658
For more details, see:
https://code.launchpad.net/~cjwatson/launchpad/das-filter-honour/+merge/372263
--
Your team Launchpad code reviewers is requested to review the proposed merge of lp:~cjwatson/launchpad/das-filter-honour into lp:launchpad.
=== modified file 'database/schema/security.cfg'
--- database/schema/security.cfg 2019-09-04 14:08:44 +0000
+++ database/schema/security.cfg 2019-09-04 14:08:44 +0000
@@ -912,6 +912,7 @@
public.distributionjob = SELECT, INSERT, DELETE
public.distributionsourcepackage = SELECT, INSERT, UPDATE
public.distributionsourcepackagecache = SELECT, INSERT, UPDATE, DELETE
+public.distroarchseriesfilter = SELECT
public.distroseriesdifference = SELECT
public.distroseriesparent = SELECT, INSERT, UPDATE
public.flatpackagesetinclusion = SELECT, INSERT, UPDATE, DELETE
@@ -970,6 +971,7 @@
public.componentselection = SELECT
public.distribution = SELECT, UPDATE
public.distroarchseries = SELECT, UPDATE
+public.distroarchseriesfilter = SELECT
public.distroseries = SELECT, UPDATE
public.distroseriesparent = SELECT
public.emailaddress = SELECT
@@ -1117,6 +1119,7 @@
public.distributionsourcepackage = SELECT, INSERT, UPDATE
public.distributionsourcepackagecache = SELECT, INSERT, UPDATE
public.distroarchseries = SELECT, INSERT
+public.distroarchseriesfilter = SELECT
public.distroseries = SELECT, UPDATE
public.distroseriesdifference = SELECT
public.distroseriesdifferencemessage = SELECT, INSERT, UPDATE
@@ -1390,6 +1393,7 @@
public.distributionsourcepackage = SELECT, INSERT, UPDATE
public.distributionsourcepackagecache = SELECT, INSERT, UPDATE
public.distroarchseries = SELECT
+public.distroarchseriesfilter = SELECT
public.distroseries = SELECT, UPDATE
public.distroseriesparent = SELECT
public.emailaddress = SELECT, INSERT, UPDATE
@@ -1505,6 +1509,7 @@
public.distributionsourcepackage = SELECT, INSERT, UPDATE
public.distributionsourcepackagecache = SELECT, INSERT, UPDATE
public.distroarchseries = SELECT
+public.distroarchseriesfilter = SELECT
public.distroseries = SELECT
public.distroseriesdifference = SELECT
public.distroseriesparent = SELECT
=== modified file 'lib/lp/soyuz/model/binarypackagebuild.py'
--- lib/lp/soyuz/model/binarypackagebuild.py 2019-05-01 15:47:37 +0000
+++ lib/lp/soyuz/model/binarypackagebuild.py 2019-09-04 14:08:44 +0000
@@ -1337,7 +1337,8 @@
archive,
architectures_available
or distroseries.buildable_architectures)
- if das.architecturetag not in skip_archtags],
+ if das.architecturetag not in skip_archtags and
+ das.isSourceIncluded(sourcepackagerelease.sourcepackagename)],
key=attrgetter('processor.id'))
nominated_arch_indep_tag = (
distroseries.nominatedarchindep.architecturetag
=== modified file 'lib/lp/soyuz/tests/test_build_set.py'
--- lib/lp/soyuz/tests/test_build_set.py 2018-02-02 03:14:35 +0000
+++ lib/lp/soyuz/tests/test_build_set.py 2019-09-04 14:08:44 +0000
@@ -1,4 +1,4 @@
-# Copyright 2011-2018 Canonical Ltd. This software is licensed under the
+# Copyright 2011-2019 Canonical Ltd. This software is licensed under the
# GNU Affero General Public License version 3 (see the file LICENSE).
from __future__ import absolute_import, print_function, unicode_literals
@@ -13,6 +13,7 @@
from lp.registry.interfaces.pocket import PackagePublishingPocket
from lp.soyuz.enums import (
ArchivePurpose,
+ DistroArchSeriesFilterSense,
SourcePackageFormat,
)
from lp.soyuz.interfaces.binarypackagebuild import (
@@ -32,6 +33,7 @@
person_logged_in,
TestCaseWithFactory,
)
+from lp.testing.dbuser import lp_dbuser
from lp.testing.layers import (
LaunchpadFunctionalLayer,
ZopelessDatabaseLayer,
@@ -559,6 +561,30 @@
new_builds = self.createBuilds(spr, self.distroseries)
self.assertBuildsMatch({}, new_builds)
+ def test_createForSource_honours_filters(self):
+ # If there are DistroArchSeriesFilters for some architectures,
+ # createForSource honours them.
+ sprs = [
+ self.factory.makeSourcePackageRelease(architecturehintlist='any')
+ for _ in range(3)]
+ with lp_dbuser():
+ avr_filter = self.factory.makeDistroArchSeriesFilter(
+ distroarchseries=self.distroseries2.getDistroArchSeries('avr'),
+ sense=DistroArchSeriesFilterSense.INCLUDE)
+ sparc_filter = self.factory.makeDistroArchSeriesFilter(
+ distroarchseries=self.distroseries2.getDistroArchSeries(
+ 'sparc'),
+ sense=DistroArchSeriesFilterSense.EXCLUDE)
+ avr_filter.packageset.add(
+ [spr.sourcepackagename for spr in sprs[:2]])
+ sparc_filter.packageset.add(
+ [spr.sourcepackagename for spr in sprs[1:]])
+ builds = [self.createBuilds(spr, self.distroseries2) for spr in sprs]
+ self.assertBuildsMatch(
+ {'avr': False, 'sparc': False, 'x32': True}, builds[0])
+ self.assertBuildsMatch({'avr': False, 'x32': True}, builds[1])
+ self.assertBuildsMatch({'x32': True}, builds[2])
+
class TestFindBuiltOrPublishedBySourceAndArchive(TestCaseWithFactory):
"""Tests for findBuiltOrPublishedBySourceAndArchive()."""
Follow ups