← Back to team overview

launchpad-reviewers team mailing list archive

[Merge] lp:~wgrant/launchpad/de-dsspr-a-few-bits into lp:launchpad

 

William Grant has proposed merging lp:~wgrant/launchpad/de-dsspr-a-few-bits into lp:launchpad.

Commit message:
DistroSeries.getCurrentSourceReleases now returns DSPRs rather than marked-for-death DSSPRs.

Requested reviews:
  Launchpad code reviewers (launchpad-reviewers)

For more details, see:
https://code.launchpad.net/~wgrant/launchpad/de-dsspr-a-few-bits/+merge/241195

DistroSeries.getCurrentSourceReleases now returns DSPRs rather than marked-for-death DSSPRs.
-- 
https://code.launchpad.net/~wgrant/launchpad/de-dsspr-a-few-bits/+merge/241195
Your team Launchpad code reviewers is requested to review the proposed merge of lp:~wgrant/launchpad/de-dsspr-a-few-bits into lp:launchpad.
=== modified file 'lib/lp/registry/browser/sourcepackage.py'
--- lib/lp/registry/browser/sourcepackage.py	2014-02-26 04:41:31 +0000
+++ lib/lp/registry/browser/sourcepackage.py	2014-11-09 02:09:58 +0000
@@ -491,7 +491,8 @@
         results = {}
         all_arch = sorted([arch.architecturetag for arch in
                            self.context.distroseries.architectures])
-        for bin in self.context.currentrelease.binaries:
+        for bin in self.context.currentrelease.getBinariesForSeries(
+                self.context.distroseries):
             distroarchseries = bin.build.distro_arch_series
             if bin.name not in results:
                 results[bin.name] = []

=== modified file 'lib/lp/registry/doc/distroseries.txt'
--- lib/lp/registry/doc/distroseries.txt	2014-07-16 00:57:21 +0000
+++ lib/lp/registry/doc/distroseries.txt	2014-11-09 02:09:58 +0000
@@ -384,10 +384,10 @@
 
 'binaries' should be inherited from parent release.
 
-    >>> bumpy_firefox_sp.currentrelease.binaries.count()
+    >>> bumpy_firefox_sp.currentrelease.getBinariesForSeries(bumpy).count()
     3
 
-    >>> for bin in bumpy_firefox_sp.currentrelease.binaries:
+    >>> for bin in bumpy_firefox_sp.currentrelease.getBinariesForSeries(bumpy):
     ...     print bin.id, bin.title, bin.build.distro_arch_series.title
     27 mozilla-firefox-data-0.9 The Warty Warthog Release for i386 (386)
     26 mozilla-firefox-0.9 The Warty Warthog Release for hppa (hppa)
