← Back to team overview

launchpad-reviewers team mailing list archive

[Merge] lp:~stevenk/launchpad/destroy-pas-yay into lp:launchpad

 

Steve Kowalik has proposed merging lp:~stevenk/launchpad/destroy-pas-yay into lp:launchpad.

Requested reviews:
  Launchpad code reviewers (launchpad-reviewers)
Related bugs:
  Bug #1186050 in Launchpad itself: "Remove Packages-arch-specific use from Soyuz"
  https://bugs.launchpad.net/launchpad/+bug/1186050

For more details, see:
https://code.launchpad.net/~stevenk/launchpad/destroy-pas-yay/+merge/166639

Destroy the P-a-s parser, and all callsites that were still using it. Rationale better than I could type is in the bug.

lp.soyuz.pas is dead, now lp.soyuz.adapters.buildarch. I've removed all tests that depended on P-a-s functionality, but buildbot should tell me if I missed any.
-- 
https://code.launchpad.net/~stevenk/launchpad/destroy-pas-yay/+merge/166639
Your team Launchpad code reviewers is requested to review the proposed merge of lp:~stevenk/launchpad/destroy-pas-yay into lp:launchpad.
=== renamed file 'lib/lp/soyuz/pas.py' => 'lib/lp/soyuz/adapters/buildarch.py'
--- lib/lp/soyuz/pas.py	2012-05-30 12:34:56 +0000
+++ lib/lp/soyuz/adapters/buildarch.py	2013-05-31 03:58:28 +0000
@@ -1,114 +1,17 @@
-# Copyright 2009-2012 Canonical Ltd.  This software is licensed under the
+# Copyright 2009-2013 Canonical Ltd.  This software is licensed under the
 # GNU Affero General Public License version 3 (see the file LICENSE).
 
-import operator
+__metaclass__ = type
+
+__all__ = [
+    'determineArchitecturesToBuild',
+    ]
+
+
+from operator import attrgetter
 import os
 import subprocess
 
-from sqlobject import SQLObjectNotFound
-
-
-class BuildDaemonPackagesArchSpecific:
-    """Parse and implement "PackagesArchSpecific"."""
-
-    def __init__(self, pas_dir, distroseries):
-        self.pas_file = os.path.join(pas_dir, "Packages-arch-specific")
-        self.distroseries = distroseries
-        self.permit = {}
-        self._parsePAS()
-
-    def _parsePAS(self):
-        """Parse self.pas_file and construct the permissible arch lists.
-
-        A PAS source line looks like this:
-
-            %openoffice.org2: i386 sparc powerpc amd64
-
-        A PAS binary line looks like this:
-
-            cmucl: i386 sparc amd64
-        """
-        try:
-            fd = open(self.pas_file, "r")
-        except IOError:
-            return
-
-        all_arch_tags = set([a.architecturetag for a in
-                            self.distroseries.architectures])
-        for line in fd:
-            line = line.split("#")[0]
-            line = line.strip()
-            if not line:
-                continue
-
-            is_source = False
-            if line.startswith("%"):
-                is_source = True
-                line = line[1:]
-
-            pkgname, arch_tags = line.split(":", 1)
-            is_exclude = False
-            if "!" in arch_tags:
-                is_exclude = True
-                arch_tags = arch_tags.replace("!", "")
-
-            line_arch_tags = arch_tags.strip().split()
-            arch_tags = set(line_arch_tags).intersection(all_arch_tags)
-            if is_exclude:
-                arch_tags = all_arch_tags - arch_tags
-
-            if not is_source:
-                ret = self._handleBinaryPAS(pkgname, arch_tags)
-                if ret is None:
-                    continue
-                pkgname, arch_tags = ret
-
-            self.permit[pkgname] = arch_tags
-
-        fd.close()
-
-    def _handleBinaryPAS(self, binary_name, arch_tags):
-        # We need to find a sourcepackagename, so search for it against
-        # the nominated distroarchseries (it could be any one, but
-        # using this one simplifies testing). If the sourcepackagename
-        # changes across arches then we'll have problems. We hope
-        # this'll never happen!
-        default_architecture = self.distroseries.nominatedarchindep
-        try:
-            binary_publications = default_architecture.getReleasedPackages(
-                binary_name)
-        except SQLObjectNotFound:
-            # Can't find it at all...
-            return None
-
-        if len(binary_publications) == 0:
-            # Can't find it, so give up
-            return None
-
-        # Use the first binary, they will all point to the same build and
-        # consequently to the same source.
-        test_binary = binary_publications[0]
-        build = test_binary.binarypackagerelease.build
-
-        # If the source produces more than one binary it can't be restricted,
-        # The binary PAS line is completely ignored.
-        if build.binarypackages.count() > 1:
-            return None
-
-        # The source produces a single binary, so it can be restricted.
-        source_name = build.source_package_release.name
-
-        # The arch-independent builder /must/ be included in the
-        # arch_tags, regardless of whether the binary PAS line allows
-        # for it. If it is omitted and the package includes an arch-all
-        # binary, that binary will not be built! See thread on Launchpad
-        # list during Aug/2006 for more details on discussion. -- kiko
-        default_architecture_tag = default_architecture.architecturetag
-        if default_architecture_tag not in arch_tags:
-            arch_tags.add(default_architecture_tag)
-
-        return source_name, arch_tags
-
 
 class DpkgArchitectureCache:
     """Cache the results of asking questions of dpkg-architecture."""
