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

Proposed by Muharem Hrnjadovic
Status: Merged
Merged at revision: not available
Proposed branch: lp:~al-maisan/launchpad/newuris-399186
Merge into: lp:launchpad/db-devel
Diff against target: 545 lines
7 files modified
lib/lp/soyuz/browser/configure.zcml (+1/-1)
lib/lp/soyuz/browser/packageset.py (+19/-0)
lib/lp/soyuz/interfaces/archivepermission.py (+9/-0)
lib/lp/soyuz/interfaces/packageset.py (+5/-5)
lib/lp/soyuz/model/archivepermission.py (+6/-1)
lib/lp/soyuz/model/packageset.py (+9/-1)
lib/lp/soyuz/stories/webservice/xx-packageset.txt (+93/-52)
To merge this branch: bzr merge lp:~al-maisan/launchpad/newuris-399186
Reviewer Review Type Date Requested Status
Abel Deuring (community) code Approve
Review via email: mp+14204@code.launchpad.net
To post a comment you must log in.
Revision history for this message
Muharem Hrnjadovic (al-maisan) wrote :

Hello there!

a branch that introduces the association between package sets and distro
series has already landed on db-devel.

Package set names are now *not* globally unique any more but only unique
within the context of a distro series.

The branch at hand revises the package set traversal rules accordingly.

Pre-implementation call with Michael Nelson.

Tests to run:

    bin/test -vvt packageset

No pertinent "make lint" errors or warnings.