@@ -397,12 +397,14 @@
 'builds' should be empty since it was built in parent (warty), not in this
 distroseries (bumby.
 
-    >>> len(bumpy_firefox_sp.currentrelease.builds)
+    >>> bumpy_firefox_dsspr = bumpy.getSourcePackageRelease(
+    ...     bumpy_firefox_sp.currentrelease.sourcepackagerelease)
+    >>> len(bumpy_firefox_dsspr.builds)
     0
 
 the SPR returns all build records for it.
 
-    >>> bumpy_firefox_sp.currentrelease.sourcepackagerelease.builds.count()
+    >>> bumpy_firefox_dsspr.sourcepackagerelease.builds.count()
     4
 
 The new series also has the same packaging links as its parent series.
@@ -570,8 +572,9 @@
 The changesfile attribute contains the package changelog. It is provided as
 an ILibraryFileAlias:
 
-    >>> firefox_srcrel =  warty.getSourcePackage(
-    ...    'mozilla-firefox').currentrelease
+    >>> firefox_dspr = warty.getSourcePackage('mozilla-firefox').currentrelease
+    >>> firefox_srcrel = warty.getSourcePackageRelease(
+    ...     firefox_dspr.sourcepackagerelease)
     >>> print firefox_srcrel.title
     "mozilla-firefox" 0.9 source package in The Warty Warthog Release
 
@@ -580,7 +583,9 @@
 
 If the package changelog is not available, that attribute is None:
 
-    >>> netapplet_srcrel = hoary.getSourcePackage('netapplet').currentrelease
+    >>> netapplet_dspr = hoary.getSourcePackage('netapplet').currentrelease
+    >>> netapplet_srcrel = hoary.getSourcePackageRelease(
+    ...     netapplet_dspr.sourcepackagerelease)
     >>> netapplet_srcrel.changesfile is None
     True
 

=== modified file 'lib/lp/registry/interfaces/distroseries.py'
--- lib/lp/registry/interfaces/distroseries.py	2014-08-19 03:46:03 +0000
+++ lib/lp/registry/interfaces/distroseries.py	2014-11-09 02:09:58 +0000
@@ -585,7 +585,7 @@
             instances.
 
         :return: a dict where the key is a `ISourcePackage`
-            and the value is a `IDistroSeriesSourcePackageRelease`.
+            and the value is a `IDistributionSourcePackageRelease`.
         """
 
     def getPublishedSources(sourcepackage_or_name, pocket=None, version=None,

=== modified file 'lib/lp/registry/model/distroseries.py'
--- lib/lp/registry/model/distroseries.py	2014-10-31 13:06:08 +0000
+++ lib/lp/registry/model/distroseries.py	2014-11-09 02:09:58 +0000
@@ -143,6 +143,9 @@
 from lp.soyuz.model.binarypackagename import BinaryPackageName
 from lp.soyuz.model.binarypackagerelease import BinaryPackageRelease
 from lp.soyuz.model.component import Component
+from lp.soyuz.model.distributionsourcepackagerelease import (
+    DistributionSourcePackageRelease,
+    )
 from lp.soyuz.model.distroarchseries import (
     DistroArchSeries,
     PocketChroot,
@@ -1525,7 +1528,7 @@
         for spr, series_id in releases:
             series = getUtility(IDistroSeriesSet).get(series_id)
             result[series.getSourcePackage(spr.sourcepackagename)] = (
-                DistroSeriesSourcePackageRelease(series, spr))
+                DistributionSourcePackageRelease(series.distribution, spr))
         return result
 
     def search(self, distribution=None, isreleased=None, orderBy=None):

=== modified file 'lib/lp/registry/model/sourcepackage.py'
--- lib/lp/registry/model/sourcepackage.py	2013-11-19 02:51:24 +0000
+++ lib/lp/registry/model/sourcepackage.py	2014-11-09 02:09:58 +0000
@@ -435,9 +435,10 @@
         for pocket in PackagePublishingPocket.items:
             thedict[pocket] = []
         # add all the sourcepackagereleases in the right place
-        for spr in result:
-            thedict[spr.pocket].append(DistroSeriesSourcePackageRelease(
-                spr.distroseries, spr.sourcepackagerelease))
+        for spph in result:
+            thedict[spph.pocket].append(
+                spph.distroseries.distribution.getSourcePackageRelease(
+                    spph.sourcepackagerelease))
         return thedict
 
     @property

=== modified file 'lib/lp/registry/templates/sourcepackage-index.pt'
--- lib/lp/registry/templates/sourcepackage-index.pt	2014-11-09 00:48:47 +0000
+++ lib/lp/registry/templates/sourcepackage-index.pt	2014-11-09 02:09:58 +0000
@@ -106,7 +106,7 @@
         <h2>Download files from current release (<span
           tal:replace="current/version">2.1.3-4</span>)</h2>
 
-        <div id="files" tal:content="structure current/distributionsourcepackagerelease/@@+files" />
+        <div id="files" tal:content="structure current/@@+files" />
 
         <h2>Package relationships</h2>
 

=== modified file 'lib/lp/soyuz/doc/publishing.txt'
--- lib/lp/soyuz/doc/publishing.txt	2014-10-31 22:53:39 +0000
+++ lib/lp/soyuz/doc/publishing.txt	2014-11-09 02:09:58 +0000
@@ -131,14 +131,14 @@
     >>> from lp.services.propertycache import get_property_cache
     >>> del get_property_cache(pub).newer_distroseries_version
     >>> print pub.newer_distroseries_version.title
-    "iceweasel" 1.1 source package in The Warty Warthog Release
+    "iceweasel" 1.1 source package in Ubuntu
 
 We can calculate the newer_distroseries_version for many spph objects at once.
 
     >>> del get_property_cache(pub).newer_distroseries_version
     >>> pub.distroseries.setNewerDistroSeriesVersions([pub])
     >>> print get_property_cache(pub).newer_distroseries_version.title
-    "iceweasel" 1.1 source package in The Warty Warthog Release
+    "iceweasel" 1.1 source package in Ubuntu
 
 A helper is also included to create a summary of the build statuses for
 the spph's related builds, getStatusSummaryForBuilds(), which just

=== modified file 'lib/lp/soyuz/interfaces/distributionsourcepackagerelease.py'
--- lib/lp/soyuz/interfaces/distributionsourcepackagerelease.py	2013-01-07 02:40:55 +0000
+++ lib/lp/soyuz/interfaces/distributionsourcepackagerelease.py	2014-11-09 02:09:58 +0000
@@ -50,3 +50,6 @@
     sample_binary_packages = Attribute("A single binary package of each "
         "named package produced from this source package in this "
         "distribution. The are each of form DistroSeriesBinaryPackage.")
+
+    def getBinariesForSeries(distroseries):
+        """Return this SourcePackageRelease's binaries in this DistroSeries."""

=== modified file 'lib/lp/soyuz/model/distributionsourcepackagerelease.py'
--- lib/lp/soyuz/model/distributionsourcepackagerelease.py	2014-09-01 13:47:50 +0000
+++ lib/lp/soyuz/model/distributionsourcepackagerelease.py	2014-11-09 02:09:58 +0000
@@ -9,6 +9,8 @@
     'DistributionSourcePackageRelease',
     ]
 