@@ -133,51 +36,29 @@
 dpkg_architecture = DpkgArchitectureCache()
 
 
-def determineArchitecturesToBuild(pubrec, legal_archseries,
-                                  distroseries, pas_verify=None):
+def determineArchitecturesToBuild(hintlist, archive, legal_archseries,
+                                  distroseries):
     """Return a list of architectures for which this publication should build.
 
-    This function answers the question: given a publication, what
-    architectures should we build it for? It takes a set of legal
-    distroarchseries and the distribution series for which we are
-    building, and optionally a BuildDaemonPackagesArchSpecific
-    (informally known as 'P-a-s') instance.
-
-    The P-a-s component contains a list of forbidden architectures for
-    each source package, which should be respected regardless of which
-    architectures have been requested in the source package metadata,
-    for instance:
-
-      * 'aboot' should only build on powerpc
-      * 'mozilla-firefox' should not build on sparc
-
-    This black/white list is an optimization to suppress temporarily
-    known-failures build attempts and thus saving build-farm time.
+    This function answers the question: given a list of architectures and
+    an archive, what architectures should we build it for? It takes a set of
+    legal distroarchseries and the distribution series for which we are
+    building.
 
     For PPA publications we only consider architectures supported by PPA
-    subsystem (`DistroArchSeries`.supports_virtualized flag) and P-a-s is
-    turned off to give the users the chance to test their fixes for upstream
-    problems.
+    subsystem (`DistroArchSeries`.supports_virtualized flag).
 
-    :param: pubrec: `ISourcePackagePublishingHistory` representing the
-        source publication.
+    :param: hintlist: A string of the architectures this source package
+        specifies it builds for.
+    :param: archive: The `IArchive` we are building into.
     :param: legal_archseries: a list of all initialized `DistroArchSeries`
         to be considered.
     :param: distroseries: the context `DistroSeries`.
-    :param: pas_verify: optional P-a-s verifier object/component.
     :return: a list of `DistroArchSeries` for which the source publication in
         question should be built.
     """
-    hint_string = pubrec.sourcepackagerelease.architecturehintlist
-
-    assert hint_string, 'Missing arch_hint_list'
-
-    # Ignore P-a-s for PPA publications.
-    if pubrec.archive.is_ppa:
-        pas_verify = None
-
     # The 'PPA supported' flag only applies to virtualized archives
-    if pubrec.archive.require_virtualized:
+    if archive.require_virtualized:
         legal_archseries = [
             arch for arch in legal_archseries if arch.supports_virtualized]
         # Cope with no virtualization support at all. It usually happens when
@@ -191,32 +72,20 @@
     legal_arch_tags = set(
         arch.architecturetag for arch in legal_archseries if arch.enabled)
 
