Merge lp:~al-maisan/launchpad/subsets into lp:launchpad/db-devel

Proposed by Muharem Hrnjadovic
Status: Merged
Merged at revision: not available
Proposed branch: lp:~al-maisan/launchpad/subsets
Merge into: lp:launchpad/db-devel
Diff against target: 146 lines
2 files modified
lib/lp/soyuz/model/packageset.py (+6/-2)
lib/lp/soyuz/stories/webservice/xx-packageset.txt (+59/-33)
To merge this branch: bzr merge lp:~al-maisan/launchpad/subsets
Reviewer Review Type Date Requested Status
Michael Nelson (community) release-critical Approve
Graham Binns (community) Approve
Review via email: mp+14343@code.launchpad.net
To post a comment you must log in.
Revision history for this message
Muharem Hrnjadovic (al-maisan) wrote :

Hello there!

The branch at hand fixes bug #472326. When a package set P is to add/remove
another package (sub-)set Q then both P and Q must be related to the same
distro series.

The bug was discovered during testing on Soyuz dogfood and is
release-critical.

Tests to run:

    bin/test -vv -t packageset.txt

Revision history for this message
Graham Binns (gmb) :
review: Approve
Revision history for this message
Michael Nelson (michael.nelson) :
review: Approve (release-critical)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'lib/lp/soyuz/model/packageset.py'
--- lib/lp/soyuz/model/packageset.py 2009-10-30 20:28:16 +0000
+++ lib/lp/soyuz/model/packageset.py 2009-11-03 08:55:24 +0000
@@ -288,12 +288,16 @@
288288
289 def addSubsets(self, names):289 def addSubsets(self, names):
290 """See `IPackageset`."""290 """See `IPackageset`."""
291 clauses = (Packageset, In(Packageset.name, names))291 clauses = (
292 Packageset, In(Packageset.name, names),
293 Packageset.distroseries == self.distroseries)
292 self._api_add_or_remove(clauses, self._addDirectSuccessors)294 self._api_add_or_remove(clauses, self._addDirectSuccessors)
293295
294 def removeSubsets(self, names):296 def removeSubsets(self, names):
295 """See `IPackageset`."""297 """See `IPackageset`."""
296 clauses = (Packageset, In(Packageset.name, names))298 clauses = (
299 Packageset, In(Packageset.name, names),
300 Packageset.distroseries == self.distroseries)
297 self._api_add_or_remove(clauses, self._removeDirectSuccessors)301 self._api_add_or_remove(clauses, self._removeDirectSuccessors)
298302
299 def relatedSets(self):303 def relatedSets(self):
300304
=== modified file 'lib/lp/soyuz/stories/webservice/xx-packageset.txt'
--- lib/lp/soyuz/stories/webservice/xx-packageset.txt 2009-11-02 11:50:24 +0000
+++ lib/lp/soyuz/stories/webservice/xx-packageset.txt 2009-11-03 08:55:24 +0000
@@ -18,6 +18,9 @@
18Please refer to the tests contained in the file above if you are really18Please refer to the tests contained in the file above if you are really
19interested in package sets and the complete functionality they offer.19interested in package sets and the complete functionality they offer.
2020
21
22== General package set properties ==
23
21We start off by creating an 'umbrella' package set that will include all24We start off by creating an 'umbrella' package set that will include all
22source packages.25source packages.
2326
@@ -214,6 +217,50 @@
214 HTTP/1.1 201 Created217 HTTP/1.1 201 Created
215 ...218 ...
216219
220
221=== Package sets and distro series ===
222
223Every package set is associated with a distro series.
224
225 >>> from lazr.restful.testing.webservice import pprint_entry
226 >>> mozilla = webservice.named_get(
227 ... '/package-sets', 'getByName', {}, name=u'mozilla').jsonBody()
228 >>> print mozilla['distroseries_link']
229 http://api.launchpad.dev/beta/ubuntu/hoary
230
231
232=== Related package sets ===
233
234When adding a package set we can specify that is to be related to another set
235that exists already.
236
237 >>> grumpy = webservice.get("/ubuntu/grumpy").jsonBody()
238 >>> print grumpy['self_link']
239 http://api.launchpad.dev/beta/ubuntu/grumpy
240
241We are adding a new 'mozilla' package set to the 'grumpy' distro series and
242it is related to 'mozilla' in 'hoary'.
243
244 >>> response = webservice.named_post(
245 ... '/package-sets', 'new', {},
246 ... name=u'mozilla',
247 ... description=u'Contains all mozilla packages in grumpy',
248 ... owner=name12['self_link'], distroseries=grumpy['self_link'],
249 ... related_set=mozilla['self_link'])
250 >>> print response
251 HTTP/1.1 201 Created
252 ...
253
254 >>> response = webservice.named_get(
255 ... mozilla['self_link'], 'relatedSets', {})
256 >>> print_payload(response)
257 http://api.launchpad.dev/beta/package-sets/grumpy/mozilla
258
259
260== Package set hierarchy ==
261
262More package sets are needed to set up the hierarchy described below.
263
217 >>> response = webservice.named_post(264 >>> response = webservice.named_post(
218 ... '/package-sets', 'new', {},265 ... '/package-sets', 'new', {},
219 ... name=u'firefox', description=u'Contains all firefox packages',266 ... name=u'firefox', description=u'Contains all firefox packages',
@@ -240,6 +287,18 @@
240 HTTP/1.1 201 Created287 HTTP/1.1 201 Created
241 ...288 ...
242289
290The 'languagepack' package set will be removed later (in hoary). Let's add a
291set with the same name in 'grumpy' to make sure that the right one is found.
292
293 >>> response = webservice.named_post(
294 ... '/package-sets', 'new', {},
295 ... name=u'languagepack',
296 ... description=u'Contains all languagepack packages',
297 ... owner=name12['self_link'], distroseries=grumpy['self_link'])
298 >>> print response
299 HTTP/1.1 201 Created
300 ...
301
243In order to test whether methods relating to package set hierarchies were302In order to test whether methods relating to package set hierarchies were
244exposed on the Launchpad API correctly we will define the following package303exposed on the Launchpad API correctly we will define the following package
245set hierarchy:304set hierarchy:
@@ -451,39 +510,6 @@
451 ["cnews", "thunderbird"]510 ["cnews", "thunderbird"]
452511
453512
454=== Package sets and distro series ===
455
456Every package set is associated with a distro series.
457
458 >>> from lazr.restful.testing.webservice import pprint_entry
459 >>> mozilla = webservice.named_get(
460 ... '/package-sets', 'getByName', {}, name=u'mozilla').jsonBody()
461 >>> print mozilla['distroseries_link']
462 http://api.launchpad.dev/beta/ubuntu/hoary
463
464
465=== Related package sets ===
466
467When adding a package set we can specify that is to be related to another set
468that exists already.
469
470 >>> grumpy = webservice.get("/ubuntu/grumpy").jsonBody()
471 >>> print grumpy['self_link']
472 http://api.launchpad.dev/beta/ubuntu/grumpy
473
474We are adding a new 'mozilla' package set to the 'grumpy' distro series and
475it is related to 'mozilla' in 'hoary'.
476
477 >>> response = webservice.named_post(
478 ... '/package-sets', 'new', {},
479 ... name=u'mozilla',
480 ... description=u'Contains all mozilla packages',
481 ... owner=name12['self_link'], distroseries=grumpy['self_link'],
482 ... related_set=mozilla['self_link'])
483 >>> print response
484 HTTP/1.1 201 Created
485 ...
486
487== Archive permissions and package sets ==513== Archive permissions and package sets ==
488514
489Operating on package set based archive permissions is possible via515Operating on package set based archive permissions is possible via

Subscribers

People subscribed via source and target branches

to status/vote changes: