Merge lp:~lifeless/launchpad/bug-279513 into lp:launchpad

Proposed by Robert Collins on 2011-02-24
Status: Work in progress
Proposed branch: lp:~lifeless/launchpad/bug-279513
Merge into: lp:launchpad
Diff against target: 427 lines (+63/-173)
11 files modified
lib/lp/bugs/browser/bugtask.py (+28/-15)
lib/lp/bugs/browser/tests/bugtask-target-link-titles.txt (+4/-2)
lib/lp/bugs/stories/bugs/xx-bug-index.txt (+15/-3)
lib/lp/registry/browser/product.py (+2/-2)
lib/lp/registry/interfaces/distribution.py (+0/-19)
lib/lp/registry/model/distribution.py (+0/-58)
lib/lp/registry/model/distributionsourcepackage.py (+4/-2)
lib/lp/registry/tests/test_distribution.py (+0/-66)
lib/lp/registry/tests/test_distroseries.py (+5/-5)
lib/lp/soyuz/doc/closing-bugs-from-changelogs.txt (+4/-1)
lib/lp/soyuz/stories/soyuz/xx-distributionsourcepackagerelease-pages.txt (+1/-0)
To merge this branch: bzr merge lp:~lifeless/launchpad/bug-279513
Reviewer Review Type Date Requested Status
j.c.sackett (community) Approve on 2011-02-24
William Grant code* 2011-02-24 Approve on 2011-02-24
Review via email: mp+51063@code.launchpad.net

Commit Message

[r=jcsackett,wgrant][bug=279513] Delete Distribution.getCurrentSourceReleases as not modelling user needs well.

Description of the Change

Distribution.getCurrentSourceReleases returns arbitrary uninteresting versions - when folk speak about 'ubuntu' they mean 'ubuntu.currentseries' (and in fact the currentseries attribute explains this). This branch just deletes the inappropriate Distribution.getCurrentSourceReleases and changes the 3 callers to indirect via the currentseries attribute.

We could alternatively make Distribution.getCurrentSourceReleases batch indirect via the relevant distro series, but I think the overall deletion of code is more of a win. We may have some tests that need updating, but I'll wait for ec2 to complain.

To post a comment you must log in.
William Grant (wgrant) wrote :

I don't like the DistributionSourcePackage.currentrelease change, but it's probably cleaner than the alternative. Otherwise this is fine.

review: Approve (code*)
j.c.sackett (jcsackett) wrote :

This looks good to land.

review: Approve
lp:~lifeless/launchpad/bug-279513 updated on 2011-03-02
12445. By Robert Collins on 2011-02-25

Merge devel.

12446. By Robert Collins on 2011-02-25

Unbreak distro source package.currentrelease property.

12447. By Robert Collins on 2011-02-26

Fix the first issue in closing-bugs-from-changelogs.

12448. By Robert Collins on 2011-03-01

Fix from wgrant for closing-bugs-from-changelogs.txt.

12449. By Robert Collins on 2011-03-01

Handle no-distroseries distributions again in bugtask labels.

12450. By Robert Collins on 2011-03-02

Merge trunk.

12451. By Robert Collins on 2011-03-02

snapshotting.

Robert Collins (lifeless) wrote :

I'm abandoning this - its a bit of a rabbit warren, and the perf wins are relatively small compared to the initial work. We are really broken right now, but this is something to do when things are fast, not right now.

Unmerged revisions

12451. By Robert Collins on 2011-03-02

snapshotting.

12450. By Robert Collins on 2011-03-02

Merge trunk.

12449. By Robert Collins on 2011-03-01

Handle no-distroseries distributions again in bugtask labels.

12448. By Robert Collins on 2011-03-01

Fix from wgrant for closing-bugs-from-changelogs.txt.

12447. By Robert Collins on 2011-02-26

Fix the first issue in closing-bugs-from-changelogs.

12446. By Robert Collins on 2011-02-25

Unbreak distro source package.currentrelease property.

12445. By Robert Collins on 2011-02-25

Merge devel.

12444. By Robert Collins on 2011-02-24