-    hint_archs = set(hint_string.split())
-    package_tags = set(dpkg_architecture.findAllMatches(
+    hint_archs = set(hintlist.split())
+    build_tags = set(dpkg_architecture.findAllMatches(
         legal_arch_tags, hint_archs))
 
     # 'all' is only used as a last resort, to create an arch-indep build
     # where no builds would otherwise exist.
-    if len(package_tags) == 0 and 'all' in hint_archs:
+    if len(build_tags) == 0 and 'all' in hint_archs:
         nominated_arch = distroseries.nominatedarchindep
         if nominated_arch in legal_archseries:
-            package_tags = set([nominated_arch.architecturetag])
+            build_tags = set([nominated_arch.architecturetag])
         else:
-            package_tags = set()
-
-    if pas_verify:
-        build_tags = set()
-        for tag in package_tags:
-            sourcepackage_name = pubrec.sourcepackagerelease.name
-            if sourcepackage_name in pas_verify.permit:
-                permitted = pas_verify.permit[sourcepackage_name]
-                if tag not in permitted:
-                    continue
-            build_tags.add(tag)
-    else:
-        build_tags = package_tags
-
-    sorted_archseries = sorted(legal_archseries,
-                                 key=operator.attrgetter('architecturetag'))
+            build_tags = set()
+
+    sorted_archseries = sorted(
+        legal_archseries, key=attrgetter('architecturetag'))
     return [arch for arch in sorted_archseries
             if arch.architecturetag in build_tags]

=== renamed file 'lib/lp/soyuz/tests/test_pas.py' => 'lib/lp/soyuz/adapters/tests/test_buildarch.py'
--- lib/lp/soyuz/tests/test_pas.py	2012-05-30 12:34:41 +0000
+++ lib/lp/soyuz/adapters/tests/test_buildarch.py	2013-05-31 03:58:28 +0000
@@ -1,17 +1,8 @@
-# Copyright 2009-2012 Canonical Ltd.  This software is licensed under the
+# Copyright 2009-2013 Canonical Ltd.  This software is licensed under the
 # GNU Affero General Public License version 3 (see the file LICENSE).
 
-import os
-
-from lp.soyuz.enums import (
-    ArchivePurpose,
-    PackagePublishingStatus,
-    )
+from lp.soyuz.adapters.buildarch import determineArchitecturesToBuild
 from lp.soyuz.model.processor import ProcessorFamily
-from lp.soyuz.pas import (
-    BuildDaemonPackagesArchSpecific,
-    determineArchitecturesToBuild,
-    )
 from lp.soyuz.tests.test_publishing import SoyuzTestPublisher
 from lp.testing import TestCaseWithFactory
 from lp.testing.layers import LaunchpadZopelessLayer
@@ -33,43 +24,27 @@
             'armel', armel_family, False, self.publisher.person)
         self.publisher.addFakeChroots()
 
-    def getPASVerifier(self, pas_string):
-        """Build and return a PAS verifier based on the string provided."""
-        temp_dir = self.makeTemporaryDirectory()
-        pas_filename = os.path.join(temp_dir, "Packages-arch-specific")
-        with open(pas_filename, "w") as pas_file:
-            pas_file.write(pas_string)
-        pas_verify = BuildDaemonPackagesArchSpecific(
-            temp_dir, self.publisher.breezy_autotest)
-        return pas_verify
-
     def assertArchitecturesToBuild(self, expected_arch_tags, pub,
-                                   allowed_arch_tags=None, pas_string=None):
+                                   allowed_arch_tags=None):
         if allowed_arch_tags is None:
             allowed_archs = self.publisher.breezy_autotest.architectures
         else:
             allowed_archs = [
                 arch for arch in self.publisher.breezy_autotest.architectures
                 if arch.architecturetag in allowed_arch_tags]