Revision history for this message
Abel Deuring (adeuring) :
review: Approve (code)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'lib/lp/soyuz/browser/configure.zcml'
--- lib/lp/soyuz/browser/configure.zcml 2009-10-22 10:33:00 +0000
+++ lib/lp/soyuz/browser/configure.zcml 2009-10-30 10:10:25 +0000
@@ -783,7 +783,7 @@
783 />783 />
784 <browser:url784 <browser:url
785 for="lp.soyuz.interfaces.packageset.IPackageset"785 for="lp.soyuz.interfaces.packageset.IPackageset"
786 path_expression="name"786 path_expression="string:${distroseries/name}/${name}"
787 parent_utility="lp.soyuz.interfaces.packageset.IPackagesetSet"787 parent_utility="lp.soyuz.interfaces.packageset.IPackagesetSet"
788 />788 />
789 <browser:url789 <browser:url
790790
=== modified file 'lib/lp/soyuz/browser/packageset.py'
--- lib/lp/soyuz/browser/packageset.py 2009-06-30 16:56:07 +0000
+++ lib/lp/soyuz/browser/packageset.py 2009-10-30 10:10:25 +0000
@@ -17,3 +17,22 @@
17class PackagesetSetNavigation(GetitemNavigation):17class PackagesetSetNavigation(GetitemNavigation):
18 """Navigation methods for PackagesetSet."""18 """Navigation methods for PackagesetSet."""
19 usedfor = IPackagesetSet19 usedfor = IPackagesetSet
20
21 def traverse(self, distroseries):
22 """Traverse package sets in distro series context.
23
24 The URI fragment of interest is:
25
26 /package-sets/lucid/mozilla
27
28 where 'lucid' is the distro series and 'mozilla' is the package set
29 *name* respectively.
30 """
31 if self.request.stepstogo:
32 # The package set name follows after the distro series.
33 ps_name = self.request.stepstogo.consume()
34 return self.context.getByName(ps_name, distroseries=distroseries)
35
36 # Otherwise return None (to trigger a NotFound error).
37 return None
38
2039
=== modified file 'lib/lp/soyuz/interfaces/archivepermission.py'
--- lib/lp/soyuz/interfaces/archivepermission.py 2009-08-03 17:10:12 +0000
+++ lib/lp/soyuz/interfaces/archivepermission.py 2009-10-30 10:10:25 +0000
@@ -284,6 +284,9 @@
284 def uploadersForPackageset(archive, packageset, direct_permissions=True):284 def uploadersForPackageset(archive, packageset, direct_permissions=True):
285 """The `ArchivePermission` records for uploaders to the package set.285 """The `ArchivePermission` records for uploaders to the package set.
286286
287 Please note: if a package set *name* is passed the respective
288 package set in the current distro series will be used.
289
287 :param archive: The archive the permission applies to.290 :param archive: The archive the permission applies to.
288 :param packageset: An `IPackageset` or a string package set name.291 :param packageset: An `IPackageset` or a string package set name.
289 :param direct_permissions: If True only consider permissions granted292 :param direct_permissions: If True only consider permissions granted
@@ -332,6 +335,9 @@
332 def newPackagesetUploader(archive, person, packageset, explicit=False):335 def newPackagesetUploader(archive, person, packageset, explicit=False):
333 """Create and return a new `ArchivePermission` for an uploader.336 """Create and return a new `ArchivePermission` for an uploader.
334337
338 Please note: if a package set *name* is passed the respective
339 package set in the current distro series will be used.
340
335 :param archive: The archive the permission applies to.341 :param archive: The archive the permission applies to.
336 :param person: An `IPerson` for whom you want to add permission.342 :param person: An `IPerson` for whom you want to add permission.
337 :param packageset: An `IPackageset` or a string package set name.343 :param packageset: An `IPackageset` or a string package set name.
@@ -379,6 +385,9 @@
379 def deletePackagesetUploader(archive, person, packageset, explicit=False):385 def deletePackagesetUploader(archive, person, packageset, explicit=False):
380 """Revoke upload permissions for a person.386 """Revoke upload permissions for a person.
381387
388 Please note: if a package set *name* is passed the respective
389 package set in the current distro series will be used.
390
382 :param archive: The archive the permission applies to.391 :param archive: The archive the permission applies to.
383 :param person: An `IPerson` for whom you want to revoke permission.392 :param person: An `IPerson` for whom you want to revoke permission.
384 :param packageset: An `IPackageset` or a string package set name.393 :param packageset: An `IPackageset` or a string package set name.
385394
=== modified file 'lib/lp/soyuz/interfaces/packageset.py'
--- lib/lp/soyuz/interfaces/packageset.py 2009-10-27 23:40:24 +0000
+++ lib/lp/soyuz/interfaces/packageset.py 2009-10-30 10:10:25 +0000
@@ -37,7 +37,7 @@
37 """Raised when we try to look up an PackageSet that doesn't exist."""37 """Raised when we try to look up an PackageSet that doesn't exist."""
38 # Bad request.38 # Bad request.
39 webservice_error(400)39 webservice_error(400)
40 _message_prefix = "No such packageset"40 _message_prefix = "No such package set (in the specified distro series)"
4141
4242
43class DuplicatePackagesetName(Exception):43class DuplicatePackagesetName(Exception):
@@ -68,17 +68,17 @@
68 title=_("Description"), required=True, readonly=True,68 title=_("Description"), required=True, readonly=True,
69 description=_("The description for the package set at hand.")))69 description=_("The description for the package set at hand.")))
7070
71 distroseries = Reference(71 distroseries = exported(Reference(
72 IDistroSeries, title=_("Distribution series"), required=True,72 IDistroSeries, title=_("Distribution series"), required=True,
73 readonly=True,73 readonly=True,
74 description=_(74 description=_(
75 "The distroseries to which this package set is related."))75 "The distroseries to which this package set is related.")))
7676
77 packagesetgroup = Reference(77 packagesetgroup = Reference(
78 IPackagesetGroup, title=_('Packageset group'), required=True,78 IPackagesetGroup, title=_('Package set group'), required=True,
79 readonly=True,79 readonly=True,
80 description=_(80 description=_(
81 'Used internally to link packagesets across distroseries'))81 'Used internally to link package sets across distro series.'))
8282
83 def sourcesIncluded(direct_inclusion=False):83 def sourcesIncluded(direct_inclusion=False):
84 """Get all source names associated with this package set.84 """Get all source names associated with this package set.
8585
=== modified file 'lib/lp/soyuz/model/archivepermission.py'
--- lib/lp/soyuz/model/archivepermission.py 2009-07-28 21:52:56 +0000
+++ lib/lp/soyuz/model/archivepermission.py 2009-10-30 10:10:25 +0000
@@ -22,6 +22,7 @@
22from canonical.database.enumcol import EnumCol22from canonical.database.enumcol import EnumCol
23from canonical.database.sqlbase import sqlvalues, SQLBase23from canonical.database.sqlbase import sqlvalues, SQLBase
2424
25from lp.registry.interfaces.distribution import IDistributionSet
25from lp.soyuz.interfaces.archive import ComponentNotFound26from lp.soyuz.interfaces.archive import ComponentNotFound
26from lp.soyuz.interfaces.archivepermission import (27from lp.soyuz.interfaces.archivepermission import (
27 ArchivePermissionType, IArchivePermission, IArchivePermissionSet,28 ArchivePermissionType, IArchivePermission, IArchivePermissionSet,
@@ -312,9 +313,13 @@
312 def _nameToPackageset(self, packageset):313 def _nameToPackageset(self, packageset):
313 """Helper to convert a possible string name to IPackageset."""314 """Helper to convert a possible string name to IPackageset."""
314 if isinstance(packageset, basestring):315 if isinstance(packageset, basestring):
316 # A package set name was passed, assume the current distro series.
317 ubuntu = getUtility(IDistributionSet).getByName('ubuntu')
315 name = packageset318 name = packageset
316 store = IStore(Packageset)319 store = IStore(Packageset)
317 packageset = store.find(Packageset, name=name).one()320 packageset = store.find(
321 Packageset, name=name,
322 distroseries=ubuntu.currentseries).one()
318 if packageset is not None:323 if packageset is not None:
319 return packageset324 return packageset
320 else:325 else:
321326
=== modified file 'lib/lp/soyuz/model/packageset.py'
--- lib/lp/soyuz/model/packageset.py 2009-10-27 15:42:04 +0000
+++ lib/lp/soyuz/model/packageset.py 2009-10-30 10:10:25 +0000
@@ -14,6 +14,7 @@
14from zope.interface import implements14from zope.interface import implements
1515
16from canonical.launchpad.interfaces.lpstorm import IMasterStore, IStore16from canonical.launchpad.interfaces.lpstorm import IMasterStore, IStore
17from canonical.launchpad.webapp.interfaces import NotFoundError
17from lp.registry.interfaces.distribution import IDistributionSet18from lp.registry.interfaces.distribution import IDistributionSet
18from lp.registry.interfaces.sourcepackagename import (19from lp.registry.interfaces.sourcepackagename import (
19 ISourcePackageName, ISourcePackageNameSet)20 ISourcePackageName, ISourcePackageNameSet)
@@ -350,11 +351,17 @@
350 if not isinstance(name, unicode):351 if not isinstance(name, unicode):
351 name = unicode(name, 'utf-8')352 name = unicode(name, 'utf-8')
352353
354 ubuntu = getUtility(IDistributionSet).getByName('ubuntu')
353 extra_args = []355 extra_args = []
354 if distroseries is not None:356 if distroseries is not None:
357 # If the user just passed a distro series name, look it up.
358 if isinstance(distroseries, basestring):
359 try:
360 distroseries = ubuntu[distroseries]
361 except NotFoundError:
362 raise NoSuchPackageSet(distroseries)
355 extra_args.append(Packageset.distroseries == distroseries)363 extra_args.append(Packageset.distroseries == distroseries)
356 else:364 else:
357 ubuntu = getUtility(IDistributionSet).getByName('ubuntu')
358 extra_args.append(Packageset.distroseries == ubuntu.currentseries)365 extra_args.append(Packageset.distroseries == ubuntu.currentseries)
359366
360 package_set = store.find(367 package_set = store.find(
@@ -362,6 +369,7 @@
362369
363 if package_set is None:370 if package_set is None:
364 raise NoSuchPackageSet(name)371 raise NoSuchPackageSet(name)
372
365 return package_set373 return package_set
366374
367 def getByOwner(self, owner):375 def getByOwner(self, owner):
368376
=== modified file 'lib/lp/soyuz/stories/webservice/xx-packageset.txt'
--- lib/lp/soyuz/stories/webservice/xx-packageset.txt 2009-08-20 04:46:48 +0000
+++ lib/lp/soyuz/stories/webservice/xx-packageset.txt 2009-10-30 10:10:25 +0000
@@ -52,16 +52,16 @@
52Can we access it via the webservice API as well?52Can we access it via the webservice API as well?
5353
54 >>> logout()54 >>> logout()
55 >>> umbrella = webservice.get("/package-sets/umbrella").jsonBody()55 >>> umbrella = webservice.get("/package-sets/hoary/umbrella").jsonBody()
56 >>> print umbrella['self_link']56 >>> print umbrella['self_link']
57 http://api.launchpad.dev/beta/package-sets/umbrella57 http://api.launchpad.dev/beta/package-sets/hoary/umbrella
5858
59`PackageSet`s can be looked up by name.59`PackageSet`s can be looked up by name.
6060
61 >>> response = webservice.named_get(61 >>> response = webservice.named_get(
62 ... '/package-sets', 'getByName', {}, name=u'umbrella')62 ... '/package-sets', 'getByName', {}, name=u'umbrella')
63 >>> print response.jsonBody()['self_link']63 >>> print response.jsonBody()['self_link']
64 http://api.launchpad.dev/beta/package-sets/umbrella64 http://api.launchpad.dev/beta/package-sets/hoary/umbrella
6565
66When a `PackageSet` cannot be found, an error is returned.66When a `PackageSet` cannot be found, an error is returned.
6767
@@ -70,9 +70,17 @@
70 >>> print response70 >>> print response
71 HTTP/1.1 400 Bad Request71 HTTP/1.1 400 Bad Request
72 ...72 ...
73 NoSuchPackageSet: No such packageset: 'not-found'.73 No such package set (in the specified distro series): 'not-found'.
74 ...
74 <BLANKLINE>75 <BLANKLINE>
7576
77Here's an example with a funny URL concoted by a "smart" user.
78
79 >>> response = webservice.get("/package-sets/lucid-plus-1/umbrella/+pwn")
80 >>> print response
81 HTTP/1.1 404 Not Found
82 ...
83
76Populate the 'umbrella' package set with source packages.84Populate the 'umbrella' package set with source packages.
7785
78 >>> from canonical.launchpad.webapp.interfaces import (86 >>> from canonical.launchpad.webapp.interfaces import (
@@ -81,7 +89,7 @@
81 >>> store = getUtility(IStoreSelector).get(MAIN_STORE, DEFAULT_FLAVOR)89 >>> store = getUtility(IStoreSelector).get(MAIN_STORE, DEFAULT_FLAVOR)
82 >>> all_spns = store.find(SourcePackageName)90 >>> all_spns = store.find(SourcePackageName)
83 >>> response = webservice.named_post(91 >>> response = webservice.named_post(
84 ... '/package-sets/umbrella', 'addSources', {},92 ... '/package-sets/hoary/umbrella', 'addSources', {},
85 ... names=[spn.name for spn in all_spns])93 ... names=[spn.name for spn in all_spns])
86 >>> print response94 >>> print response
87 HTTP/1.1 200 Ok95 HTTP/1.1 200 Ok
@@ -91,7 +99,7 @@
91exist will not fail. Non-existing source package names are *ignored*.99exist will not fail. Non-existing source package names are *ignored*.
92100
93 >>> response = webservice.named_post(101 >>> response = webservice.named_post(
94 ... '/package-sets/umbrella', 'addSources', {},102 ... '/package-sets/hoary/umbrella', 'addSources', {},
95 ... names=[u'does-not-exist'])103 ... names=[u'does-not-exist'])
96 >>> print response104 >>> print response
97 HTTP/1.1 200 Ok105 HTTP/1.1 200 Ok
@@ -99,7 +107,7 @@
99 null107 null
100108
101 >>> response = webservice.named_post(109 >>> response = webservice.named_post(
102 ... '/package-sets/umbrella', 'removeSources', {},110 ... '/package-sets/hoary/umbrella', 'removeSources', {},
103 ... names=[u'does-not-exist'])111 ... names=[u'does-not-exist'])
104 >>> print response112 >>> print response
105 HTTP/1.1 200 Ok113 HTTP/1.1 200 Ok
@@ -109,7 +117,7 @@
109Let's see what we got.117Let's see what we got.
110118
111 >>> response = webservice.named_get(119 >>> response = webservice.named_get(
112 ... '/package-sets/umbrella', 'getSourcesIncluded', {})120 ... '/package-sets/hoary/umbrella', 'getSourcesIncluded', {})
113 >>> print response121 >>> print response
114 HTTP/1.1 200 Ok122 HTTP/1.1 200 Ok
115 ...123 ...
@@ -136,7 +144,7 @@
136from the 'umbrella' package set.144from the 'umbrella' package set.
137145
138 >>> response = webservice.named_post(146 >>> response = webservice.named_post(
139 ... '/package-sets/umbrella', 'removeSources', {},147 ... '/package-sets/hoary/umbrella', 'removeSources', {},
140 ... names=["foobar", "iceweasel"])148 ... names=["foobar", "iceweasel"])
141 >>> print response149 >>> print response
142 HTTP/1.1 200 Ok150 HTTP/1.1 200 Ok
@@ -146,7 +154,7 @@
146from the list below.154from the list below.
147155
148 >>> response = webservice.named_get(156 >>> response = webservice.named_get(
149 ... '/package-sets/umbrella', 'getSourcesIncluded', {})157 ... '/package-sets/hoary/umbrella', 'getSourcesIncluded', {})
150 >>> print response158 >>> print response
151 HTTP/1.1 200 Ok159 HTTP/1.1 200 Ok
152 ...160 ...
@@ -176,13 +184,13 @@
176184
177 >>> response = webservice.get("/package-sets/")185 >>> response = webservice.get("/package-sets/")
178 >>> print_payload(response)186 >>> print_payload(response)
179 http://api.launchpad.dev/beta/package-sets/umbrella187 http://api.launchpad.dev/beta/package-sets/hoary/umbrella
180188
181Package sets may include other package sets (as subsets). At this point,189Package sets may include other package sets (as subsets). At this point,
182however, we only have the 'umbrella' package set. It hence has no subsets.190however, we only have the 'umbrella' package set. It hence has no subsets.
183191
184 >>> response = webservice.named_get(192 >>> response = webservice.named_get(
185 ... '/package-sets/umbrella', 'setsIncluded', {})193 ... '/package-sets/hoary/umbrella', 'setsIncluded', {})
186 >>> print response194 >>> print response
187 HTTP/1.1 200 Ok195 HTTP/1.1 200 Ok
188 ...196 ...
@@ -245,27 +253,27 @@
245 * languagepack253 * languagepack
246254
247 >>> response = webservice.named_post(255 >>> response = webservice.named_post(
248 ... '/package-sets/umbrella', 'addSubsets', {},256 ... '/package-sets/hoary/umbrella', 'addSubsets', {},
249 ... names=[u'gnome', u'mozilla'])257 ... names=[u'gnome', u'mozilla'])
250 >>> print response258 >>> print response
251 HTTP/1.1 200 Ok259 HTTP/1.1 200 Ok
252 ...260 ...
253261
254 >>> response = webservice.named_post(262 >>> response = webservice.named_post(
255 ... '/package-sets/gnome', 'addSubsets', {}, names=[u'languagepack'])263 ... '/package-sets/hoary/gnome', 'addSubsets', {}, names=[u'languagepack'])
256 >>> print response264 >>> print response
257 HTTP/1.1 200 Ok265 HTTP/1.1 200 Ok
258 ...266 ...
259267
260 >>> response = webservice.named_post(268 >>> response = webservice.named_post(
261 ... '/package-sets/thunderbird', 'addSubsets', {},269 ... '/package-sets/hoary/thunderbird', 'addSubsets', {},
262 ... names=[u'languagepack'])270 ... names=[u'languagepack'])
263 >>> print response271 >>> print response
264 HTTP/1.1 200 Ok272 HTTP/1.1 200 Ok
265 ...273 ...
266274
267 >>> response = webservice.named_post(275 >>> response = webservice.named_post(
268 ... '/package-sets/mozilla', 'addSubsets', {},276 ... '/package-sets/hoary/mozilla', 'addSubsets', {},
269 ... names=[u'firefox', u'thunderbird'])277 ... names=[u'firefox', u'thunderbird'])
270 >>> print response278 >>> print response
271 HTTP/1.1 200 Ok279 HTTP/1.1 200 Ok
@@ -275,7 +283,7 @@
275non-existing package sets will not fail.283non-existing package sets will not fail.
276284
277 >>> response = webservice.named_post(285 >>> response = webservice.named_post(
278 ... '/package-sets/thunderbird', 'addSubsets', {},286 ... '/package-sets/hoary/thunderbird', 'addSubsets', {},
279 ... names=[u'does-not-exist'])287 ... names=[u'does-not-exist'])
280 >>> print response288 >>> print response
281 HTTP/1.1 200 Ok289 HTTP/1.1 200 Ok
@@ -283,7 +291,7 @@
283 null291 null
284292
285 >>> response = webservice.named_post(293 >>> response = webservice.named_post(
286 ... '/package-sets/thunderbird', 'removeSubsets', {},294 ... '/package-sets/hoary/thunderbird', 'removeSubsets', {},
287 ... names=[u'does-not-exist'])295 ... names=[u'does-not-exist'])
288 >>> print response296 >>> print response
289 HTTP/1.1 200 Ok297 HTTP/1.1 200 Ok
@@ -293,49 +301,49 @@
293The 'umbrella' package set should have plenty of subsets now.301The 'umbrella' package set should have plenty of subsets now.
294302
295 >>> response = webservice.named_get(303 >>> response = webservice.named_get(
296 ... '/package-sets/umbrella', 'setsIncluded', {})304 ... '/package-sets/hoary/umbrella', 'setsIncluded', {})
297 >>> print_payload(response)305 >>> print_payload(response)
298 http://api.launchpad.dev/beta/package-sets/firefox306 http://api.launchpad.dev/beta/package-sets/hoary/firefox
299 http://api.launchpad.dev/beta/package-sets/gnome307 http://api.launchpad.dev/beta/package-sets/hoary/gnome
300 http://api.launchpad.dev/beta/package-sets/languagepack308 http://api.launchpad.dev/beta/package-sets/hoary/languagepack
301 http://api.launchpad.dev/beta/package-sets/mozilla309 http://api.launchpad.dev/beta/package-sets/hoary/mozilla
302 http://api.launchpad.dev/beta/package-sets/thunderbird310 http://api.launchpad.dev/beta/package-sets/hoary/thunderbird
303311
304However only two of the above are direct subsets.312However only two of the above are direct subsets.
305313
306 >>> response = webservice.named_get(314 >>> response = webservice.named_get(
307 ... '/package-sets/umbrella', 'setsIncluded', {},315 ... '/package-sets/hoary/umbrella', 'setsIncluded', {},
308 ... direct_inclusion=True)316 ... direct_inclusion=True)
309 >>> print_payload(response)317 >>> print_payload(response)
310 http://api.launchpad.dev/beta/package-sets/gnome318 http://api.launchpad.dev/beta/package-sets/hoary/gnome
311 http://api.launchpad.dev/beta/package-sets/mozilla319 http://api.launchpad.dev/beta/package-sets/hoary/mozilla
312320
313Let's ask the question the other way around what package sets are including321Let's ask the question the other way around what package sets are including
314a particular subset?322a particular subset?
315323
316 >>> response = webservice.named_get(324 >>> response = webservice.named_get(
317 ... '/package-sets/languagepack', 'setsIncludedBy', {})325 ... '/package-sets/hoary/languagepack', 'setsIncludedBy', {})
318 >>> print_payload(response)326 >>> print_payload(response)
319 http://api.launchpad.dev/beta/package-sets/gnome327 http://api.launchpad.dev/beta/package-sets/hoary/gnome
320 http://api.launchpad.dev/beta/package-sets/mozilla328 http://api.launchpad.dev/beta/package-sets/hoary/mozilla
321 http://api.launchpad.dev/beta/package-sets/thunderbird329 http://api.launchpad.dev/beta/package-sets/hoary/thunderbird
322 http://api.launchpad.dev/beta/package-sets/umbrella330 http://api.launchpad.dev/beta/package-sets/hoary/umbrella
323331
324The list of package sets that *directly* include 'languagepack' will be332The list of package sets that *directly* include 'languagepack' will be
325shorter because the transitive closure is ignored.333shorter because the transitive closure is ignored.
326334
327 >>> response = webservice.named_get(335 >>> response = webservice.named_get(
328 ... '/package-sets/languagepack', 'setsIncludedBy', {},336 ... '/package-sets/hoary/languagepack', 'setsIncludedBy', {},
329 ... direct_inclusion=True)337 ... direct_inclusion=True)
330 >>> print_payload(response)338 >>> print_payload(response)
331 http://api.launchpad.dev/beta/package-sets/gnome339 http://api.launchpad.dev/beta/package-sets/hoary/gnome
332 http://api.launchpad.dev/beta/package-sets/thunderbird340 http://api.launchpad.dev/beta/package-sets/hoary/thunderbird
333341
334We can remove subsets as well. In the example below 'thunderbird' will342We can remove subsets as well. In the example below 'thunderbird' will
335stop including 'languagepack'.343stop including 'languagepack'.
336344
337 >>> response = webservice.named_post(345 >>> response = webservice.named_post(
338 ... '/package-sets/thunderbird', 'removeSubsets', {},346 ... '/package-sets/hoary/thunderbird', 'removeSubsets', {},
339 ... names=[u'languagepack'])347 ... names=[u'languagepack'])
340 >>> print response348 >>> print response
341 HTTP/1.1 200 Ok349 HTTP/1.1 200 Ok
@@ -344,37 +352,37 @@
344And, here we go, now 'languagepack' has only one direct predecessor: 'gnome'.352And, here we go, now 'languagepack' has only one direct predecessor: 'gnome'.
345353
346 >>> response = webservice.named_get(354 >>> response = webservice.named_get(
347 ... '/package-sets/languagepack', 'setsIncludedBy', {},355 ... '/package-sets/hoary/languagepack', 'setsIncludedBy', {},
348 ... direct_inclusion=True)356 ... direct_inclusion=True)
349 >>> print_payload(response)357 >>> print_payload(response)
350 http://api.launchpad.dev/beta/package-sets/gnome358 http://api.launchpad.dev/beta/package-sets/hoary/gnome
351359
352Let's add a few source packages to the 'firefox' and the 'thunderbird'360Let's add a few source packages to the 'firefox' and the 'thunderbird'
353package sets.361package sets.
354362
355 >>> response = webservice.named_post(363 >>> response = webservice.named_post(
356 ... '/package-sets/firefox', 'addSources', {},364 ... '/package-sets/hoary/firefox', 'addSources', {},
357 ... names=['at', 'mozilla-firefox', 'language-pack-de'])365 ... names=['at', 'mozilla-firefox', 'language-pack-de'])
358 >>> print response366 >>> print response
359 HTTP/1.1 200 Ok367 HTTP/1.1 200 Ok
360 ...368 ...
361369
362 >>> response = webservice.named_get(370 >>> response = webservice.named_get(
363 ... '/package-sets/firefox', 'getSourcesIncluded', {})371 ... '/package-sets/hoary/firefox', 'getSourcesIncluded', {})
364 >>> print response372 >>> print response
365 HTTP/1.1 200 Ok373 HTTP/1.1 200 Ok
366 ...374 ...
367 ["at", "language-pack-de", "mozilla-firefox"]375 ["at", "language-pack-de", "mozilla-firefox"]
368376
369 >>> response = webservice.named_post(377 >>> response = webservice.named_post(
370 ... '/package-sets/thunderbird', 'addSources', {},378 ... '/package-sets/hoary/thunderbird', 'addSources', {},
371 ... names=['at', 'cnews', 'thunderbird', 'language-pack-de'])379 ... names=['at', 'cnews', 'thunderbird', 'language-pack-de'])
372 >>> print response380 >>> print response
373 HTTP/1.1 200 Ok381 HTTP/1.1 200 Ok
374 ...382 ...
375383
376 >>> response = webservice.named_get(384 >>> response = webservice.named_get(
377 ... '/package-sets/thunderbird', 'getSourcesIncluded', {})385 ... '/package-sets/hoary/thunderbird', 'getSourcesIncluded', {})
378 >>> print response386 >>> print response
379 HTTP/1.1 200 Ok387 HTTP/1.1 200 Ok
380 ...388 ...
@@ -386,9 +394,9 @@
386 ... '/package-sets/', 'setsIncludingSource', {},394 ... '/package-sets/', 'setsIncludingSource', {},
387 ... sourcepackagename=u'mozilla-firefox')395 ... sourcepackagename=u'mozilla-firefox')
388 >>> print_payload(response)396 >>> print_payload(response)
389 http://api.launchpad.dev/beta/package-sets/firefox397 http://api.launchpad.dev/beta/package-sets/hoary/firefox
390 http://api.launchpad.dev/beta/package-sets/mozilla398 http://api.launchpad.dev/beta/package-sets/hoary/mozilla
391 http://api.launchpad.dev/beta/package-sets/umbrella399 http://api.launchpad.dev/beta/package-sets/hoary/umbrella
392400
393Which package sets include the 'mozilla-firefox' source package *directly*?401Which package sets include the 'mozilla-firefox' source package *directly*?
394402
@@ -397,8 +405,8 @@
397 ... sourcepackagename=u'mozilla-firefox',405 ... sourcepackagename=u'mozilla-firefox',
398 ... direct_inclusion=True)406 ... direct_inclusion=True)
399 >>> print_payload(response)407 >>> print_payload(response)
400 http://api.launchpad.dev/beta/package-sets/firefox408 http://api.launchpad.dev/beta/package-sets/hoary/firefox
401 http://api.launchpad.dev/beta/package-sets/umbrella409 http://api.launchpad.dev/beta/package-sets/hoary/umbrella
402410
403If a non-existing source package name is passed it returns an error.411If a non-existing source package name is passed it returns an error.
404412
@@ -414,9 +422,9 @@
414What source packages are shared by the 'firefox' and the 'thunderbird'422What source packages are shared by the 'firefox' and the 'thunderbird'
415package sets?423package sets?
416424
417 >>> thunderbird = webservice.get("/package-sets/thunderbird").jsonBody()425 >>> thunderbird = webservice.get("/package-sets/hoary/thunderbird").jsonBody()
418 >>> response = webservice.named_get(426 >>> response = webservice.named_get(
419 ... '/package-sets/firefox', 'getSourcesSharedBy', {},427 ... '/package-sets/hoary/firefox', 'getSourcesSharedBy', {},
420 ... other_package_set=thunderbird['self_link'])428 ... other_package_set=thunderbird['self_link'])
421 >>> print response429 >>> print response
422 HTTP/1.1 200 Ok430 HTTP/1.1 200 Ok
@@ -426,16 +434,16 @@
426How about the complement set i.e. the packages not shared?434How about the complement set i.e. the packages not shared?
427435
428 >>> response = webservice.named_get(436 >>> response = webservice.named_get(
429 ... '/package-sets/firefox', 'getSourcesNotSharedBy', {},437 ... '/package-sets/hoary/firefox', 'getSourcesNotSharedBy', {},
430 ... other_package_set=thunderbird['self_link'])438 ... other_package_set=thunderbird['self_link'])
431 >>> print response439 >>> print response
432 HTTP/1.1 200 Ok440 HTTP/1.1 200 Ok
433 ...441 ...
434 ["mozilla-firefox"]442 ["mozilla-firefox"]
435443
436 >>> firefox = webservice.get("/package-sets/firefox").jsonBody()444 >>> firefox = webservice.get("/package-sets/hoary/firefox").jsonBody()
437 >>> response = webservice.named_get(445 >>> response = webservice.named_get(
438 ... '/package-sets/thunderbird', 'getSourcesNotSharedBy', {},446 ... '/package-sets/hoary/thunderbird', 'getSourcesNotSharedBy', {},
439 ... other_package_set=firefox['self_link'])447 ... other_package_set=firefox['self_link'])
440 >>> print response448 >>> print response
441 HTTP/1.1 200 Ok449 HTTP/1.1 200 Ok
@@ -443,6 +451,39 @@
443 ["cnews", "thunderbird"]451 ["cnews", "thunderbird"]
444452
445453
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
446== Archive permissions and package sets ==487== Archive permissions and package sets ==
447488
448Operating on package set based archive permissions is possible via489Operating on package set based archive permissions is possible via

Subscribers

People subscribed via source and target branches

to status/vote changes: