← Back to team overview

launchpad-reviewers team mailing list archive

[Merge] lp:~cjwatson/launchpad/remove-exclude-pocket into lp:launchpad

 

Colin Watson has proposed merging lp:~cjwatson/launchpad/remove-exclude-pocket into lp:launchpad.

Requested reviews:
  Launchpad code reviewers (launchpad-reviewers)

For more details, see:
https://code.launchpad.net/~cjwatson/launchpad/remove-exclude-pocket/+merge/88030

== Summary ==

The exclude_pocket parameter to DistroSeries.getPublishedSources and DistroArchSeries.getReleasedPackages was added in r3147.2.52, but all its non-test users have since been removed, and it's not exported.  It therefore seems to be cruft and should be removed.

== Tests ==

bin/test -vvct distroseries -t distroarchseries

== Demo and Q/A ==

None.

== lint ==

Quite a bit of lint in some of these files seemed to have survived Jeroen's recent megalint branches.  I cleaned it up.
-- 
https://code.launchpad.net/~cjwatson/launchpad/remove-exclude-pocket/+merge/88030
Your team Launchpad code reviewers is requested to review the proposed merge of lp:~cjwatson/launchpad/remove-exclude-pocket into lp:launchpad.
=== modified file 'lib/lp/registry/interfaces/distroseries.py'
--- lib/lp/registry/interfaces/distroseries.py	2011-12-24 16:54:44 +0000
+++ lib/lp/registry/interfaces/distroseries.py	2012-01-10 10:41:50 +0000
@@ -1,4 +1,4 @@
-# Copyright 2009-2011 Canonical Ltd.  This software is licensed under the
+# Copyright 2009-2012 Canonical Ltd.  This software is licensed under the
 # GNU Affero General Public License version 3 (see the file LICENSE).
 
 # pylint: disable-msg=E0211,E0213
@@ -603,8 +603,7 @@
         """
 
     def getPublishedSources(sourcepackage_or_name, pocket=None, version=None,
-                            include_pending=False, exclude_pocket=None,
-                            archive=None):
+                            include_pending=False, archive=None):
         """Return the SourcePackagePublishingHistory(s)
 
         Deprecated.  Use IArchive.getPublishedSources instead.
@@ -615,9 +614,6 @@
 
         If version is not specified, return packages with any version.
 
-        If exclude_pocket is specified we exclude results matching that
-        pocket.
-
         If 'include_pending' is True, we return also the pending publication
         records, those packages that will get published in the next publisher
         run (it's only useful when we need to know if a given package is

=== modified file 'lib/lp/registry/model/distroseries.py'
--- lib/lp/registry/model/distroseries.py	2012-01-03 05:05:39 +0000
+++ lib/lp/registry/model/distroseries.py	2012-01-10 10:41:50 +0000
@@ -1,4 +1,4 @@
-# Copyright 2009-2011 Canonical Ltd.  This software is licensed under the
+# Copyright 2009-2012 Canonical Ltd.  This software is licensed under the
 # GNU Affero General Public License version 3 (see the file LICENSE).
 
 # pylint: disable-msg=E0611,W0212
@@ -1081,7 +1081,7 @@
 
     def getPublishedSources(self, sourcepackage_or_name, version=None,
                              pocket=None, include_pending=False,
-                             exclude_pocket=None, archive=None):
+                             archive=None):
         """See `IDistroSeries`."""
         # Deprecated.  Use IArchive.getPublishedSources instead.
 
@@ -1111,9 +1111,6 @@
         if version is not None:
             queries.append("version=%s" % sqlvalues(version))
 