-        if pas_string is None:
-            pas_verify = None
-        else:
-            pas_verify = self.getPASVerifier(pas_string)
         architectures = determineArchitecturesToBuild(
-            pub, allowed_archs, self.publisher.breezy_autotest,
-            pas_verify=pas_verify)
+            pub.binarypackagerelease.architecturehintlist, pub.archive,
+            allowed_archs, self.publisher.breezy_autotest)
         self.assertContentEqual(
             expected_arch_tags, [a.architecturetag for a in architectures])
 
     def assertArchsForHint(self, hint_string, expected_arch_tags,
-                           allowed_arch_tags=None, sourcename=None,
-                           pas_string=None):
+                           allowed_arch_tags=None, sourcename=None):
         """Assert that the given hint resolves to the expected archtags."""
         pub = self.publisher.getPubSource(
             sourcename=sourcename, architecturehintlist=hint_string)
         self.assertArchitecturesToBuild(
-            expected_arch_tags, pub, allowed_arch_tags=allowed_arch_tags,
-            pas_string=pas_string)
+            expected_arch_tags, pub, allowed_arch_tags=allowed_arch_tags)
 
     def test_single_architecture(self):
         # A hint string with a single arch resolves to just that arch.
@@ -154,128 +129,3 @@
         # i386) is omitted, no builds will be created for arch-indep
         # sources.
         self.assertArchsForHint('all', [], allowed_arch_tags=['hppa'])
