← Back to team overview

launchpad-reviewers team mailing list archive

[Merge] lp:~wgrant/launchpad/kill-spr-productrelease into lp:launchpad

 

William Grant has proposed merging lp:~wgrant/launchpad/kill-spr-productrelease into lp:launchpad with lp:~wgrant/launchpad/faster-gCSR as a prerequisite.

Requested reviews:
  William Grant (wgrant)

For more details, see:
https://code.launchpad.net/~wgrant/launchpad/kill-spr-productrelease/+merge/113539

SourcePackageRelease.productrelease looks unused. Let's kill it.
-- 
https://code.launchpad.net/~wgrant/launchpad/kill-spr-productrelease/+merge/113539
Your team Launchpad code reviewers is subscribed to branch lp:launchpad.
=== modified file 'lib/lp/soyuz/doc/sourcepackagerelease.txt'
--- lib/lp/soyuz/doc/sourcepackagerelease.txt	2011-12-24 17:49:30 +0000
+++ lib/lp/soyuz/doc/sourcepackagerelease.txt	2012-07-05 10:42:33 +0000
@@ -82,16 +82,6 @@
    >>> set(build.archive.purpose.name for build in spr.builds)
    set(['PRIMARY'])
 
-We can use the magic productrelease property to map this to a ProductRelease:
-
-   >>> pr = spr.productrelease
-   >>> print pr.product.name
-   firefox
-   >>> print pr.productseries.name
-   trunk
-   >>> print pr.version
-   0.9
-
 We can use the sourcepackage and distrosourcepackage properties to
 grab magical objects representing that package in the distribution to
 which it was uploaded:
@@ -101,27 +91,6 @@
    >>> print spr.distrosourcepackage.displayname
    mozilla-firefox in Ubuntu
 
-It should also work when the version has a dash and packaging revision
-after it:
-
-   >>> spr = SourcePackageRelease.get(16)
-   >>> print spr.name
-   netapplet
-   >>> print spr.version
-   1.0-1
-   >>> pr = spr.productrelease
-   >>> print pr.product.name
-   netapplet
-   >>> print pr.productseries.name
-   trunk
-   >>> print pr.version
-   1.0
-
-If there isn't one, that should return None.
-
-   >>> print SourcePackageRelease.get(20).productrelease
-   None
-
 Check that the uploaded changesfile works:
 
    >>> commercial = SourcePackageRelease.get(36)
@@ -131,7 +100,7 @@
 Check ISourcePackageRelease.override() behaviour:
 
    >>> spr.component.name, spr.section.name
-   (u'main', u'editors')
+   (u'main', u'base')
 
    >>> from lp.soyuz.interfaces.component import IComponentSet
    >>> from lp.soyuz.interfaces.section import ISectionSet

=== modified file 'lib/lp/soyuz/interfaces/sourcepackagerelease.py'
--- lib/lp/soyuz/interfaces/sourcepackagerelease.py	2011-12-24 16:54:44 +0000
+++ lib/lp/soyuz/interfaces/sourcepackagerelease.py	2012-07-05 10:42:33 +0000
@@ -135,8 +135,6 @@
     distrosourcepackage = Attribute(
         "The magic DistroSourcePackage for the sourcepackagename and "
         "distribution of this object.")
-    productrelease = Attribute("The best guess we have as to the Launchpad "
-        "ProductRelease associated with this SourcePackageRelease.")
 
     current_publishings = Attribute("A list of the current places where "
         "this source package is published, in the form of a list of "

=== modified file 'lib/lp/soyuz/model/sourcepackagerelease.py'
--- lib/lp/soyuz/model/sourcepackagerelease.py	2012-02-07 14:53:38 +0000
+++ lib/lp/soyuz/model/sourcepackagerelease.py	2012-07-05 10:42:33 +0000
@@ -61,10 +61,7 @@
     LibraryFileContent,
     )
 from lp.services.propertycache import cachedproperty
-from lp.soyuz.enums import (
-    PackageDiffStatus,
-    PackagePublishingStatus,
-    )
+from lp.soyuz.enums import PackageDiffStatus
 from lp.soyuz.interfaces.archive import MAIN_ARCHIVE_PURPOSES
 from lp.soyuz.interfaces.binarypackagebuild import IBinaryPackageBuildSet
 from lp.soyuz.interfaces.packagediff import PackageDiffAlreadyRequested
@@ -72,10 +69,7 @@
 from lp.soyuz.model.binarypackagebuild import BinaryPackageBuild
 from lp.soyuz.model.files import SourcePackageReleaseFile
 from lp.soyuz.model.packagediff import PackageDiff
-from lp.soyuz.model.publishing import (
-    BinaryPackagePublishingHistory,
-    SourcePackagePublishingHistory,
-    )
+from lp.soyuz.model.publishing import BinaryPackagePublishingHistory
 from lp.soyuz.model.queue import (
     PackageUpload,
     PackageUploadSource,
@@ -295,54 +289,6 @@
         return '%s - %s' % (self.sourcepackagename.name, self.version)
 
     @property
-    def productrelease(self):
-        """See ISourcePackageRelease."""
-        series = None
-
-        # Use any published source package to find the product series.
-        # We can do this because if we ever find out that a source package
-        # release in two product series, we've almost certainly got a data
-        # problem there.
-        publishings = SourcePackagePublishingHistory.select(
-            """
-            sourcepackagerelease = %s AND
-            status = %s
-            """ % sqlvalues(self, PackagePublishingStatus.PUBLISHED))
-
-        for publishing in publishings:
-            # imports us, so avoid circular import
-            from lp.registry.model.sourcepackage import \
-                 SourcePackage
-            # Only process main archives and skip PPA/copy archives.
-            if publishing.archive.purpose not in MAIN_ARCHIVE_PURPOSES:
-                continue
-            sp = SourcePackage(self.sourcepackagename,
-                               publishing.distroseries)
-            sp_series = sp.productseries
-            if sp_series is not None:
-                if series is None:
-                    series = sp_series
-                elif series != sp_series:
-                    # XXX: keybuk 2005-06-22: We could warn about this.
-                    pass
-
-        # No series -- no release
-        if series is None:
-            return None
-
-        # XXX: keybuk 2005-06-22:
-        # Find any release with the exact same version, or which
-        # we begin with and after a dash.  We could be more intelligent
-        # about this, but for now this will work for most.
-        for release in series.releases:
-            if release.version == self.version:
-                return release
-            elif self.version.startswith("%s-" % release.version):
-                return release
-        else:
-            return None
-
-    @property
     def current_publishings(self):
         """See ISourcePackageRelease."""
         from lp.soyuz.model.distroseriessourcepackagerelease \


Follow ups