+from operator import itemgetter
+
 from lazr.delegates import delegates
 from storm.expr import (
     And,
@@ -75,7 +77,7 @@
     @property
     def displayname(self):
         """See IDistributionSourcePackageRelease."""
-        return '%s in %s' % (self.name, self.distribution.name)
+        return '%s %s' % (self.name, self.version)
 
     @property
     def title(self):
@@ -191,3 +193,39 @@
                 publishing.binarypackagerelease.binarypackagename,
                 package_cache)
         return DecoratedResultSet(all_published, make_dsb_package)
+
+    def getBinariesForSeries(self, distroseries):
+        """See `IDistroSeriesSourcePackageRelease`."""
+        # Avoid circular imports.
+        from lp.soyuz.model.distroarchseries import DistroArchSeries
+        store = Store.of(distroseries)
+        result_row = (
+            BinaryPackageRelease, BinaryPackageBuild, BinaryPackageName)
+
+        tables = (
+            BinaryPackageRelease,
+            Join(
+                BinaryPackageBuild,
+                BinaryPackageBuild.id == BinaryPackageRelease.buildID),
+            Join(
+                BinaryPackagePublishingHistory,
+                BinaryPackageRelease.id ==
+                BinaryPackagePublishingHistory.binarypackagereleaseID),
+            Join(
+                DistroArchSeries,
+                DistroArchSeries.id ==
+                BinaryPackagePublishingHistory.distroarchseriesID),
+            Join(
+                BinaryPackageName,
+                BinaryPackageName.id ==
+                BinaryPackageRelease.binarypackagenameID))
+        archive_ids = list(self.distribution.all_distro_archive_ids)
+        binaries = store.using(*tables).find(
+            result_row,
+            And(
+                DistroArchSeries.distroseriesID == distroseries.id,
+                BinaryPackagePublishingHistory.archiveID.is_in(archive_ids),
+                BinaryPackageBuild.source_package_release ==
+                    self.sourcepackagerelease))
+        binaries.order_by(Desc(BinaryPackageRelease.id)).config(distinct=True)
+        return DecoratedResultSet(binaries, itemgetter(0))

=== modified file 'lib/lp/soyuz/model/distroseriessourcepackagerelease.py'
--- lib/lp/soyuz/model/distroseriessourcepackagerelease.py	2014-11-09 00:48:47 +0000
+++ lib/lp/soyuz/model/distroseriessourcepackagerelease.py	2014-11-09 02:09:58 +0000
@@ -135,44 +135,6 @@
         return self.sourcepackagerelease.files
 
     @property
-    def binaries(self):
-        """See `IDistroSeriesSourcePackageRelease`."""
-        # Avoid circular imports.
-        from lp.soyuz.model.distroarchseries import DistroArchSeries
-        store = Store.of(self.distroseries)
-        result_row = (
-            BinaryPackageRelease, BinaryPackageBuild, BinaryPackageName)
-
-        tables = (
-            BinaryPackageRelease,
-            Join(
-                BinaryPackageBuild,
-                BinaryPackageBuild.id == BinaryPackageRelease.buildID),
-            Join(
-                BinaryPackagePublishingHistory,
-                BinaryPackageRelease.id ==
-                BinaryPackagePublishingHistory.binarypackagereleaseID),
-            Join(
-                DistroArchSeries,
-                DistroArchSeries.id ==
-                BinaryPackagePublishingHistory.distroarchseriesID),
-            Join(
-                BinaryPackageName,
-                BinaryPackageName.id ==
-                BinaryPackageRelease.binarypackagenameID))
-        archive_ids = list(
-            self.distroseries.distribution.all_distro_archive_ids)
-        binaries = store.using(*tables).find(
-            result_row,
-            And(
-                DistroArchSeries.distroseriesID == self.distroseries.id,
-                BinaryPackagePublishingHistory.archiveID.is_in(archive_ids),
-                BinaryPackageBuild.source_package_release ==
-                self.sourcepackagerelease))
-        binaries.order_by(Desc(BinaryPackageRelease.id)).config(distinct=True)
-        return DecoratedResultSet(binaries, itemgetter(0))
-
-    @property
     def changesfile(self):
         """See `IDistroSeriesSourcePackageRelease`."""
         return self.sourcepackagerelease.upload_changesfile