-
-    def test_source_pas_defaults_to_all_available_architectures(self):
-        # Normally, a source package will be built on all available
-        # architectures in the series.
-        self.assertArchsForHint(
-            "i386 hppa amd64", ["hppa", "i386"], pas_string="")
-
-    def test_source_pas_can_restrict_to_one_architecture(self):
-        # A source package can be restricted to a single architecture via PAS.
-        self.assertArchsForHint(
-            "i386 hppa amd64", ["i386"], sourcename="test",
-            pas_string="%test: i386")
-
-    def test_source_pas_can_restrict_to_no_architectures(self):
-        # A source package can be restricted to not built on any architecture.
-        self.assertArchsForHint(
-            "i386 hppa amd64", [], sourcename="test",
-            pas_string="%test: sparc")
-
-    def test_source_pas_can_exclude_specific_architecture(self):
-        # A source PAS entry can exclude a specific architecture.
-        self.assertArchsForHint(
-            "i386 hppa amd64", ["hppa"], sourcename="test",
-            pas_string="%test: !i386")
-
-    def setUpPPAAndSource(self):
-        # Create a PPA and return a new source publication in it.
-        archive = self.factory.makeArchive(
-            distribution=self.publisher.ubuntutest, purpose=ArchivePurpose.PPA)
-        return self.publisher.getPubSource(
-            sourcename="test-ppa", architecturehintlist="i386 hppa",
-            archive=archive)
-
-    def test_source_pas_does_not_affect_ppa(self):
-        # PPA builds are not affected by source PAS restrictions; that is,
-        # they will build for all requested architectures currently
-        # supported in the PPA subsystem.
-        pub_ppa = self.setUpPPAAndSource()
-        self.assertArchitecturesToBuild(
-            ["i386"], pub_ppa, pas_string="%test-ppa: hppa")
-        self.assertArchitecturesToBuild(
-            ["i386"], pub_ppa, pas_string="%test-ppa: !i386")
-
-    def setUpSourceAndBinary(self):
-        # To check binary PAS listings we'll use a source publication which
-        # produces a single binary.
-        pub_single = self.publisher.getPubSource(
-            sourcename="single", architecturehintlist="any")
-        binaries = self.publisher.getPubBinaries(
-            binaryname="single-bin", pub_source=pub_single,
-            status=PackagePublishingStatus.PUBLISHED)
-        binary_names = set(
-            pub.binarypackagerelease.name
-            for pub in pub_single.getPublishedBinaries())
-        self.assertEqual(1, len(binary_names))
-        return pub_single, binaries
-
-    def test_binary_pas_unrelated_binary_lines_have_no_effect(self):
-        # Source packages are unaffected by an unrelated binary PAS line.
-        pub_single, binaries = self.setUpSourceAndBinary()
-        self.assertArchitecturesToBuild(
-            ["armel", "hppa", "i386"], pub_single, pas_string="boing: i386")
-
-    def test_binary_pas_can_restrict_architectures(self):
-        # A PAS entry can restrict the build architectures by tagging the
-        # produced binary with a list of allowed architectures.
-        pub_single, binaries = self.setUpSourceAndBinary()
-        self.assertArchitecturesToBuild(
-            ["i386"], pub_single, pas_string="single-bin: i386 sparc")
-
-    def test_binary_pas_can_exclude_specific_architecture(self):
-        # A binary PAS entry can exclude a specific architecture.
-        pub_single, binaries = self.setUpSourceAndBinary()
-        self.assertArchitecturesToBuild(
-            ["armel", "i386"], pub_single, pas_string="single-bin: !hppa")
-
-    def test_binary_pas_cannot_exclude_nominatedarchindep(self):
-        # A binary PAS entry cannot exclude the 'nominatedarchindep'
-        # architecture.  Architecture-independent binaries are only built on
-        # nominatedarchindep; if that architecture is blacklisted, those
-        # binaries will never be built.
-        pub_single, binaries = self.setUpSourceAndBinary()
-        self.assertArchitecturesToBuild(
-            ["i386"], pub_single, pas_string="single-bin: !i386 !hppa !armel")
-
-    def test_binary_pas_does_not_affect_ppa(self):
-        # PPA builds are not affected by binary PAS restrictions.
-        pub_ppa = self.setUpPPAAndSource()
-        pub_ppa.archive.require_virtualized = False
-        self.publisher.getPubBinaries(
-            binaryname="ppa-bin", pub_source=pub_ppa,
-            status=PackagePublishingStatus.PUBLISHED)
-        self.assertArchitecturesToBuild(
-            ["hppa", "i386"], pub_ppa, pas_string="")
-        self.assertArchitecturesToBuild(
-            ["hppa", "i386"], pub_ppa, pas_string="ppa-bin: !hppa")
-
-    def test_binary_pas_does_not_affect_multi_binary_sources(self):
-        # Binary PAS entries referring to binary packages whose source
-        # produces other binaries are completely ignored.  Other tools use
-        # that information, but we can't restrict builds in this
-        # circumstance.
-        pub_multiple = self.publisher.getPubSource(
-            sourcename="multiple", architecturehintlist="any")
-        for build in pub_multiple.createMissingBuilds():
-            bin_one = self.publisher.uploadBinaryForBuild(build, "bin-one")
-            self.publisher.publishBinaryInArchive(
-                bin_one, pub_multiple.archive,
-                status=PackagePublishingStatus.PUBLISHED)
-            bin_two = self.publisher.uploadBinaryForBuild(build, "bin-two")
-            self.publisher.publishBinaryInArchive(
-                bin_two, pub_multiple.archive,
-                status=PackagePublishingStatus.PUBLISHED)
-        binary_names = set(
-            pub.binarypackagerelease.name
-            for pub in pub_multiple.getPublishedBinaries())
-        self.assertEqual(2, len(binary_names))
-        self.assertArchitecturesToBuild(
-            ["armel", "hppa", "i386"], pub_multiple, pas_string="")
-        self.assertArchitecturesToBuild(
-            ["armel", "hppa", "i386"], pub_multiple,
-            pas_string="bin-one: i386 sparc")
-        self.assertArchitecturesToBuild(
-            ["armel", "hppa", "i386"], pub_multiple,
-            pas_string="bin-two: !hppa")

=== modified file 'lib/lp/soyuz/model/publishing.py'
--- lib/lp/soyuz/model/publishing.py	2013-05-30 01:07:50 +0000
+++ lib/lp/soyuz/model/publishing.py	2013-05-31 03:58:28 +0000
@@ -85,6 +85,7 @@
     ScriptRequest,
     )
 from lp.services.worlddata.model.country import Country
+from lp.soyuz.adapters.buildarch import determineArchitecturesToBuild
 from lp.soyuz.enums import (
     ArchivePurpose,
     BinaryPackageFormat,
@@ -127,7 +128,6 @@
     )
 from lp.soyuz.model.packagediff import PackageDiff
 from lp.soyuz.model.sourcepackagerelease import SourcePackageRelease
