launchpad-reviewers team mailing list archive
-
launchpad-reviewers team
-
Mailing list archive
-
Message #17179
[Merge] lp:~wgrant/launchpad/dont-getReleasedPackages into lp:launchpad
William Grant has proposed merging lp:~wgrant/launchpad/dont-getReleasedPackages into lp:launchpad with lp:~wgrant/launchpad/nu-overrides-refactor as a prerequisite.
Commit message:
Kill off DistroArchSeries.getReleasedPackages. It was only used by archiveuploader.
Requested reviews:
Launchpad code reviewers (launchpad-reviewers)
For more details, see:
https://code.launchpad.net/~wgrant/launchpad/dont-getReleasedPackages/+merge/227502
Kill off DistroArchSeries.getReleasedPackages. It was only used by archiveuploader.
--
https://code.launchpad.net/~wgrant/launchpad/dont-getReleasedPackages/+merge/227502
Your team Launchpad code reviewers is requested to review the proposed merge of lp:~wgrant/launchpad/dont-getReleasedPackages into lp:launchpad.
=== modified file 'lib/lp/registry/doc/distroseries.txt'
--- lib/lp/registry/doc/distroseries.txt 2014-07-07 03:32:50 +0000
+++ lib/lp/registry/doc/distroseries.txt 2014-07-21 06:46:11 +0000
@@ -327,6 +327,7 @@
publishing records etc. Essentially this is a "Do not push this button
again" type set of assertions.
+ >>> from lp.soyuz.enums import PackagePublishingStatus
>>> from lp.soyuz.scripts.initialize_distroseries import (
... InitializeDistroSeries)
>>> login("foo.bar@xxxxxxxxxxxxx")
@@ -340,9 +341,12 @@
1
>>> humpy.getPublishedSources('pmount').count()
1
- >>> len(hoary['i386'].getReleasedPackages('pmount'))
+ >>> hoary.main_archive.getAllPublishedBinaries(
+ ... distroarchseries=hoary['i386'], name='pmount',
+ ... status=PackagePublishingStatus.PUBLISHED).count()
1
- >>> len(humpy['i386'].getReleasedPackages('pmount'))
+ >>> humpy.main_archive.getAllPublishedBinaries(
+ ... distroarchseries=humpy['i386'], name='pmount').count()
1
Check if the attributes of an DRSPR instance for the just initialized
@@ -631,7 +635,6 @@
instance. it can also be used to generate the archive packages list in
the future.
- >>> from lp.soyuz.enums import PackagePublishingStatus
>>> ubuntu = getUtility(IDistributionSet)['ubuntu']
>>> hoary = ubuntu['hoary']
>>> component_main = getUtility(IComponentSet)['main']
=== modified file 'lib/lp/soyuz/doc/distroarchseries.txt'
--- lib/lp/soyuz/doc/distroarchseries.txt 2014-01-30 15:04:06 +0000
+++ lib/lp/soyuz/doc/distroarchseries.txt 2014-07-21 06:46:11 +0000
@@ -52,18 +52,6 @@
DistroArchSeries can tell you about their published releases
============================================================
-DistroArchSeries has a number of releases of any given binary
-package in them. This can be due to various reasons such as uploads in
-progress, superseding in progress, or simply that there is more than
-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
-
-See more information about getReleasePackages below.
-
Check the behaviour of the provided search method, which returns a
list of IDARBPR instances containing the matching packages.
@@ -158,120 +146,6 @@
SUPERSEDED True
-Binary publishing lookups
-=========================
-
-IDistroArchseries allows binary publishing lookup via
-getReleasedPackages method which returns a shortlist of
-IBinaryPackagePublishingHistory ordered by descending ID.
-
-In order to test its behaviour we will create a bunch of sample
-publishing records with different (status, pocket, archive) in
-ubuntu/breezy-autotest/i386, which is empty:
-
- >>> from lp.registry.interfaces.distribution import IDistributionSet
- >>> from lp.registry.interfaces.person import IPersonSet
- >>> from lp.registry.interfaces.pocket import PackagePublishingPocket
- >>> from lp.soyuz.model.publishing import (
- ... BinaryPackagePublishingHistory)
-
- >>> ubuntu = getUtility(IDistributionSet)['ubuntu']
- >>> breezy_autotest = ubuntu['breezy-autotest']
- >>> bt_i386 = breezy_autotest['i386']
- >>> cprov_archive = getUtility(IPersonSet).getByName('cprov').archive
-
-We will use a 'at' binarypackage because it's not published yet in the
-architecture we want to test, this will help to make the tests as clear
-as possible.
-
- >>> warty = ubuntu['warty']
- >>> at_warty_i386 = warty['i386'].getBinaryPackage('at')
- >>> sample_bpr = at_warty_i386.currentrelease.binarypackagerelease
-
- >>> BinaryPackagePublishingHistory.selectBy(
- ... distroarchseries=bt_i386, binarypackagerelease=sample_bpr).count()
- 0
-
-Create and collect several binary publishing records in a variety of
-states, pockets and archives:
-
- >>> from lp.soyuz.tests.soyuz import SoyuzTestHelper
-
- >>> soyuz_helper = SoyuzTestHelper()
- >>> sample_pub = soyuz_helper.createPublishingForDistroArchSeries(
- ... sample_bpr, bt_i386)
-
- >>> [pub_main_release_pending, pub_main_release_published,
- ... pub_main_updates_pending, pub_main_proposed_published,
- ... pub_ppa_release_pending, pub_ppa_release_published,
- ... pub_ppa_updates_pending, pub_ppa_proposed_published] = sample_pub
-
-Looking for all PUBLISHED publications in main_archive and all
-pockets:
-
- >>> all_published_main_pubs = [
- ... pub_main_proposed_published,
- ... pub_main_release_published,
- ... ]
-
- >>> import operator
- >>> all_published_main_pubs = sorted(
- ... all_published_main_pubs, key=operator.attrgetter('id'),
- ... reverse=True)
-
- >>> result = bt_i386.getReleasedPackages('at')
- >>> soyuz_helper.checkPubList(all_published_main_pubs, result)
- True
-
-Looking for all PUBLISHED or PENDING publications in main_archive and all
-pockets.
-
- >>> all_main_pubs = [
- ... pub_main_proposed_published,
- ... pub_main_updates_pending,
- ... pub_main_release_published,
- ... pub_main_release_pending,
- ... ]
-
- >>> all_main_pubs = sorted(
- ... all_main_pubs, key=operator.attrgetter('id'),
- ... reverse=True)
-
- >>> result = bt_i386.getReleasedPackages('at', include_pending=True)
- >>> soyuz_helper.checkPubList(all_main_pubs, result)
- True
-
-Using 'pocket' filter:
-
- >>> updates_main_pubs = [
- ... pub_main_updates_pending,
- ... ]
-
- >>> result = bt_i386.getReleasedPackages(
- ... 'at', include_pending=True,
- ... pocket=PackagePublishingPocket.UPDATES)
-
- >>> soyuz_helper.checkPubList(updates_main_pubs, result)
- True
-
-Looking for all PUBLISHED or PENDING publications in cprov PPA and all
-pockets.
-
- >>> all_ppa_pubs = [
- ... pub_ppa_proposed_published,
- ... pub_ppa_updates_pending,
- ... pub_ppa_release_published,
- ... pub_ppa_release_pending,
- ... ]
-
- >>> all_ppa_pubs = sorted(
- ... all_ppa_pubs, key=operator.attrgetter('id'), reverse=True)
-
- >>> result = bt_i386.getReleasedPackages(
- ... 'at', include_pending=True, archive=cprov_archive)
- >>> soyuz_helper.checkPubList(all_ppa_pubs, result)
- True
-
DistroArchSeries Lookup
=======================
=== modified file 'lib/lp/soyuz/doc/distroseries-publishing-lookups.txt'
--- lib/lp/soyuz/doc/distroseries-publishing-lookups.txt 2014-01-30 15:04:06 +0000
+++ lib/lp/soyuz/doc/distroseries-publishing-lookups.txt 2014-07-21 06:46:11 +0000
@@ -1,8 +1,8 @@
DistroSeries source publishing lookups
======================================
-IDistroSeries allows source publishing lookup via
-getReleasedPackages method which returns a shortlist of
+IDistroSeries allows source publishing lookup via the
+getPublishedSources method which returns a shortlist of
ISourcePackagePublishingHistory ordered by descending ID.
In order to test its behaviour we will create a bunch of sample
=== modified file 'lib/lp/soyuz/interfaces/distroarchseries.py'
--- lib/lp/soyuz/interfaces/distroarchseries.py 2013-12-13 13:31:24 +0000
+++ lib/lp/soyuz/interfaces/distroarchseries.py 2014-07-21 06:46:11 +0000
@@ -166,29 +166,6 @@
"""Search BinaryPackageRelease published in this series for those
matching the given text."""
- def getReleasedPackages(binary_name, pocket=None, include_pending=False,
- 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: 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.
-
- :return: a `shortlist` of `IBinaryPackagePublishingHistory` records.
- """
-
def __getitem__(name):
"""Getter"""
=== modified file 'lib/lp/soyuz/model/distroarchseries.py'
--- lib/lp/soyuz/model/distroarchseries.py 2014-07-08 22:31:49 +0000
+++ lib/lp/soyuz/model/distroarchseries.py 2014-07-21 06:46:11 +0000
@@ -42,7 +42,6 @@
fti_search,
rank_by_fti,
)
-from lp.services.helpers import shortlist
from lp.services.librarian.interfaces import ILibraryFileAliasSet
from lp.services.webapp.publisher import (
get_raw_form_value_from_current_request,
@@ -276,43 +275,6 @@
return getUtility(IBinaryPackageBuildSet).getBuildsForDistro(
self, build_state, name, pocket)
- def getReleasedPackages(self, binary_name, pocket=None,
- include_pending=False, archive=None):
- """See IDistroArchSeries."""
- from lp.soyuz.model.publishing import BinaryPackagePublishingHistory
-
- queries = []
-
- if not IBinaryPackageName.providedBy(binary_name):
- binary_name = BinaryPackageName.byName(binary_name)
-
- queries.append("""
- binarypackagerelease=binarypackagerelease.id AND
- binarypackagerelease.binarypackagename=%s AND
- distroarchseries = %s
- """ % sqlvalues(binary_name, self))
-
- if pocket is not None:
- queries.append("pocket=%s" % sqlvalues(pocket.value))
-
- if include_pending:
- queries.append("status in (%s, %s)" % sqlvalues(
- PackagePublishingStatus.PUBLISHED,
- PackagePublishingStatus.PENDING))
- else:
- queries.append("status=%s" % sqlvalues(
- PackagePublishingStatus.PUBLISHED))
-
- archives = self.distroseries.distribution.getArchiveIDList(archive)
- queries.append("archive IN %s" % sqlvalues(archives))
-
- published = BinaryPackagePublishingHistory.select(
- " AND ".join(queries),
- clauseTables=['BinaryPackageRelease'],
- orderBy=['-id'])
-
- return shortlist(published)
-
@property
def main_archive(self):
return self.distroseries.distribution.main_archive
=== modified file 'lib/lp/soyuz/scripts/tests/test_initialize_distroseries.py'
--- lib/lp/soyuz/scripts/tests/test_initialize_distroseries.py 2014-07-04 11:21:54 +0000
+++ lib/lp/soyuz/scripts/tests/test_initialize_distroseries.py 2014-07-21 06:46:11 +0000
@@ -554,14 +554,12 @@
u'udev', distroseries=child)
self.assertEqual(
parent_udev_pubs.count(), child_udev_pubs.count())
- parent_arch_udev_pubs = parent[
- parent_das.architecturetag].getReleasedPackages(
- 'udev', include_pending=True)
- child_arch_udev_pubs = child[
- parent_das.architecturetag].getReleasedPackages(
- 'udev', include_pending=True)
+ parent_arch_udev_pubs = parent.main_archive.getAllPublishedBinaries(
+ distroarchseries=parent[parent_das.architecturetag], name='udev')
+ child_arch_udev_pubs = child.main_archive.getAllPublishedBinaries(
+ distroarchseries=child[parent_das.architecturetag], name='udev')
self.assertEqual(
- len(parent_arch_udev_pubs), len(child_arch_udev_pubs))
+ parent_arch_udev_pubs.count(), child_arch_udev_pubs.count())
# And the binary package, and linked source package look fine too.
udev_bin = child_arch_udev_pubs[0].binarypackagerelease
self.assertEqual(udev_bin.title, u'udev-0.1-1')
Follow ups