Get rid of buggy 'look up in a random distroseries' Distribution.getCurrentSourceReleases, in favour of using the Distribution.currentseries consistently.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'lib/lp/bugs/browser/bugtask.py'
--- lib/lp/bugs/browser/bugtask.py 2011-03-01 05:05:26 +0000
+++ lib/lp/bugs/browser/bugtask.py 2011-03-02 05:19:17 +0000
@@ -250,7 +250,6 @@
250from lp.bugs.interfaces.malone import IMaloneApplication250from lp.bugs.interfaces.malone import IMaloneApplication
251from lp.registry.interfaces.distribution import (251from lp.registry.interfaces.distribution import (
252 IDistribution,252 IDistribution,
253 IDistributionSet,
254 )253 )
255from lp.registry.interfaces.distributionsourcepackage import (254from lp.registry.interfaces.distributionsourcepackage import (
256 IDistributionSourcePackage,255 IDistributionSourcePackage,
@@ -267,6 +266,7 @@
267from lp.registry.interfaces.productseries import IProductSeries266from lp.registry.interfaces.productseries import IProductSeries
268from lp.registry.interfaces.projectgroup import IProjectGroup267from lp.registry.interfaces.projectgroup import IProjectGroup
269from lp.registry.interfaces.sourcepackage import ISourcePackage268from lp.registry.interfaces.sourcepackage import ISourcePackage
269from lp.registry.model.sourcepackage import SourcePackage
270from lp.registry.vocabularies import MilestoneVocabulary270from lp.registry.vocabularies import MilestoneVocabulary
271from lp.services.fields import PersonChoice271from lp.services.fields import PersonChoice
272from lp.services.propertycache import cachedproperty272from lp.services.propertycache import cachedproperty
@@ -3152,32 +3152,45 @@
3152 self.many_bugtasks = len(self.bugtasks) >= 103152 self.many_bugtasks = len(self.bugtasks) >= 10
3153 self.cached_milestone_source = CachedMilestoneSourceFactory()3153 self.cached_milestone_source = CachedMilestoneSourceFactory()
3154 self.user_is_subscribed = self.context.isSubscribed(self.user)3154 self.user_is_subscribed = self.context.isSubscribed(self.user)
3155 distro_packages = defaultdict(list)
3156 distro_series_packages = defaultdict(list)3155 distro_series_packages = defaultdict(list)
3157 for bugtask in self.bugtasks:3156 for bugtask in self.bugtasks:
3158 target = bugtask.target3157 target = bugtask.target
3159 if IDistributionSourcePackage.providedBy(target):3158 if IDistributionSourcePackage.providedBy(target):
3160 distro_packages[target.distribution].append(3159 distro_series = target.distribution.currentseries
3161 target.sourcepackagename)3160 if distro_series is not None:
3161 distro_series_packages[distro_series].append(
3162 target.sourcepackagename)
3162 if ISourcePackage.providedBy(target):3163 if ISourcePackage.providedBy(target):
3163 distro_series_packages[target.distroseries].append(3164 distro_series_packages[target.distroseries].append(
3164 target.sourcepackagename)3165 target.sourcepackagename)
3165 distro_set = getUtility(IDistributionSet)
3166 self.target_releases = dict(distro_set.getCurrentSourceReleases(
3167 distro_packages))
3168 distro_series_set = getUtility(IDistroSeriesSet)3166 distro_series_set = getUtility(IDistroSeriesSet)
3169 self.target_releases.update(3167 self.target_releases = distro_series_set.getCurrentSourceReleases(
3170 distro_series_set.getCurrentSourceReleases(distro_series_packages))3168 distro_series_packages)
3169
3170 def _get_target_release(self, target):
3171 """Get a target release for target."""
3172 error = None
3173 if not (IDistributionSourcePackage.providedBy(target) or
3174 ISourcePackage.providedBy(target)):
3175 return None, None
3176 distribution = target.distribution
3177 if IDistributionSourcePackage.providedBy(target):
3178 target = SourcePackage(target.sourcepackagename,
3179 distribution.currentseries)
3180 if target.distroseries is not None:
3181 current_release = self.target_releases.get(target)
3182 else:
3183 current_release = None
3184 if current_release is None:
3185 error = "No current release for this source package in %s" % (
3186 distribution.displayname)
3187 return current_release, error
31713188
3172 def getTargetLinkTitle(self, target):3189 def getTargetLinkTitle(self, target):
3173 """Return text to put as the title for the link to the target."""3190 """Return text to put as the title for the link to the target."""
3174 if not (IDistributionSourcePackage.providedBy(target) or3191 current_release, result = self._get_target_release(target)
3175 ISourcePackage.providedBy(target)):
3176 return None
3177 current_release = self.target_releases.get(target)
3178 if current_release is None:3192 if current_release is None:
3179 return "No current release for this source package in %s" % (3193 return result
3180 target.distribution.displayname)
3181 uploader = current_release.creator3194 uploader = current_release.creator
3182 maintainer = current_release.maintainer3195 maintainer = current_release.maintainer
3183 return (3196 return (
31843197
=== modified file 'lib/lp/bugs/browser/tests/bugtask-target-link-titles.txt'
--- lib/lp/bugs/browser/tests/bugtask-target-link-titles.txt 2010-08-22 18:31:30 +0000
+++ lib/lp/bugs/browser/tests/bugtask-target-link-titles.txt 2011-03-02 05:19:17 +0000
@@ -89,6 +89,8 @@
89 >>> print view.getTargetLinkTitle(published_distro)89 >>> print view.getTargetLinkTitle(published_distro)
90 None90 None
91 >>> view = set_up_view(published_evolution)91 >>> view = set_up_view(published_evolution)
92 >>> from lp.registry.interfaces.series import SeriesStatus
93 >>> published_distro.currentseries.status = SeriesStatus.FROZEN
92 >>> print view.getTargetLinkTitle(published_evolution)94 >>> print view.getTargetLinkTitle(published_evolution)
93 Latest release: 1.0, uploaded to universe on 2008-07-18 09:30:15+00:0095 Latest release: 1.0, uploaded to universe on 2008-07-18 09:30:15+00:00
94 by Foo Bar (name16), maintained by No Privileges Person (no-priv)96 by Foo Bar (name16), maintained by No Privileges Person (no-priv)
@@ -192,7 +194,7 @@
192 >>> view = BugTasksAndNominationsView(bug, None)194 >>> view = BugTasksAndNominationsView(bug, None)
193 >>> view.initialize()195 >>> view.initialize()
194 >>> for bug_target in bug_targets:196 >>> for bug_target in bug_targets:
195 ... release = view.target_releases.get(bug_target)197 ... release, _ = view._get_target_release(bug_target)
196 ... if release is None:198 ... if release is None:
197 ... version = 'No releases'199 ... version = 'No releases'
198 ... else:200 ... else:
@@ -201,7 +203,7 @@
201 product: No releases203 product: No releases
202 product/product-series: No releases204 product/product-series: No releases
203 published-distro: No releases205 published-distro: No releases
204 evolution (Published Distro): 2.0206 evolution (Published Distro): 1.0
205 Published-distro Published-distro-series: No releases207 Published-distro Published-distro-series: No releases
206 evolution (Published-distro Published-distro-series): 1.0208 evolution (Published-distro Published-distro-series): 1.0
207 unpublished-distro: No releases209 unpublished-distro: No releases
208210
=== modified file 'lib/lp/bugs/stories/bugs/xx-bug-index.txt'
--- lib/lp/bugs/stories/bugs/xx-bug-index.txt 2010-05-19 05:47:50 +0000
+++ lib/lp/bugs/stories/bugs/xx-bug-index.txt 2011-03-02 05:19:17 +0000
@@ -61,11 +61,23 @@
61 161 1
6262
63If the context is a distribution package, the package name has a63If the context is a distribution package, the package name has a
64tooltip containing the package details.64tooltip containing the package details. The detailed tests for the tooltip
65contents are in lib/lp/bugs/browser/tests/bugtask-target-link-titles.txt so we
66just need to check that one is set - that the layers are wired together.
67
68 >>> from zope.component import getUtility
69 >>> from lp.registry.interfaces.distribution import IDistributionSet
70 >>> ubuntu = getUtility(IDistributionSet).getByName('ubuntu')
71 >>> mozilla = ubuntu.getSourcePackage('mozilla-firefox')
72 >>> mozilla_release = factory.makeSourcePackageRelease(
73 ... sourcepackagename=mozilla.sourcepackagename,
74 ... distroseries=mozilla.distribution.currentseries,
75 ... archive=mozilla.distribution.main_archive, version='0.9')
76
6577
66 >>> print anon_browser.getLink('mozilla-firefox (Ubuntu)').attrs['title']78 >>> print anon_browser.getLink('mozilla-firefox (Ubuntu)').attrs['title']
67 Latest release: 0.9, uploaded to main on 2004-09-27 11:57:13+00:00...79 Latest release: 0.9, uploaded to main on ...
68 by Mark Shuttleworth (mark), maintained by Mark Shuttleworth (mark)80 by ..., maintained by ...
6981
70 >>> print anon_browser.getLink('mozilla-firefox (Debian)').attrs['title']82 >>> print anon_browser.getLink('mozilla-firefox (Debian)').attrs['title']
71 No current release for this source package in Debian83 No current release for this source package in Debian
7284
=== modified file 'lib/lp/registry/browser/product.py'
--- lib/lp/registry/browser/product.py 2011-02-05 06:11:48 +0000
+++ lib/lp/registry/browser/product.py 2011-03-02 05:19:17 +0000
@@ -2038,9 +2038,9 @@
2038 # Set the source_package_release attribute on the licenses2038 # Set the source_package_release attribute on the licenses
2039 # widget, so that the source package's copyright info can be2039 # widget, so that the source package's copyright info can be
2040 # displayed.2040 # displayed.
2041 ubuntu = getUtility(ILaunchpadCelebrities).ubuntu2041 ubuntu_dev = getUtility(ILaunchpadCelebrities).ubuntu.currentseries
2042 if self.source_package_name is not None:2042 if self.source_package_name is not None:
2043 release_list = ubuntu.getCurrentSourceReleases(2043 release_list = ubuntu_dev.getCurrentSourceReleases(
2044 [self.source_package_name])2044 [self.source_package_name])
2045 if len(release_list) != 0:2045 if len(release_list) != 0:
2046 self.widgets['licenses'].source_package_release = (2046 self.widgets['licenses'].source_package_release = (
20472047
=== modified file 'lib/lp/registry/interfaces/distribution.py'
--- lib/lp/registry/interfaces/distribution.py 2011-02-24 15:30:54 +0000
+++ lib/lp/registry/interfaces/distribution.py 2011-03-02 05:19:17 +0000
@@ -417,16 +417,6 @@
417 Receives a sourcepackagerelease.417 Receives a sourcepackagerelease.
418 """418 """
419419
420 def getCurrentSourceReleases(source_package_names):
421 """Get the current release of a list of source packages.
422
423 :param source_package_names: a list of `ISourcePackageName`
424 instances.
425
426 :return: a dict where the key is a `IDistributionSourcePackage`
427 and the value is a `IDistributionSourcePackageRelease`.
428 """
429
430 def getDistroSeriesAndPocket(distroseriesname):420 def getDistroSeriesAndPocket(distroseriesname):
431 """Return a (distroseries,pocket) tuple which is the given textual421 """Return a (distroseries,pocket) tuple which is the given textual
432 distroseriesname in this distribution."""422 distroseriesname in this distribution."""
@@ -692,15 +682,6 @@
692 members, owner, mugshot=None, logo=None, icon=None):682 members, owner, mugshot=None, logo=None, icon=None):
693 """Create a new distribution."""683 """Create a new distribution."""
694684
695 def getCurrentSourceReleases(distro_to_source_packagenames):
696 """Lookup many distribution source package releases.
697
698 :param distro_to_source_packagenames: A dictionary with
699 its keys being `IDistribution` and its values a list of
700 `ISourcePackageName`.
701 :return: A dict as per `IDistribution.getCurrentSourceReleases`
702 """
703
704685
705class NoSuchDistribution(NameLookupFailed):686class NoSuchDistribution(NameLookupFailed):
706 """Raised when we try to find a distribution that doesn't exist."""687 """Raised when we try to find a distribution that doesn't exist."""
707688
=== modified file 'lib/lp/registry/model/distribution.py'
--- lib/lp/registry/model/distribution.py 2011-03-01 05:05:26 +0000
+++ lib/lp/registry/model/distribution.py 2011-03-02 05:19:17 +0000
@@ -775,11 +775,6 @@
775 """See `IDistribution`."""775 """See `IDistribution`."""
776 return DistributionSourcePackageRelease(self, sourcepackagerelease)776 return DistributionSourcePackageRelease(self, sourcepackagerelease)
777777
778 def getCurrentSourceReleases(self, source_package_names):
779 """See `IDistribution`."""
780 return getUtility(IDistributionSet).getCurrentSourceReleases(
781 {self:source_package_names})
782
783 @property778 @property
784 def has_any_specifications(self):779 def has_any_specifications(self):
785 """See `IHasSpecifications`."""780 """See `IHasSpecifications`."""
@@ -1900,56 +1895,3 @@
1900 getUtility(IArchiveSet).new(distribution=distro,1895 getUtility(IArchiveSet).new(distribution=distro,
1901 owner=owner, purpose=ArchivePurpose.PRIMARY)1896 owner=owner, purpose=ArchivePurpose.PRIMARY)
1902 return distro1897 return distro
1903
1904 def getCurrentSourceReleases(self, distro_source_packagenames):
1905 """See `IDistributionSet`."""
1906 # Builds one query for all the distro_source_packagenames.
1907 # This may need tuning: its possible that grouping by the common
1908 # archives may yield better efficiency: the current code is
1909 # just a direct push-down of the previous in-python lookup to SQL.
1910 series_clauses = []
1911 distro_lookup = {}
1912 for distro, package_names in distro_source_packagenames.items():
1913 source_package_ids = map(attrgetter('id'), package_names)
1914 # all_distro_archive_ids is just a list of ints, but it gets
1915 # wrapped anyway - and sqlvalues goes boom.
1916 archives = removeSecurityProxy(
1917 distro.all_distro_archive_ids)
1918 clause = """(spr.sourcepackagename IN %s AND
1919 spph.archive IN %s AND
1920 ds.distribution = %s)
1921 """ % sqlvalues(source_package_ids, archives, distro.id)
1922 series_clauses.append(clause)
1923 distro_lookup[distro.id] = distro
1924 if not len(series_clauses):
1925 return {}
1926 combined_clause = "(" + " OR ".join(series_clauses) + ")"
1927
1928 releases = IStore(SourcePackageRelease).find(
1929 (SourcePackageRelease, Distribution.id), SQL("""
1930 (SourcePackageRelease.id, Distribution.id) IN (
1931 SELECT DISTINCT ON (
1932 spr.sourcepackagename, ds.distribution)
1933 spr.id, ds.distribution
1934 FROM
1935 SourcePackageRelease AS spr,
1936 SourcePackagePublishingHistory AS spph,
1937 DistroSeries AS ds
1938 WHERE
1939 spph.sourcepackagerelease = spr.id
1940 AND spph.distroseries = ds.id
1941 AND spph.status IN %s
1942 AND %s
1943 ORDER BY
1944 spr.sourcepackagename, ds.distribution, spph.id DESC
1945 )
1946 """
1947 % (sqlvalues(active_publishing_status) + (combined_clause,))))
1948 result = {}
1949 for sp_release, distro_id in releases:
1950 distro = distro_lookup[distro_id]
1951 sourcepackage = distro.getSourcePackage(
1952 sp_release.sourcepackagename)
1953 result[sourcepackage] = DistributionSourcePackageRelease(
1954 distro, sp_release)
1955 return result
19561898
=== modified file 'lib/lp/registry/model/distributionsourcepackage.py'
--- lib/lp/registry/model/distributionsourcepackage.py 2011-01-21 08:12:29 +0000
+++ lib/lp/registry/model/distributionsourcepackage.py 2011-03-02 05:19:17 +0000
@@ -298,9 +298,11 @@
298 @property298 @property
299 def currentrelease(self):299 def currentrelease(self):
300 """See `IDistributionSourcePackage`."""300 """See `IDistributionSourcePackage`."""
301 releases = self.distribution.getCurrentSourceReleases(301 releases = self.distribution.currentseries.getCurrentSourceReleases(
302 [self.sourcepackagename])302 [self.sourcepackagename])
303 return releases.get(self)303 if releases:
304 return releases.values()[0]
305 return None
304306
305 def bugtasks(self, quantity=None):307 def bugtasks(self, quantity=None):
306 """See `IDistributionSourcePackage`."""308 """See `IDistributionSourcePackage`."""
307309
=== modified file 'lib/lp/registry/tests/test_distribution.py'
--- lib/lp/registry/tests/test_distribution.py 2010-10-24 12:46:23 +0000
+++ lib/lp/registry/tests/test_distribution.py 2011-03-02 05:19:17 +0000
@@ -6,7 +6,6 @@
6__metaclass__ = type6__metaclass__ = type
77
8from lazr.lifecycle.snapshot import Snapshot8from lazr.lifecycle.snapshot import Snapshot
9from zope.security.proxy import removeSecurityProxy
109
11from canonical.testing.layers import (10from canonical.testing.layers import (
12 DatabaseFunctionalLayer,11 DatabaseFunctionalLayer,
@@ -15,13 +14,6 @@
15from lp.registry.errors import NoSuchDistroSeries14from lp.registry.errors import NoSuchDistroSeries
16from lp.registry.interfaces.distribution import IDistribution15from lp.registry.interfaces.distribution import IDistribution
17from lp.registry.interfaces.series import SeriesStatus16from lp.registry.interfaces.series import SeriesStatus
18from lp.registry.tests.test_distroseries import (
19 TestDistroSeriesCurrentSourceReleases,
20 )
21from lp.services.propertycache import get_property_cache
22from lp.soyuz.interfaces.distributionsourcepackagerelease import (
23 IDistributionSourcePackageRelease,
24 )
25from lp.testing import TestCaseWithFactory17from lp.testing import TestCaseWithFactory
2618
2719
@@ -48,64 +40,6 @@
48 self.assertEqual("'\\u0170-distro'", displayname)40 self.assertEqual("'\\u0170-distro'", displayname)
4941
5042
51class TestDistributionCurrentSourceReleases(
52 TestDistroSeriesCurrentSourceReleases):
53 """Test for Distribution.getCurrentSourceReleases().
54
55 This works in the same way as
56 DistroSeries.getCurrentSourceReleases() works, except that we look
57 for the latest published source across multiple distro series.
58 """
59
60 layer = LaunchpadFunctionalLayer
61 release_interface = IDistributionSourcePackageRelease
62
63 @property
64 def test_target(self):
65 return self.distribution
66
67 def test_which_distroseries_does_not_matter(self):
68 # When checking for the current release, we only care about the
69 # version numbers. We don't care whether the version is
70 # published in a earlier or later series.
71 self.current_series = self.factory.makeDistroRelease(
72 self.distribution, '1.0', status=SeriesStatus.CURRENT)
73 self.publisher.getPubSource(
74 version='0.9', distroseries=self.current_series)
75 self.publisher.getPubSource(
76 version='1.0', distroseries=self.development_series)
77 self.assertCurrentVersion('1.0')
78
79 self.publisher.getPubSource(
80 version='1.1', distroseries=self.current_series)
81 self.assertCurrentVersion('1.1')
82
83 def test_distribution_series_cache(self):
84 distribution = removeSecurityProxy(
85 self.factory.makeDistribution('foo'))
86
87 cache = get_property_cache(distribution)
88
89 # Not yet cached.
90 self.assertNotIn("series", cache)
91
92 # Now cached.
93 series = distribution.series
94 self.assertIs(series, cache.series)
95
96 # Cache cleared.
97 distribution.newSeries(
98 name='bar', displayname='Bar', title='Bar', summary='',
99 description='', version='1', parent_series=None,
100 owner=self.factory.makePerson())
101 self.assertNotIn("series", cache)
102
103 # New cached value.
104 series = distribution.series
105 self.assertEqual(1, len(series))
106 self.assertIs(series, cache.series)
107
108
109class SeriesByStatusTests(TestCaseWithFactory):43class SeriesByStatusTests(TestCaseWithFactory):
110 """Test IDistribution.getSeriesByStatus().44 """Test IDistribution.getSeriesByStatus().
111 """45 """
11246
=== modified file 'lib/lp/registry/tests/test_distroseries.py'
--- lib/lp/registry/tests/test_distroseries.py 2010-10-26 15:47:24 +0000
+++ lib/lp/registry/tests/test_distroseries.py 2011-03-02 05:19:17 +0000
@@ -152,13 +152,13 @@
152 def test_get_multiple(self):152 def test_get_multiple(self):
153 # getCurrentSourceReleases() allows you to get information about153 # getCurrentSourceReleases() allows you to get information about
154 # the current release for multiple packages at the same time.154 # the current release for multiple packages at the same time.
155 # This is done using a single DB query, making it more efficient155 # This is done using a set queries, making it more efficient than
156 # than using IDistributionSource.currentrelease.156 # looking up each package separately.
157 self.publisher.getPubSource(version='0.9', sourcename='foo')157 self.publisher.getPubSource(version='0.9', sourcename='foo')
158 self.publisher.getPubSource(version='1.0', sourcename='bar')158 self.publisher.getPubSource(version='1.0', sourcename='bar')
159 foo_package = self.distribution.getSourcePackage('foo')159 foo_package = self.publisher.distroseries.getSourcePackage('foo')
160 bar_package = self.distribution.getSourcePackage('bar')160 bar_package = self.publisher.distroseries.getSourcePackage('bar')
161 releases = self.distribution.getCurrentSourceReleases(161 releases = self.publisher.distroseries.getCurrentSourceReleases(
162 [foo_package.sourcepackagename, bar_package.sourcepackagename])162 [foo_package.sourcepackagename, bar_package.sourcepackagename])
163 self.assertEqual(releases[foo_package].version, '0.9')163 self.assertEqual(releases[foo_package].version, '0.9')
164 self.assertEqual(releases[bar_package].version, '1.0')164 self.assertEqual(releases[bar_package].version, '1.0')
165165
=== modified file 'lib/lp/soyuz/doc/closing-bugs-from-changelogs.txt'
--- lib/lp/soyuz/doc/closing-bugs-from-changelogs.txt 2010-11-01 15:46:48 +0000
+++ lib/lp/soyuz/doc/closing-bugs-from-changelogs.txt 2011-03-02 05:19:17 +0000
@@ -209,7 +209,10 @@
209is "NEW".209is "NEW".
210210
211 >>> cdrkit_ubuntu = ubuntu.getSourcePackage('cdrkit')211 >>> cdrkit_ubuntu = ubuntu.getSourcePackage('cdrkit')
212 >>> cdrkit_release = cdrkit_ubuntu.currentrelease.sourcepackagerelease212 >>> cdrkit_release = factory.makeSourcePackageRelease(
213 ... sourcepackagename=cdrkit_ubuntu.sourcepackagename,
214 ... distroseries=cdrkit_ubuntu.distribution['warty'],
215 ... archive=cdrkit_ubuntu.distribution.main_archive, version='1.0')
213216
214 >>> cdrkit_bug_id = cdrkit_ubuntu.createBug(bug_params).id217 >>> cdrkit_bug_id = cdrkit_ubuntu.createBug(bug_params).id
215218
216219
=== modified file 'lib/lp/soyuz/stories/soyuz/xx-distributionsourcepackagerelease-pages.txt'
--- lib/lp/soyuz/stories/soyuz/xx-distributionsourcepackagerelease-pages.txt 2011-01-12 23:07:40 +0000
+++ lib/lp/soyuz/stories/soyuz/xx-distributionsourcepackagerelease-pages.txt 2011-03-02 05:19:17 +0000
@@ -12,6 +12,7 @@
12 >>> stp = SoyuzTestPublisher()12 >>> stp = SoyuzTestPublisher()
13 >>> login('foo.bar@canonical.com')13 >>> login('foo.bar@canonical.com')
14 >>> stp.prepareBreezyAutotest()14 >>> stp.prepareBreezyAutotest()
15 >>> stp.distroseries = stp.ubuntutest.currentseries
15 >>> source = stp.getPubSource('testing-dspr', version='1.0')16 >>> source = stp.getPubSource('testing-dspr', version='1.0')
16 >>> source.setPublished()17 >>> source.setPublished()
17 >>> binaries = stp.getPubBinaries(pub_source=source)18 >>> binaries = stp.getPubBinaries(pub_source=source)