-from lp.soyuz.pas import determineArchitecturesToBuild
 
 
 def makePoolPath(source_name, component_name):
@@ -606,12 +606,8 @@
                distroarch.processorfamily in
                     self.archive.enabled_restricted_families]
 
-    def createMissingBuilds(self, architectures_available=None,
-                            pas_verify=None, logger=None):
+    def createMissingBuilds(self, architectures_available=None, logger=None):
         """See `ISourcePackagePublishingHistory`."""
-        if self.archive.is_ppa:
-            pas_verify = None
-
         if architectures_available is None:
             architectures_available = list(
                 self.distroseries.buildable_architectures)
@@ -620,7 +616,8 @@
             architectures_available)
 
         build_architectures = determineArchitecturesToBuild(
-            self, architectures_available, self.distroseries, pas_verify)
+            self.binarypackagerelease.architecturehintlist, self.archive,
+            architectures_available, self.distroseries)
 
         builds = []
         for arch in build_architectures:

=== modified file 'lib/lp/soyuz/model/queue.py'
--- lib/lp/soyuz/model/queue.py	2013-05-28 01:24:33 +0000
+++ lib/lp/soyuz/model/queue.py	2013-05-31 03:58:28 +0000
@@ -51,7 +51,6 @@
 from lp.registry.interfaces.pocket import PackagePublishingPocket
 from lp.registry.model.sourcepackagename import SourcePackageName
 from lp.services.auditor.client import AuditorClient
