launchpad-reviewers team mailing list archive
-
launchpad-reviewers team
-
Mailing list archive
-
Message #00958
[Merge] lp:~julian-edwards/launchpad/das-disabled-builds-bug-633139 into lp:launchpad/devel
Julian Edwards has proposed merging lp:~julian-edwards/launchpad/das-disabled-builds-bug-633139 into lp:launchpad/devel.
Requested reviews:
Launchpad code reviewers (launchpad-reviewers)
= Summary =
Prevent publishing and creating new builds in disabled DistroArchSeries.
== Implementation details ==
This uses the "enabled" flag on the distroarchseries table to prevent a) new
builds getting created on a disabled DAS, and b) prevents publication of a
disabled DAS by just exiting early from its publish() method.
== Tests ==
bin/test -cvvt package-arch-specific.txt -t test_publishing_top_level_api
== Demo and Q/A ==
On dogfood:
* Disable maverick amd64
* upload an arch-any package (which tries to create builds on all the
available arches)
* Verify that no build was created on maverick/amd64
* Upload same package to Lucid and check that the build IS created.
* Disable lucid/amd64
* Run the publisher and check that the binary is not published to lucid
despite it being pending.
--
https://code.launchpad.net/~julian-edwards/launchpad/das-disabled-builds-bug-633139/+merge/35136
Your team Launchpad code reviewers is requested to review the proposed merge of lp:~julian-edwards/launchpad/das-disabled-builds-bug-633139 into lp:launchpad/devel.
=== modified file 'database/replication/Makefile'
--- database/replication/Makefile 2010-07-26 08:12:20 +0000
+++ database/replication/Makefile 2010-09-10 16:50:43 +0000
@@ -14,8 +14,9 @@
# To test the staging rebuild script:
#
# $ cd database/replication
-# $ pg_dump --format=c launchpad_dev > launchpad.dump
-# $ make stagingsetup STAGING_CONFIG=dev-staging STAGING_DUMP=launchpad.dump
+# $ pg_dump --format=c launchpad_dev | bzip2 -c > launchpad.dump.bz2
+# $ make stagingsetup \
+# STAGING_CONFIG=dev-staging STAGING_DUMP=launchpad.dump.bz2
# $ make stagingswitch STAGING_CONFIG=dev-staging
#
# To restore a dogfood database:
=== modified file 'database/replication/slon_ctl.py'
--- database/replication/slon_ctl.py 2010-05-19 18:07:56 +0000
+++ database/replication/slon_ctl.py 2010-09-10 16:50:43 +0000
@@ -88,9 +88,11 @@
def get_logfile(nickname):
+ logdir = config.database.replication_logdir
+ if not os.path.isabs(logdir):
+ logdir = os.path.normpath(os.path.join(config.root, logdir))
return os.path.join(
- config.root, 'database', 'replication',
- 'lpslon_%s_%s.log' % (nickname, config.instance_name))
+ logdir, 'lpslon_%s_%s.log' % (nickname, config.instance_name))
def start(log, nodes, lag=None):
=== modified file 'database/schema/comments.sql'
--- database/schema/comments.sql 2010-09-03 16:43:11 +0000
+++ database/schema/comments.sql 2010-09-10 16:50:43 +0000
@@ -1171,6 +1171,7 @@
COMMENT ON COLUMN DistroArchSeries.package_count IS 'A cache of the number of binary packages published in this distro arch release. The count only includes packages published in the release pocket.';
COMMENT ON COLUMN DistroArchSeries.supports_virtualized IS 'Whether or not
virtualized build support should be provided by this specific distroarchseries';
+COMMENT ON COLUMN DistroArchSeries.enabled IS 'Whether to allow build creation and publishing for this DistroArchSeries.';
-- LauncpadDatabaseRevision
COMMENT ON TABLE LaunchpadDatabaseRevision IS 'This table contains a list of the database patches that have been successfully applied to this database.';
=== added file 'database/schema/patch-2208-08-1.sql'
--- database/schema/patch-2208-08-1.sql 1970-01-01 00:00:00 +0000
+++ database/schema/patch-2208-08-1.sql 2010-09-10 16:50:43 +0000
@@ -0,0 +1,9 @@
+-- Copyright 2010 Canonical Ltd. This software is licensed under the
+-- GNU Affero General Public License version 3 (see the file LICENSE).
+
+SET client_min_messages=ERROR;
+
+ALTER TABLE distroarchseries
+ ADD COLUMN enabled bool NOT NULL DEFAULT TRUE;
+
+INSERT INTO LaunchpadDatabaseRevision VALUES (2208, 08, 1);
=== modified file 'lib/canonical/config/schema-lazr.conf'
--- lib/canonical/config/schema-lazr.conf 2010-08-30 00:51:55 +0000
+++ lib/canonical/config/schema-lazr.conf 2010-09-10 16:50:43 +0000
@@ -644,6 +644,11 @@
# datatype: integer
storm_cache_size: 500
+# Where database/replication/slon_ctl.py dumps its logs. Used for the
+# staging replication environment.
+# datatype: existing_directory
+replication_logdir: database/replication
+
[diff]
# The maximum size in bytes to read from the librarian to make available in
=== modified file 'lib/lp/soyuz/browser/distroarchseries.py'
--- lib/lp/soyuz/browser/distroarchseries.py 2010-08-20 20:31:18 +0000
+++ lib/lp/soyuz/browser/distroarchseries.py 2010-09-10 16:50:43 +0000
@@ -124,7 +124,8 @@
schema = IDistroArchSeries
field_names = [
- 'architecturetag', 'official', 'supports_virtualized'
+ 'architecturetag', 'official', 'supports_virtualized',
+ 'enabled',
]
@action(_('Change'), name='update')
=== added file 'lib/lp/soyuz/browser/tests/test_distroarchseries_view.py'
--- lib/lp/soyuz/browser/tests/test_distroarchseries_view.py 1970-01-01 00:00:00 +0000
+++ lib/lp/soyuz/browser/tests/test_distroarchseries_view.py 2010-09-10 16:50:43 +0000
@@ -0,0 +1,51 @@
+# Copyright 2009 Canonical Ltd. This software is licensed under the
+# GNU Affero General Public License version 3 (see the file LICENSE).
+
+__metaclass__ = type
+
+from canonical.launchpad.ftests import login
+from canonical.launchpad.webapp.servers import LaunchpadTestRequest
+from canonical.testing import LaunchpadFunctionalLayer
+from lp.soyuz.browser.distroarchseries import DistroArchSeriesAdminView
+from lp.testing import TestCaseWithFactory
+from lp.testing.sampledata import LAUNCHPAD_ADMIN
+
+
+class TestDistroArchSeriesView(TestCaseWithFactory):
+
+ layer = LaunchpadFunctionalLayer
+
+ def setUp(self):
+ """Create a distroarchseries for the tests and login as an admin."""
+ super(TestDistroArchSeriesView, self).setUp()
+ self.das = self.factory.makeDistroArchSeries()
+ # Login as an admin to ensure access to the view's context
+ # object.
+ login(LAUNCHPAD_ADMIN)
+
+ def initialize_admin_view(self, enabled=True):
+ # Initialize the admin view with the supplied params.
+ method = 'POST'
+ form = {
+ 'field.actions.update': 'update',
+ }
+
+ if enabled:
+ form['field.enabled'] = 'on'
+ else:
+ form['field.enabled'] = 'off'
+
+ view = DistroArchSeriesAdminView(
+ self.das, LaunchpadTestRequest(method=method, form=form))
+ view.initialize()
+ return view
+
+ def test_enabling_enabled_flag(self):
+ view = self.initialize_admin_view(enabled=False)
+ self.assertEqual(0, len(view.errors))
+ self.assertFalse(view.context.enabled)
+
+ def test_disabling_enabled_flag(self):
+ view = self.initialize_admin_view(enabled=True)
+ self.assertEqual(0, len(view.errors))
+ self.assertTrue(view.context.enabled)
=== modified file 'lib/lp/soyuz/doc/distroarchseries.txt'
--- lib/lp/soyuz/doc/distroarchseries.txt 2010-07-20 09:36:17 +0000
+++ lib/lp/soyuz/doc/distroarchseries.txt 2010-09-10 16:50:43 +0000
@@ -25,6 +25,16 @@
# This needs many more tests to be effective.
+Properties
+==========
+
+Enabled is a boolean flag that says whether the arch will receive new builds
+and publish them.
+
+ >>> print hoary_i386.enabled
+ True
+
+
DistroArchSeries can tell you about their published releases
============================================================
=== modified file 'lib/lp/soyuz/doc/package-arch-specific.txt'
--- lib/lp/soyuz/doc/package-arch-specific.txt 2010-08-24 15:29:01 +0000
+++ lib/lp/soyuz/doc/package-arch-specific.txt 2010-09-10 16:50:43 +0000
@@ -121,6 +121,17 @@
>>> print_build_architectures(pub_one)
hppa
+If an architecture is disabled for some reason, then the results from
+determineArchitecturesToBuild() will not include it.
+
+ >>> hoary['hppa'].enabled = False
+
+ >>> print_build_architectures(pub_three)
+ i386
+
+Re-enable it before continuing:
+ >>> hoary['hppa'].enabled = True
+
== Check support for kernel notation in architecture hint list ==
=== modified file 'lib/lp/soyuz/interfaces/distroarchseries.py'
--- lib/lp/soyuz/interfaces/distroarchseries.py 2010-08-20 20:31:18 +0000
+++ lib/lp/soyuz/interfaces/distroarchseries.py 2010-09-10 16:50:43 +0000
@@ -83,6 +83,12 @@
description=_("Indicate whether or not this port has support "
"for building PPA packages."),
required=False))
+ enabled = Bool(
+ title=_("Enabled"),
+ description=_(
+ "Whether or not this DistroArchSeries is enabled for build "
+ "creation and publication."),
+ required=False, readonly=False)
# Joins.
packages = Attribute('List of binary packages in this port.')
=== modified file 'lib/lp/soyuz/model/distroarchseries.py'
--- lib/lp/soyuz/model/distroarchseries.py 2010-08-24 15:29:01 +0000
+++ lib/lp/soyuz/model/distroarchseries.py 2010-09-10 16:50:43 +0000
@@ -82,6 +82,7 @@
storm_validator=validate_public_person, notNull=True)
package_count = IntCol(notNull=True, default=DEFAULT)
supports_virtualized = BoolCol(notNull=False, default=False)
+ enabled = BoolCol(notNull=False, default=True)
packages = SQLRelatedJoin('BinaryPackageRelease',
joinColumn='distroarchseries',
@@ -337,6 +338,11 @@
def publish(self, diskpool, log, archive, pocket, is_careful=False):
"""See `ICanPublishPackages`."""
+ if not self.enabled:
+ log.debug(
+ "Skipping disabled architecture %s" % self.architecturetag)
+ return set()
+
log.debug("Attempting to publish pending binaries for %s"
% self.architecturetag)
=== modified file 'lib/lp/soyuz/pas.py'
--- lib/lp/soyuz/pas.py 2010-08-23 16:51:11 +0000
+++ lib/lp/soyuz/pas.py 2010-09-10 16:50:43 +0000
@@ -164,7 +164,8 @@
if not legal_archseries:
return []
- legal_arch_tags = set(arch.architecturetag for arch in legal_archseries)
+ legal_arch_tags = set(
+ arch.architecturetag for arch in legal_archseries if arch.enabled)
# We need to support arch tags like any-foo and linux-foo, so remove
# supported kernel prefixes, Also allow linux-any but not any-any.
=== modified file 'lib/lp/soyuz/tests/test_publishing_top_level_api.py'
--- lib/lp/soyuz/tests/test_publishing_top_level_api.py 2010-08-24 15:29:01 +0000
+++ lib/lp/soyuz/tests/test_publishing_top_level_api.py 2010-09-10 16:50:43 +0000
@@ -419,3 +419,16 @@
self.checkBinaryLookupForPocket(
PackagePublishingPocket.RELEASE, is_careful=True,
expected_result=[pub_published_release, pub_pending_release])
+
+ def test_publishing_disabled_distroarchseries(self):
+ # Disabled DASes will be skipped even if there are pending
+ # publications for them.
+ binaries = self.getPubBinaries(architecturespecific=True)
+ # Just use the first binary.
+ binary = binaries[0]
+ self.assertEqual(PackagePublishingStatus.PENDING, binary.status)
+
+ binary.distroarchseries.enabled = False
+ self._publish(pocket=binary.pocket)
+
+ self.assertEqual(PackagePublishingStatus.PENDING, binary.status)