=== modified file 'lib/lp/soyuz/stories/ppa/xx-ubuntu-ppas.txt'
--- lib/lp/soyuz/stories/ppa/xx-ubuntu-ppas.txt	2014-07-24 09:37:03 +0000
+++ lib/lp/soyuz/stories/ppa/xx-ubuntu-ppas.txt	2014-11-09 02:09:58 +0000
@@ -352,10 +352,10 @@
                                         no signer (2007-07-09)
     pmount              0.1-1           no signer (2007-07-09)
 
-The link itself will point to the newer version in the distro series.
+The link itself will point to the newer version in the distribution.
 
     >>> print anon_browser.getLink('Newer version').url
-    http://launchpad.dev/ubuntu/warty/+source/iceweasel/1.1
+    http://launchpad.dev/ubuntu/+source/iceweasel/1.1
 
 A Latest updates portlet is included on the index page indicating the
 latest published sources with their states.

=== modified file 'lib/lp/soyuz/stories/soyuz/xx-distroseries-sources.txt'
--- lib/lp/soyuz/stories/soyuz/xx-distroseries-sources.txt	2014-11-09 00:48:47 +0000
+++ lib/lp/soyuz/stories/soyuz/xx-distroseries-sources.txt	2014-11-09 02:09:58 +0000
@@ -231,11 +231,17 @@
 
 
 We can visit a specific published release of "mozilla-firefox", this
-page is provided by an DistroSeriesSourcePackageRelease instance:
+page is provided by an DistributionSourcePackageRelease instance:
 
   >>> browser.getLink("mozilla-firefox 0.9").click()
   >>> browser.url
-  'http://launchpad.dev/ubuntu/warty/+source/mozilla-firefox/0.9'
+  'http://launchpad.dev/ubuntu/+source/mozilla-firefox/0.9'
+
+There's also a very similar view that's being phased out:
+DistroSeriesSourcePackageRelease:+index.
+
+  >>> browser.open(
+  ...     'http://launchpad.dev/ubuntu/warty/+source/mozilla-firefox/0.9')
 
 There we can see the respective 'changelog' content for this version:
 
@@ -283,8 +289,7 @@
 Let's check how the page behaves if we no files are present:
 
   >>> browser.open(
-  ...     'http://launchpad.dev/ubuntu/hoary/+source/cnews')
-  >>> browser.getLink("cnews cr.g7-37").click()
+  ...     'http://launchpad.dev/ubuntu/hoary/+source/cnews/cr.g7-37')
 
 A string is presented in both 'changesfile' and 'files' sections,
 warning the user that no file is available:
@@ -314,7 +319,7 @@
 We can see 'commercialpackage' is published once in pocket RELEASE:
 
     >>> print browser.getLink('commercialpackage 1.0-1').url
-    http://launchpad.dev/ubuntu/breezy-autotest/+source/commercialpackage/1.0-1
+    http://launchpad.dev/ubuntu/+source/commercialpackage/1.0-1
 
 The user can also download the files for the "currentrelease" (last
 published version) if they are available:
@@ -377,12 +382,19 @@
     ...     "http://launchpad.dev/ubuntu/breezy-autotest/+source/";
     ...     "commercialpackage")
 
-We can visit a specific published release of "mozilla-firefox", this
-page is provided by an DistroSeriesSourcePackageRelease instance:
+We can visit a specific published release of "commercialpackage", this
+page is provided by a DistributionSourcePackageRelease instance:
 
     >>> browser.getLink("commercialpackage 1.0-1").click()
     >>> browser.url
-    'http://launchpad.dev/ubuntu/breezy-autotest/+source/commercialpackage/1.0-1'
+    'http://launchpad.dev/ubuntu/+source/commercialpackage/1.0-1'
+
+The DistroSeriesSourcePackageRelease view also works for partner
+packages, but it's being phased out.
+
+    >>> browser.open(
+    ...     'http://launchpad.dev/ubuntu/breezy-autotest/+source/'
+    ...     'commercialpackage/1.0-1')
 
 There we can see the respective 'changelog' content for this version:
 


Follow ups