-from lp.services.config import config
 from lp.services.database.bulk import (
     load_referencing,
     load_related,
@@ -124,7 +123,6 @@
 from lp.soyuz.model.component import Component
 from lp.soyuz.model.distroarchseries import DistroArchSeries
 from lp.soyuz.model.section import Section
-from lp.soyuz.pas import BuildDaemonPackagesArchSpecific
 
 # There are imports below in PackageUploadCustom for various bits
 # of the archivepublisher which cause circular import errors if they
@@ -523,10 +521,7 @@
 
         debug(logger, "Creating PENDING publishing record.")
         [pub_source] = self.realiseUpload()
-        pas_verify = BuildDaemonPackagesArchSpecific(
-            config.builddmaster.root, self.distroseries)
-        builds = pub_source.createMissingBuilds(
-            pas_verify=pas_verify, logger=logger)
+        builds = pub_source.createMissingBuilds(logger=logger)
         self._validateBuildsForSource(pub_source.sourcepackagerelease, builds)
         self._closeBugs(changesfile_path, logger)
         self._giveKarma()

=== modified file 'lib/lp/soyuz/scripts/add_missing_builds.py'
--- lib/lp/soyuz/scripts/add_missing_builds.py	2012-06-29 08:40:05 +0000
+++ lib/lp/soyuz/scripts/add_missing_builds.py	2013-05-31 03:58:28 +0000
@@ -1,14 +1,11 @@
-#
-# Copyright 2009 Canonical Ltd.  This software is licensed under the
+# Copyright 2009-2013 Canonical Ltd.  This software is licensed under the
 # GNU Affero General Public License version 3 (see the file LICENSE).
 
 import sys
 
 from lp.app.errors import NotFoundError
-from lp.services.config import config
 from lp.services.scripts.base import LaunchpadScriptFailure
 from lp.soyuz.enums import PackagePublishingStatus
-from lp.soyuz.pas import BuildDaemonPackagesArchSpecific
 from lp.soyuz.scripts.ftpmasterbase import (
     SoyuzScript,
     SoyuzScriptError,
@@ -18,8 +15,8 @@
 class AddMissingBuilds(SoyuzScript):
     """Helper class to create builds in PPAs for requested architectures."""
 
-    def add_missing_builds(self, archive, required_arches, pas_verify,
-                           distroseries, pocket):
+    def add_missing_builds(self, archive, required_arches, distroseries,
+                           pocket):
         """Create builds in an archive as necessary.
 
         :param archive: The `Archive`.
@@ -71,8 +68,7 @@
         for pubrec in sources:
             self.logger.info("Considering %s" % pubrec.displayname)
             builds = pubrec.createMissingBuilds(
-                architectures_available=doable_arch_set,
-                pas_verify=pas_verify, logger=self.logger)
+                architectures_available=doable_arch_set, logger=self.logger)
             if len(builds) > 0:
                 self.logger.info("Created %s build(s)" % len(builds))
 
@@ -103,14 +99,11 @@
                     "%s not a valid architecture for %s" % (
                         arch_tag, self.location.distroseries.name))
 
-        pas_verify = BuildDaemonPackagesArchSpecific(
-            config.builddmaster.root, self.location.distroseries)
-
         # I'm tired of parsing options.  Let's do it.
         try:
             self.add_missing_builds(
-                self.location.archive, arches, pas_verify,
-                self.location.distroseries, self.location.pocket)
+                self.location.archive, arches, self.location.distroseries,
+                self.location.pocket)
             self.txn.commit()
             self.logger.info("Finished adding builds.")
         except Exception as err:

=== modified file 'lib/lp/soyuz/scripts/tests/test_add_missing_builds.py'
--- lib/lp/soyuz/scripts/tests/test_add_missing_builds.py	2011-12-30 06:14:56 +0000
+++ lib/lp/soyuz/scripts/tests/test_add_missing_builds.py	2013-05-31 03:58:28 +0000
@@ -1,13 +1,11 @@
-# Copyright 2010 Canonical Ltd.  This software is licensed under the
+# Copyright 2010-2013 Canonical Ltd.  This software is licensed under the
 # GNU Affero General Public License version 3 (see the file LICENSE).
 
 """Test the add-missing-builds.py script. """
 
 import os
-import shutil
 import subprocess
 import sys
-import tempfile
 
 from lp.registry.interfaces.pocket import PackagePublishingPocket
 from lp.services.config import config
@@ -20,7 +18,6 @@
     ArchivePurpose,
     PackagePublishingStatus,
     )
-from lp.soyuz.pas import BuildDaemonPackagesArchSpecific
 from lp.soyuz.scripts.add_missing_builds import AddMissingBuilds
 from lp.soyuz.tests.test_publishing import SoyuzTestPublisher
 from lp.testing import TestCaseWithFactory
@@ -79,17 +76,6 @@
         script.logger = BufferLogger()
         return script
 
-    def makePasVerifier(self, content, series):
-        """Create a BuildDaemonPackagesArchSpecific."""
-        temp_dir = tempfile.mkdtemp()
-        filename = os.path.join(temp_dir, "Packages-arch-specific")
-        file = open(filename, "w")
-        file.write(content)
-        file.close()
-        verifier = BuildDaemonPackagesArchSpecific(temp_dir, series)
-        shutil.rmtree(temp_dir)
-        return verifier
-
     def getBuilds(self):
         """Helper to return build records."""
         any_build_i386 = self.any.sourcepackagerelease.getBuildByArch(
@@ -173,27 +159,3 @@
             self.ppa, self.required_arches, None, self.stp.breezy_autotest,
             PackagePublishingPocket.RELEASE)
         self.assertNoBuilds()
-
-    def testPrimaryArchiveWithPas(self):
-        """Test that the script functions correctly on a primary archive.
-
-        Also verifies that it respects Packages-arch-specific in this case.
-        """
-        archive = self.stp.ubuntutest.main_archive
-        any = self.stp.getPubSource(
-            sourcename="any", architecturehintlist="any",
-            status=PackagePublishingStatus.PUBLISHED)
-        pas_any = self.stp.getPubSource(
-            sourcename="pas-any", architecturehintlist="any",
-            status=PackagePublishingStatus.PUBLISHED)
-
-        verifier = self.makePasVerifier(
-            "%pas-any: hppa", self.stp.breezy_autotest)
-        script = self.getScript()
-        script.add_missing_builds(
-            archive, self.required_arches, verifier,
-            self.stp.breezy_autotest, PackagePublishingPocket.RELEASE)
-
-        # any gets i386 and hppa builds, but pas-any is restricted to hppa.
-        self.assertEquals(len(any.getBuilds()), 2)
-        self.assertEquals(len(pas_any.getBuilds()), 1)