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
1=== modified file 'lib/lp/soyuz/model/packageset.py'
2--- lib/lp/soyuz/model/packageset.py 2009-10-30 20:28:16 +0000
3+++ lib/lp/soyuz/model/packageset.py 2009-11-03 08:55:24 +0000
4@@ -288,12 +288,16 @@
5
6 def addSubsets(self, names):
7 """See `IPackageset`."""
8- clauses = (Packageset, In(Packageset.name, names))
9+ clauses = (
10+ Packageset, In(Packageset.name, names),
11+ Packageset.distroseries == self.distroseries)
12 self._api_add_or_remove(clauses, self._addDirectSuccessors)
13
14 def removeSubsets(self, names):
15 """See `IPackageset`."""
16- clauses = (Packageset, In(Packageset.name, names))
17+ clauses = (
18+ Packageset, In(Packageset.name, names),
19+ Packageset.distroseries == self.distroseries)
20 self._api_add_or_remove(clauses, self._removeDirectSuccessors)
21
22 def relatedSets(self):
23
24=== modified file 'lib/lp/soyuz/stories/webservice/xx-packageset.txt'
25--- lib/lp/soyuz/stories/webservice/xx-packageset.txt 2009-11-02 11:50:24 +0000
26+++ lib/lp/soyuz/stories/webservice/xx-packageset.txt 2009-11-03 08:55:24 +0000
27@@ -18,6 +18,9 @@
28 Please refer to the tests contained in the file above if you are really
29 interested in package sets and the complete functionality they offer.
30
31+
32+== General package set properties ==
33+
34 We start off by creating an 'umbrella' package set that will include all
35 source packages.
36
37@@ -214,6 +217,50 @@
38 HTTP/1.1 201 Created
39 ...
40
41+
42+=== Package sets and distro series ===
43+
44+Every package set is associated with a distro series.
45+
46+ >>> from lazr.restful.testing.webservice import pprint_entry
47+ >>> mozilla = webservice.named_get(
48+ ... '/package-sets', 'getByName', {}, name=u'mozilla').jsonBody()
49+ >>> print mozilla['distroseries_link']
50+ http://api.launchpad.dev/beta/ubuntu/hoary
51+
52+
53+=== Related package sets ===
54+
55+When adding a package set we can specify that is to be related to another set
56+that exists already.
57+
58+ >>> grumpy = webservice.get("/ubuntu/grumpy").jsonBody()
59+ >>> print grumpy['self_link']
60+ http://api.launchpad.dev/beta/ubuntu/grumpy
61+
62+We are adding a new 'mozilla' package set to the 'grumpy' distro series and
63+it is related to 'mozilla' in 'hoary'.
64+
65+ >>> response = webservice.named_post(
66+ ... '/package-sets', 'new', {},
67+ ... name=u'mozilla',
68+ ... description=u'Contains all mozilla packages in grumpy',
69+ ... owner=name12['self_link'], distroseries=grumpy['self_link'],
70+ ... related_set=mozilla['self_link'])
71+ >>> print response
72+ HTTP/1.1 201 Created
73+ ...
74+
75+ >>> response = webservice.named_get(
76+ ... mozilla['self_link'], 'relatedSets', {})
77+ >>> print_payload(response)
78+ http://api.launchpad.dev/beta/package-sets/grumpy/mozilla
79+
80+
81+== Package set hierarchy ==
82+
83+More package sets are needed to set up the hierarchy described below.
84+
85 >>> response = webservice.named_post(
86 ... '/package-sets', 'new', {},
87 ... name=u'firefox', description=u'Contains all firefox packages',
88@@ -240,6 +287,18 @@
89 HTTP/1.1 201 Created
90 ...
91
92+The 'languagepack' package set will be removed later (in hoary). Let's add a
93+set with the same name in 'grumpy' to make sure that the right one is found.
94+
95+ >>> response = webservice.named_post(
96+ ... '/package-sets', 'new', {},
97+ ... name=u'languagepack',
98+ ... description=u'Contains all languagepack packages',
99+ ... owner=name12['self_link'], distroseries=grumpy['self_link'])
100+ >>> print response
101+ HTTP/1.1 201 Created
102+ ...
103+
104 In order to test whether methods relating to package set hierarchies were
105 exposed on the Launchpad API correctly we will define the following package
106 set hierarchy:
107@@ -451,39 +510,6 @@
108 ["cnews", "thunderbird"]
109
110
111-=== Package sets and distro series ===
112-
113-Every package set is associated with a distro series.
114-
115- >>> from lazr.restful.testing.webservice import pprint_entry
116- >>> mozilla = webservice.named_get(
117- ... '/package-sets', 'getByName', {}, name=u'mozilla').jsonBody()
118- >>> print mozilla['distroseries_link']
119- http://api.launchpad.dev/beta/ubuntu/hoary
120-
121-
122-=== Related package sets ===
123-
124-When adding a package set we can specify that is to be related to another set
125-that exists already.
126-
127- >>> grumpy = webservice.get("/ubuntu/grumpy").jsonBody()
128- >>> print grumpy['self_link']
129- http://api.launchpad.dev/beta/ubuntu/grumpy
130-
131-We are adding a new 'mozilla' package set to the 'grumpy' distro series and
132-it is related to 'mozilla' in 'hoary'.
133-
134- >>> response = webservice.named_post(
135- ... '/package-sets', 'new', {},
136- ... name=u'mozilla',
137- ... description=u'Contains all mozilla packages',
138- ... owner=name12['self_link'], distroseries=grumpy['self_link'],
139- ... related_set=mozilla['self_link'])
140- >>> print response
141- HTTP/1.1 201 Created
142- ...
143-
144 == Archive permissions and package sets ==
145
146 Operating on package set based archive permissions is possible via

Subscribers

People subscribed via source and target branches

to status/vote changes: