← Back to team overview

launchpad-reviewers team mailing list archive

[Merge] lp:~julian-edwards/launchpad/das-disabled-builds-bug-633139 into lp:launchpad

 

Julian Edwards has proposed merging lp:~julian-edwards/launchpad/das-disabled-builds-bug-633139 into lp:launchpad.

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/35137
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.
=== 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 17:03:50 +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/model/distroarchseries.py'
--- lib/lp/soyuz/model/distroarchseries.py	2010-09-08 16:43:52 +0000
+++ lib/lp/soyuz/model/distroarchseries.py	2010-09-10 17:03:50 +0000
@@ -338,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 17:03:50 +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 17:03:50 +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)