-        if exclude_pocket is not None:
-            queries.append("pocket!=%s" % sqlvalues(exclude_pocket.value))
-
         if include_pending:
             queries.append("status in (%s, %s)" % sqlvalues(
                 PackagePublishingStatus.PUBLISHED,

=== modified file 'lib/lp/soyuz/doc/distroarchseries.txt'
--- lib/lp/soyuz/doc/distroarchseries.txt	2012-01-06 11:08:30 +0000
+++ lib/lp/soyuz/doc/distroarchseries.txt	2012-01-10 10:41:50 +0000
@@ -2,19 +2,23 @@
 Distro Arch Series
 ==================
 
-   >>> from lp.services.webapp.testing import verifyObject
-
-   >>> from lp.soyuz.interfaces.distroarchseriesbinarypackage import IDistroArchSeriesBinaryPackage
-   >>> from lp.soyuz.interfaces.publishing import IBinaryPackagePublishingHistory
-   >>> from lp.soyuz.interfaces.section import ISectionSet
-
-   >>> from lp.registry.interfaces.distribution import IDistributionSet
-   >>> ubuntu = getUtility(IDistributionSet).getByName('ubuntu')
-   >>> hoary = ubuntu.getSeries('hoary')
+    >>> from lp.services.webapp.testing import verifyObject
+
+    >>> from lp.soyuz.interfaces.distroarchseriesbinarypackage import (
+    ...     IDistroArchSeriesBinaryPackage,
+    ...     )
+    >>> from lp.soyuz.interfaces.publishing import (
+    ...     IBinaryPackagePublishingHistory
+    ...     )
+    >>> from lp.soyuz.interfaces.section import ISectionSet
+
+    >>> from lp.registry.interfaces.distribution import IDistributionSet
+    >>> ubuntu = getUtility(IDistributionSet).getByName('ubuntu')
+    >>> hoary = ubuntu.getSeries('hoary')
 
 DistroArchSeries are retrieved via __getitem__:
 
-   >>> hoary_i386 = hoary['i386']
+    >>> hoary_i386 = hoary['i386']
 
 or getDistroArchSeries():
 
@@ -54,19 +58,19 @@
 one version spread across the pockets. getReleasedPackages lets us
 interrogate this information.
 
-   >>> for p in hoary_i386.getReleasedPackages("pmount"):
-   ...     print p.binarypackagerelease.binarypackagename.name
-   pmount
+    >>> for p in hoary_i386.getReleasedPackages("pmount"):
+    ...     print p.binarypackagerelease.binarypackagename.name
+    pmount
 
 See more information about getReleasePackages below.
 
 Check the behavior of the provided search method, which returns a
 list of IDARBPR instances containing the matching packages.
 
-   >>> results = hoary_i386.searchBinaryPackages(text='pmount')
-   >>> results.count()
-   1
-   >>> pmount = results[0]
+    >>> results = hoary_i386.searchBinaryPackages(text='pmount')
+    >>> results.count()
+    1
+    >>> pmount = results[0]
 
 The method works even when we are searching for packages whose names are
 not fti-matchable, such as "linux-2.6.12", and substrings:
@@ -84,72 +88,72 @@
     DistroArchSeriesBinaryPackageRelease: mozilla-firefox
     DistroArchSeriesBinaryPackageRelease: mozilla-firefox-data
 
-   # XXX cprov 2006-03-21: Broken implementation, missing enhances attribute.
-   verifyObject(IDistroArchSeriesBinaryPackageRelease, pmount)
-   True
+    # XXX cprov 2006-03-21: Broken implementation, missing enhances attribute.
+    verifyObject(IDistroArchSeriesBinaryPackageRelease, pmount)
+    True
 
 Check IDARBP provider
 
-   >>> pmount_hoary_i386 = hoary_i386.getBinaryPackage('pmount')
-
-   >>> verifyObject(IDistroArchSeriesBinaryPackage, pmount_hoary_i386)
-   True
-
-   >>> pmount_hoary_i386.name
-   u'pmount'
+    >>> pmount_hoary_i386 = hoary_i386.getBinaryPackage('pmount')
+
+    >>> verifyObject(IDistroArchSeriesBinaryPackage, pmount_hoary_i386)
+    True
+
+    >>> pmount_hoary_i386.name
+    u'pmount'
 
 
 Check some properties of DARBP meta class
 
 Entire publishing history:
 
-   >>> pmount_hoary_i386.publishing_history.count()
-   2
+    >>> pmount_hoary_i386.publishing_history.count()
+    2
 
 Most recent published history row:
 
-   >>> bpph = pmount_hoary_i386.current_published
-
-   # XXX cprov 2006-03-22: The object doesn't pass verifyObject()
-   # due the lack of distroarchseriesbinarypackagerelease attribute.
-
-   >>> IBinaryPackagePublishingHistory.providedBy(bpph)
-   True
-
-   >>> bpph.section.name
-   u'editors'
+    >>> bpph = pmount_hoary_i386.current_published
+
+    # XXX cprov 2006-03-22: The object doesn't pass verifyObject()
+    # due the lack of distroarchseriesbinarypackagerelease attribute.
+
+    >>> IBinaryPackagePublishingHistory.providedBy(bpph)
+    True
+
+    >>> bpph.section.name
+    u'editors'
 
 Perform `post publication` override:
 
-   >>> new_section = getUtility(ISectionSet)['base']
-   >>> version = bpph.binarypackagerelease.version
-   >>> pmount_hoary_i386_released = pmount_hoary_i386[version]
+    >>> new_section = getUtility(ISectionSet)['base']
+    >>> version = bpph.binarypackagerelease.version
+    >>> pmount_hoary_i386_released = pmount_hoary_i386[version]
 
-   >>> pmount_i386_pub = pmount_hoary_i386_released.current_publishing_record
-   >>> override = pmount_i386_pub.changeOverride(
-   ...     new_section=new_section)
-   >>> override.section == new_section
-   True
-   >>> override.status.name
-   'PENDING'
-   >>> pub_hist = pmount_hoary_i386.publishing_history
-   >>> pub_hist.count()
-   3
+    >>> pmount_i386_pub = pmount_hoary_i386_released.current_publishing_record
+    >>> override = pmount_i386_pub.changeOverride(
+    ...     new_section=new_section)
+    >>> override.section == new_section
+    True
+    >>> override.status.name
+    'PENDING'
+    >>> pub_hist = pmount_hoary_i386.publishing_history
+    >>> pub_hist.count()
+    3
 
 Override information about 'pmount' is pending publication:
 
-   >>> pub_hist[0].status.name, pub_hist[0].section.name
-   ('PENDING', u'base')
+    >>> pub_hist[0].status.name, pub_hist[0].section.name
+    ('PENDING', u'base')
 
 Supersede current publication:
 
-   >>> pub = pmount_hoary_i386_released.current_publishing_record
-   >>> pub.supersede()
-   >>> pmount_hoary_i386.publishing_history.count()
-   3
+    >>> pub = pmount_hoary_i386_released.current_publishing_record
+    >>> pub.supersede()
+    >>> pmount_hoary_i386.publishing_history.count()
+    3
 
-   >>> print pub.status.name, pub.datesuperseded is not None
-   SUPERSEDED True
+    >>> print pub.status.name, pub.datesuperseded is not None
+    SUPERSEDED True
 
 
 Binary publishing lookups
@@ -248,24 +252,6 @@
     >>> soyuz_helper.checkPubList(updates_main_pubs, result)
     True
 
-Using 'exclude_pocket' filter, to exclude publications to RELEASE pocket:
-
-    >>> non_release_main_pubs = [
-    ...     pub_main_proposed_published,
-    ...     pub_main_updates_pending,
-    ...     ]
-
-    >>> non_release_main_pubs = sorted(
-    ...    non_release_main_pubs, key=operator.attrgetter('id'),
-    ...    reverse=True)
-
-    >>> result = bt_i386.getReleasedPackages(
-    ...     'at', include_pending=True,
-    ...     exclude_pocket=PackagePublishingPocket.RELEASE)
-
-    >>> soyuz_helper.checkPubList(non_release_main_pubs, result)
-    True
-
 Looking for all PUBLISHED or PENDING publications in cprov PPA and all
 pockets.
 

=== modified file 'lib/lp/soyuz/doc/distroseries-publishing-lookups.txt'
--- lib/lp/soyuz/doc/distroseries-publishing-lookups.txt	2010-10-17 15:44:08 +0000
+++ lib/lp/soyuz/doc/distroseries-publishing-lookups.txt	2012-01-10 10:41:50 +0000
@@ -96,25 +96,6 @@
     >>> soyuz_helper.checkPubList(updates_main_pubs, result)
     True
 
-Using 'exclude_pocket' filter, to exclude publications to RELEASE pocket:
-
-    >>> non_release_main_pubs = [
-    ...     pub_main_proposed_published,
-    ...     pub_main_updates_pending,
-    ...     ]
-
-
-    >>> non_release_main_pubs = sorted(
-    ...    non_release_main_pubs, key=operator.attrgetter('id'),
-    ...    reverse=True)
-
-    >>> result = breezy_autotest.getPublishedSources(
-    ...     'cnews', include_pending=True,
-    ...     exclude_pocket=PackagePublishingPocket.RELEASE)
-
-    >>> soyuz_helper.checkPubList(non_release_main_pubs, result)
-    True
-
 Looking for all PUBLISHED or PENDING publications in cprov PPA and all
 pockets.
 

=== modified file 'lib/lp/soyuz/interfaces/distroarchseries.py'
--- lib/lp/soyuz/interfaces/distroarchseries.py	2011-12-24 16:54:44 +0000
+++ lib/lp/soyuz/interfaces/distroarchseries.py	2012-01-10 10:41:50 +0000
@@ -1,4 +1,4 @@
-# Copyright 2009 Canonical Ltd.  This software is licensed under the
+# Copyright 2009-2012 Canonical Ltd.  This software is licensed under the
 # GNU Affero General Public License version 3 (see the file LICENSE).
 
 # pylint: disable-msg=E0211,E0213
@@ -123,7 +123,7 @@
         )
     main_archive = exported(
         Reference(
-            Interface, # Really IArchive, circular import fixed below.
+            Interface,  # Really IArchive, circular import fixed below.
             title=_('Main Archive'),
             description=_("The main archive of the distroarchseries.")))
     chroot_url = exported(
@@ -156,21 +156,21 @@
         matching the given text."""
 
     def getReleasedPackages(binary_name, pocket=None, include_pending=False,
-                            exclude_pocket=None, archive=None):
+                            archive=None):
         """Get the publishing records for the given binary package name.
 
         :param: binary_name: should either be a `BinaryPackageName` instance
             or else a string which will be looked up as a `BinaryPackageName`;
-        :param: pocket: optional `PackagePublishingPocket` filter, if it is not
-            specified, we look in all pockets.
-        :param: exclude_pocket: optional negative `PackagePublishingPocket`
-            filter, if it is specified exclude results matching that pocket.
-        :param: include_pending: optionally return also the pending publication
-            records, those packages that will get published in the next publisher
-            run (it's only useful when we need to know if a given package is
-            known during a publisher run, mostly in pre-upload checks)
-        :param: archive: optional IArchive filter, if is not specified, consider
-            publication in the main_archives, otherwise respect the given value.
+        :param: pocket: optional `PackagePublishingPocket` filter, if it is
+            not specified, we look in all pockets.
+        :param: include_pending: optionally return also the pending
+            publication records, those packages that will get published in the
+            next publisher run (it's only useful when we need to know if a
+            given package is known during a publisher run, mostly in
+            pre-upload checks)
+        :param: archive: optional IArchive filter, if is not specified,
+            consider publication in the main_archives, otherwise respect the
+            given value.
 
         If the BinaryPackageName cannot be found, NotFoundError will be
         raised.

=== modified file 'lib/lp/soyuz/model/distroarchseries.py'
--- lib/lp/soyuz/model/distroarchseries.py	2011-12-30 06:14:56 +0000
+++ lib/lp/soyuz/model/distroarchseries.py	2012-01-10 10:41:50 +0000
@@ -1,4 +1,4 @@
-# Copyright 2009-2011 Canonical Ltd.  This software is licensed under the
+# Copyright 2009-2012 Canonical Ltd.  This software is licensed under the
 # GNU Affero General Public License version 3 (see the file LICENSE).
 
 # pylint: disable-msg=E0611,W0212
@@ -271,8 +271,7 @@
             pocket)
 
     def getReleasedPackages(self, binary_name, pocket=None,
-                            include_pending=False, exclude_pocket=None,
-                            archive=None):
+                            include_pending=False, archive=None):
         """See IDistroArchSeries."""
         queries = []
 
@@ -288,9 +287,6 @@
         if pocket is not None:
             queries.append("pocket=%s" % sqlvalues(pocket.value))
 
-        if exclude_pocket is not None:
-            queries.append("pocket!=%s" % sqlvalues(exclude_pocket.value))
-
         if include_pending:
             queries.append("status in (%s, %s)" % sqlvalues(
                 PackagePublishingStatus.PUBLISHED,