Merge lp:~sinzui/launchpad/package-link-validation into lp:launchpad

Proposed by Curtis Hovey
Status: Merged
Approved by: Curtis Hovey
Approved revision: no longer in the source branch.
Merged at revision: not available
Proposed branch: lp:~sinzui/launchpad/package-link-validation
Merge into: lp:launchpad
Diff against target: 972 lines
23 files modified
lib/canonical/launchpad/browser/__init__.py (+0/-1)
lib/canonical/launchpad/database/__init__.py (+0/-1)
lib/canonical/launchpad/interfaces/__init__.py (+0/-1)
lib/canonical/launchpad/security.py (+1/-1)
lib/canonical/launchpad/zcml/configure.zcml (+0/-1)
lib/canonical/launchpad/zcml/packaging.zcml (+0/-32)
lib/lp/bugs/doc/distribution-upstream-bug-report.txt (+40/-29)
lib/lp/registry/browser/configure.zcml (+1/-1)
lib/lp/registry/browser/distributionsourcepackage.py (+1/-1)
lib/lp/registry/browser/packaging.py (+1/-1)
lib/lp/registry/browser/sourcepackage.py (+1/-1)
lib/lp/registry/browser/tests/test_packaging.py (+4/-2)
lib/lp/registry/browser/tests/test_person_view.py (+2/-1)
lib/lp/registry/configure.zcml (+23/-0)
lib/lp/registry/doc/sourcepackage.txt (+94/-59)
lib/lp/registry/model/distribution.py (+1/-1)
lib/lp/registry/model/distroseries.py (+2/-2)
lib/lp/registry/model/packaging.py (+2/-2)
lib/lp/registry/model/product.py (+2/-2)
lib/lp/registry/model/productseries.py (+2/-2)
lib/lp/registry/model/sourcepackage.py (+3/-3)
lib/lp/registry/tests/test_packaging.py (+4/-2)
utilities/migrater/migrater.py (+5/-3)
To merge this branch: bzr merge lp:~sinzui/launchpad/package-link-validation
Reviewer Review Type Date Requested Status
Abel Deuring (community) code Approve
Review via email: mp+13484@code.launchpad.net
To post a comment you must log in.
Revision history for this message
Curtis Hovey (sinzui) wrote :

This is my first branch to ensure valid upstream package links. There
are many oopses relating to the creation and efforts to fix invalid packages.
The root cause is a bad DB constraint and two views that do not do the
required sanity checks: +addPackage and +ubuntupkg

This branch is a set of mechanical changed made by the migrater script to
move packaging from canonical.launchpad to lp.registry

    lp:~sinzui/launchpad/package-link-validation
    Diff size: 395
    Launchpad bug: https://bugs.launchpad.net/bugs/453212
    Test command: ./bin/test -vv -t test_packaging \
                                 -t stories/packaging
    Pre-implementation: flacoste
    Target release: 3.1.10

== Rules ==

    * Run th migrator to take ownership of the problem code.

== QA ==

    * Visit any productseries that you are the owner or release manager of
    * Choose (+) Add package
    * Verify the page displays a for to choose a distroseries and source
      package.

== Lint ==

Linting changed files:
  lib/canonical/launchpad/security.py
  lib/canonical/launchpad/browser/__init__.py
  lib/canonical/launchpad/database/__init__.py
  lib/canonical/launchpad/interfaces/__init__.py
  lib/canonical/launchpad/zcml/configure.zcml
  lib/lp/registry/configure.zcml
  lib/lp/registry/browser/configure.zcml
  lib/lp/registry/browser/distributionsourcepackage.py
  lib/lp/registry/browser/packaging.py
  lib/lp/registry/browser/sourcepackage.py
  lib/lp/registry/browser/tests/test_packaging.py
  lib/lp/registry/browser/tests/test_person_view.py
  lib/lp/registry/model/distribution.py
  lib/lp/registry/model/distroseries.py
  lib/lp/registry/model/packaging.py
  lib/lp/registry/model/product.py
  lib/lp/registry/model/productseries.py
  lib/lp/registry/model/sourcepackage.py
  lib/lp/registry/stories/packaging/
  lib/lp/registry/tests/test_packaging.py
  utilities/migrater/migrater.py

== Test ==

No tests changed. The three migrated tests do work.

== Implementation ==

    * utilities/migrater/migrater.py
      Fixed errors that were committed some time ago.

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
1=== modified file 'lib/canonical/launchpad/browser/__init__.py'
2--- lib/canonical/launchpad/browser/__init__.py 2009-08-31 13:18:00 +0000
3+++ lib/canonical/launchpad/browser/__init__.py 2009-10-16 20:36:17 +0000
4@@ -48,7 +48,6 @@
5 from canonical.launchpad.browser.oauth import *
6 from canonical.launchpad.browser.objectreassignment import *
7 from canonical.launchpad.browser.packagerelationship import *
8-from canonical.launchpad.browser.packaging import *
9 from lp.registry.browser.peoplemerge import *
10 from lp.registry.browser.poll import *
11 from lp.soyuz.browser.publishedpackage import *
12
13=== modified file 'lib/canonical/launchpad/database/__init__.py'
14--- lib/canonical/launchpad/database/__init__.py 2009-09-17 21:13:06 +0000
15+++ lib/canonical/launchpad/database/__init__.py 2009-10-16 20:36:17 +0000
16@@ -56,7 +56,6 @@
17
18 from canonical.launchpad.database.account import *
19 from canonical.launchpad.database.personnotification import *
20-from canonical.launchpad.database.packaging import *
21 from canonical.launchpad.database.librarian import *
22 from canonical.launchpad.database.binaryandsourcepackagename import *
23 from canonical.launchpad.database.message import *
24
25=== modified file 'lib/canonical/launchpad/interfaces/__init__.py'
26--- lib/canonical/launchpad/interfaces/__init__.py 2009-08-27 07:05:16 +0000
27+++ lib/canonical/launchpad/interfaces/__init__.py 2009-10-16 20:36:17 +0000
28@@ -94,7 +94,6 @@
29 from canonical.launchpad.interfaces.oauth import *
30 from canonical.launchpad.interfaces.openidconsumer import *
31 from canonical.launchpad.interfaces.packagerelationship import *
32-from canonical.launchpad.interfaces.packaging import *
33 from canonical.launchpad.interfaces.pathlookup import *
34 from lp.registry.interfaces.poll import *
35 from lp.soyuz.interfaces.processor import *
36
37=== modified file 'lib/canonical/launchpad/security.py'
38--- lib/canonical/launchpad/security.py 2009-09-25 00:59:30 +0000
39+++ lib/canonical/launchpad/security.py 2009-10-16 20:36:17 +0000
40@@ -71,7 +71,7 @@
41 IBinaryPackagePublishingHistory, ISourcePackagePublishingHistory)
42 from lp.soyuz.interfaces.queue import (
43 IPackageUpload, IPackageUploadQueue)
44-from canonical.launchpad.interfaces.packaging import IPackaging
45+from lp.registry.interfaces.packaging import IPackaging
46 from lp.registry.interfaces.person import (
47 IPerson, ITeam, PersonVisibility)
48 from lp.registry.interfaces.pillar import IPillar
49
50=== modified file 'lib/canonical/launchpad/zcml/configure.zcml'
51--- lib/canonical/launchpad/zcml/configure.zcml 2009-08-27 07:05:16 +0000
52+++ lib/canonical/launchpad/zcml/configure.zcml 2009-10-16 20:36:17 +0000
53@@ -29,7 +29,6 @@
54 <include file="openidconsumer.zcml" />
55 <include file="packagecopyrequest.zcml" />
56 <include file="packagerelationship.zcml" />
57- <include file="packaging.zcml" />
58 <include file="personnotification.zcml" />
59 <include file="personproduct.zcml" />
60 <include file="structuralsubscription.zcml" />
61
62=== removed file 'lib/canonical/launchpad/zcml/packaging.zcml'
63--- lib/canonical/launchpad/zcml/packaging.zcml 2009-07-13 18:15:02 +0000
64+++ lib/canonical/launchpad/zcml/packaging.zcml 1970-01-01 00:00:00 +0000
65@@ -1,32 +0,0 @@
66-<!-- Copyright 2009 Canonical Ltd. This software is licensed under the
67- GNU Affero General Public License version 3 (see the file LICENSE).
68--->
69-
70-<configure
71- xmlns="http://namespaces.zope.org/zope"
72- xmlns:browser="http://namespaces.zope.org/browser"
73- xmlns:i18n="http://namespaces.zope.org/i18n"
74- xmlns:zope="http://namespaces.zope.org/zope"
75- i18n:domain="launchpad">
76-
77- <!-- Packaging -->
78- <class class="canonical.launchpad.database.Packaging">
79- <allow interface="canonical.launchpad.interfaces.IPackaging" />
80- <require
81- permission="zope.Public"
82- set_schema="canonical.launchpad.interfaces.IPackaging"
83- />
84- </class>
85-
86- <!-- PackagingUtil -->
87- <class class="canonical.launchpad.database.PackagingUtil">
88- <allow interface="canonical.launchpad.interfaces.IPackagingUtil" />
89- </class>
90-
91- <securedutility
92- class="canonical.launchpad.database.PackagingUtil"
93- provides="canonical.launchpad.interfaces.IPackagingUtil">
94- <allow interface="canonical.launchpad.interfaces.IPackagingUtil" />
95- </securedutility>
96-
97-</configure>
98
99=== modified file 'lib/lp/bugs/doc/distribution-upstream-bug-report.txt'
100--- lib/lp/bugs/doc/distribution-upstream-bug-report.txt 2009-08-13 15:12:16 +0000
101+++ lib/lp/bugs/doc/distribution-upstream-bug-report.txt 2009-10-16 20:36:17 +0000
102@@ -1,19 +1,24 @@
103-= Upstream Bug reports =
104+Upstream Bug reports
105+====================
106
107 For a distribution's bug tracking process to be successful, it's vital
108 that it is able to communicate upstream bugs to the relevant upstream
109 project and monitor them as they change. Launchpad offers functionality
110 to allow a distribution to focus on and improve this process.
111
112-
113 >>> from canonical.launchpad.ftests import login
114 >>> from lp.bugs.tests.bug import (
115 ... create_bug_from_strings)
116 >>> from canonical.launchpad.ftests import sync
117- >>> from canonical.launchpad.interfaces import (
118- ... ISourcePackageNameSet, IDistributionSet, IProductSet,
119- ... IPackagingUtil, IPersonSet, PackagingType, IBugTaskSet,
120- ... IBugWatchSet, BugTaskStatus)
121+ >>> from lp.registry.interfaces.sourcepackagename import (
122+ ... ISourcePackageNameSet)
123+ >>> from lp.registry.interfaces.distribution import IDistributionSet
124+ >>> from lp.registry.interfaces.product import IProductSet
125+ >>> from lp.registry.interfaces.packaging import (
126+ ... IPackagingUtil, PackagingType)
127+ >>> from lp.registry.interfaces.person import IPersonSet
128+ >>> from lp.bugs.interfaces.bugtask import IBugTaskSet, BugTaskStatus
129+ >>> from lp.bugs.interfaces.bugwatch import IBugWatchSet
130
131 >>> distroset = getUtility(IDistributionSet)
132 >>> ubuntu = distroset.getByName('ubuntu')
133@@ -21,7 +26,8 @@
134 >>> kubuntu = distroset.getByName('kubuntu')
135
136
137-== The API ==
138+The API
139+-------
140
141 IDistribution has a special API that allows you to assemble data for a
142 bug report that associates packages with upstream information linked to
143@@ -87,11 +93,11 @@
144 thunderbird None 1 1 1 1
145
146 We add two new bugs to pmount in Ubuntu. From now on we'll limit the
147-results to 3 packages (as a demonstration of the API) so thunderbird will be
148-popped off the list:
149+results to 3 packages (as a demonstration of the API) so thunderbird
150+will be popped off the list:
151
152 >>> bug = create_bug_from_strings(distribution='ubuntu',
153- ... sourcepackagename='pmount', owner='name12',
154+ ... sourcepackagename='pmount', owner='name12',
155 ... summary='pmount used to work', description='fix it',
156 ... status=BugTaskStatus.TRIAGED)
157 >>> bug = create_bug_from_strings(distribution='ubuntu',
158@@ -141,7 +147,8 @@
159 mozilla-firefox firefox 1 1 1 1
160
161
162-== Properties of BugReportData ==
163+Properties of BugReportData
164+---------------------------
165
166 The API listed above is based around BugReportData instances, each of
167 which offers a set of properties that can be used to accessed data. Each
168@@ -156,7 +163,8 @@
169 ... watched_bugs=60)
170
171
172-=== Percentages ===
173+Percentages
174+...........
175
176 BugReportData offers a set of *_percentage properties.
177
178@@ -179,7 +187,8 @@
179 85.714285714285708
180
181
182-=== Deltas ===
183+Deltas
184+......
185
186 BugReportData also offers a set of of *_delta properties along with the
187 *_percentage properties.
188@@ -190,8 +199,8 @@
189 >>> bug_data.triaged_bugs_delta
190 40
191
192-BugReportData.upstream bugs_delta is the difference between the number of
193-open bugs and the number of bugs forwarded upstream.
194+BugReportData.upstream bugs_delta is the difference between the number
195+of open bugs and the number of bugs forwarded upstream.
196
197 >>> bug_data.upstream_bugs_delta
198 20
199@@ -204,12 +213,13 @@
200 10
201
202
203-=== Classes ===
204+Classes
205+.......
206
207-Finally, BugReportData offers a set of *_class properties. These
208-provide the correct CSS class to use for rendering the data in a table.
209-They return 'good' if the property that they represent is above a
210-certain threshold or an empty string if not.
211+Finally, BugReportData offers a set of *_class properties. These provide
212+the correct CSS class to use for rendering the data in a table. They
213+return 'good' if the property that they represent is above a certain
214+threshold or an empty string if not.
215
216 BugReportData.triaged_bugs_class returns 'good' if the
217 triaged_bugs_percentage is greater than BugReportData.TRIAGED_THRESHOLD.
218@@ -295,7 +305,8 @@
219 ''
220
221
222-== The view ==
223+The view
224+--------
225
226 We test that the view data is constructed sanely and without any hidden
227 defects. Let's set up some helpers to make it easier for us to output
228@@ -358,9 +369,9 @@
229 NO PRODUCT
230 NO URL
231 NO URL
232- **linux-source-2.6.15/+bugs?search=Search&field.status_upstream=open_upstream
233- **linux-source-2.6.15/+bugs?search=Search&field.status_upstream=hide_upstream
234- **linux-source-2.6.15/+bugs?search=Search&field.status_upstream=pending_bugwatch
235+ **linux-source-2.6.15/+bugs?...&field.status_upstream=open_upstream
236+ **linux-source-2.6.15/+bugs?...h&field.status_upstream=hide_upstream
237+ **linux-source-2.6.15/+bugs?...&field.status_upstream=pending_bugwatch
238 --
239 mozilla-firefox ubuntu hoary
240 firefox
241@@ -368,7 +379,7 @@
242 http://launchpad.dev/firefox/+edit
243 **mozilla-firefox/+bugs?search=Search&field.status_upstream=open_upstream
244 **mozilla-firefox/+bugs?search=Search&field.status_upstream=hide_upstream
245- **mozilla-firefox/+bugs?search=Search&field.status_upstream=pending_bugwatch
246+ **mozilla-firefox/+bugs?...&field.status_upstream=pending_bugwatch
247 --
248 thunderbird ubuntu hoary
249 NO PRODUCT
250@@ -410,7 +421,8 @@
251 0 0 0 0 0.0 0.0 0.0 0 0 0
252
253
254-== Sorting the report ==
255+Sorting the report
256+------------------
257
258 The upstream report is sortable by each of the columns displayed. We'll
259 demonstrate this using the Ubuntu report.
260@@ -552,6 +564,5 @@
261 bug_supervisor_name /@@/arrowBlank
262 bugtracker_name /@@/arrowDown...
263
264-PS: This page is actually browser-tested in
265-pagetests.distribution-upstream-bug-report. Look there for more details.
266-
267+PS: This page is actually browser-tested in pagetests.distribution-
268+upstream-bug-report. Look there for more details.
269
270=== modified file 'lib/lp/registry/browser/configure.zcml'
271--- lib/lp/registry/browser/configure.zcml 2009-10-09 17:18:38 +0000
272+++ lib/lp/registry/browser/configure.zcml 2009-10-16 20:36:17 +0000
273@@ -1647,7 +1647,7 @@
274 <browser:page
275 name="+addpackage"
276 for="lp.registry.interfaces.productseries.IProductSeries"
277- class="canonical.launchpad.browser.PackagingAddView"
278+ class="lp.registry.browser.packaging.PackagingAddView"
279 facet="overview"
280 permission="launchpad.Edit"
281 template="../templates/productseries-packaging.pt"/>
282
283=== modified file 'lib/lp/registry/browser/distributionsourcepackage.py'
284--- lib/lp/registry/browser/distributionsourcepackage.py 2009-09-25 17:00:20 +0000
285+++ lib/lp/registry/browser/distributionsourcepackage.py 2009-10-16 20:36:17 +0000
286@@ -32,7 +32,7 @@
287 from lp.soyuz.interfaces.distributionsourcepackagerelease import (
288 IDistributionSourcePackageRelease)
289 from lp.soyuz.interfaces.packagediff import IPackageDiffSet
290-from canonical.launchpad.interfaces.packaging import IPackagingUtil
291+from lp.registry.interfaces.packaging import IPackagingUtil
292 from lp.registry.interfaces.pocket import pocketsuffix
293 from lp.registry.interfaces.product import IDistributionSourcePackage
294 from lp.bugs.browser.bugtask import BugTargetTraversalMixin
295
296=== renamed file 'lib/canonical/launchpad/browser/packaging.py' => 'lib/lp/registry/browser/packaging.py'
297--- lib/canonical/launchpad/browser/packaging.py 2009-09-12 06:11:08 +0000
298+++ lib/lp/registry/browser/packaging.py 2009-10-16 20:36:17 +0000
299@@ -10,7 +10,7 @@
300 from zope.component import getUtility
301
302 from canonical.launchpad import _
303-from canonical.launchpad.interfaces.packaging import (
304+from lp.registry.interfaces.packaging import (
305 IPackaging, IPackagingUtil)
306 from canonical.launchpad.webapp import canonical_url
307 from canonical.launchpad.webapp.launchpadform import action, LaunchpadFormView
308
309=== modified file 'lib/lp/registry/browser/sourcepackage.py'
310--- lib/lp/registry/browser/sourcepackage.py 2009-09-25 17:00:20 +0000
311+++ lib/lp/registry/browser/sourcepackage.py 2009-10-16 20:36:17 +0000
312@@ -26,7 +26,7 @@
313 from lp.answers.browser.questiontarget import (
314 QuestionTargetFacetMixin, QuestionTargetAnswersMenu)
315 from lp.services.worlddata.interfaces.country import ICountry
316-from canonical.launchpad.interfaces.packaging import IPackaging
317+from lp.registry.interfaces.packaging import IPackaging
318 from lp.registry.interfaces.pocket import PackagePublishingPocket
319 from lp.registry.interfaces.sourcepackage import ISourcePackage
320 from lp.translations.interfaces.potemplate import IPOTemplateSet
321
322=== renamed file 'lib/canonical/launchpad/browser/tests/test_packaging.py' => 'lib/lp/registry/browser/tests/test_packaging.py'
323--- lib/canonical/launchpad/browser/tests/test_packaging.py 2009-06-25 05:30:52 +0000
324+++ lib/lp/registry/browser/tests/test_packaging.py 2009-10-16 20:36:17 +0000
325@@ -9,8 +9,10 @@
326
327 from zope.component import getUtility
328
329-from canonical.launchpad.interfaces import (
330- IDistributionSet, IProductSet, ISourcePackageNameSet, IPackagingUtil)
331+from lp.registry.interfaces.distribution import IDistributionSet
332+from lp.registry.interfaces.packaging import IPackagingUtil
333+from lp.registry.interfaces.product import IProductSet
334+from lp.registry.interfaces.sourcepackagename import ISourcePackageNameSet
335 from canonical.launchpad.ftests import login, logout
336 from canonical.launchpad.testing.pages import setupBrowser
337 from canonical.testing import PageTestLayer
338
339=== modified file 'lib/lp/registry/browser/tests/test_person_view.py'
340--- lib/lp/registry/browser/tests/test_person_view.py 2009-09-19 11:46:50 +0000
341+++ lib/lp/registry/browser/tests/test_person_view.py 2009-10-16 20:36:17 +0000
342@@ -7,7 +7,8 @@
343
344 from zope.component import getUtility
345
346-from canonical.launchpad.interfaces import IKarmaCacheManager, NotFoundError
347+from canonical.launchpad.webapp.interfaces import NotFoundError
348+from lp.registry.interfaces.karma import IKarmaCacheManager
349 from canonical.launchpad.webapp.servers import LaunchpadTestRequest
350 from canonical.testing import LaunchpadZopelessLayer
351 from lp.registry.browser.person import PersonView
352
353=== modified file 'lib/lp/registry/configure.zcml'
354--- lib/lp/registry/configure.zcml 2009-09-10 10:27:20 +0000
355+++ lib/lp/registry/configure.zcml 2009-10-16 20:36:17 +0000
356@@ -1641,4 +1641,27 @@
357 <allow
358 interface="lp.registry.interfaces.mentoringoffer.IMentoringOfferSet"/>
359 </securedutility>
360+
361+ <!-- Packaging -->
362+ <class
363+ class="lp.registry.model.packaging.Packaging">
364+ <allow
365+ interface="lp.registry.interfaces.packaging.IPackaging"/>
366+ <require
367+ permission="zope.Public"
368+ set_schema="lp.registry.interfaces.packaging.IPackaging"/>
369+ </class>
370+
371+ <!-- PackagingUtil -->
372+ <class
373+ class="lp.registry.model.packaging.PackagingUtil">
374+ <allow
375+ interface="lp.registry.interfaces.packaging.IPackagingUtil"/>
376+ </class>
377+ <securedutility
378+ class="lp.registry.model.packaging.PackagingUtil"
379+ provides="lp.registry.interfaces.packaging.IPackagingUtil">
380+ <allow
381+ interface="lp.registry.interfaces.packaging.IPackagingUtil"/>
382+ </securedutility>
383 </configure>
384
385=== modified file 'lib/lp/registry/doc/sourcepackage.txt'
386--- lib/lp/registry/doc/sourcepackage.txt 2009-09-19 08:14:43 +0000
387+++ lib/lp/registry/doc/sourcepackage.txt 2009-10-16 20:36:17 +0000
388@@ -1,19 +1,22 @@
389-= Source Packages =
390-
391-A source package is a thing from which binary packages are built, to then be
392-installed using a package management tool like apt-get or rpm. One named source
393-package in a distro may be used to build several different named binary
394-packages, on one or more architectures. One named binary package in a distro
395-may have been built from more than one named source package (e.g. a different
396-source package may have been used to build "foo" on i386 vs. "foo" on ppc.)
397-
398-
399-== Named Source Package ==
400-
401-The are various metadata we're interested in collecting about a bundle of code
402-used to build binary packages for installation in a particular distro series.
403-One such thing is the name of that bundle of code. This is abstracted into a
404-separate SourcePackageName table.
405+Source Packages
406+===============
407+
408+A source package is a thing from which binary packages are built, to
409+then be installed using a package management tool like apt-get or rpm.
410+One named source package in a distro may be used to build several
411+different named binary packages, on one or more architectures. One named
412+binary package in a distro may have been built from more than one named
413+source package (e.g. a different source package may have been used to
414+build "foo" on i386 vs. "foo" on ppc.)
415+
416+
417+Named Source Package
418+--------------------
419+
420+The are various metadata we're interested in collecting about a bundle
421+of code used to build binary packages for installation in a particular
422+distro series. One such thing is the name of that bundle of code. This
423+is abstracted into a separate SourcePackageName table.
424
425 Accessing source package names is done through the ISourcePackageNameSet
426 utility.
427@@ -21,10 +24,12 @@
428 The ISourcePackageNameSet utility is accessed in the usual fashion:
429
430 >>> from zope.component import getUtility
431- >>> from canonical.launchpad.interfaces import ISourcePackageNameSet
432+ >>> from lp.registry.interfaces.sourcepackagename import (
433+ ... ISourcePackageNameSet)
434 >>> sourcepackagenameset = getUtility(ISourcePackageNameSet)
435
436-To retrieve a specific source package name, use ISourcePackageNameSet.get:
437+To retrieve a specific source package name, use
438+ISourcePackageNameSet.get:
439
440 >>> firefox = sourcepackagenameset.get(1)
441 >>> print firefox.name
442@@ -44,12 +49,13 @@
443 None
444
445
446-=== Latest published component ===
447+Latest published component
448+..........................
449
450 The 'latest_published_component' attribute indicates the component where
451 the package was last published.
452
453- >>> from canonical.launchpad.interfaces import IDistributionSet
454+ >>> from lp.registry.interfaces.distribution import IDistributionSet
455 >>> ubuntu = getUtility(IDistributionSet).getByName('ubuntu')
456 >>> ubuntu_warty = ubuntu.getSeries('warty')
457 >>> firefox_warty = ubuntu_warty.getSourcePackage('mozilla-firefox')
458@@ -65,6 +71,7 @@
459
460 # Remove the security proxy to access the non-public
461 # _getPublishingHistory method.
462+
463 >>> from zope.security.proxy import removeSecurityProxy
464 >>> publishing_history = removeSecurityProxy(
465 ... firefox_warty)._getPublishingHistory()
466@@ -82,6 +89,7 @@
467 # SourcePackagePublishingHistory is just a view on
468 # SecureSourcePackagePublishingHistory with some rows removed, so need
469 # to update the SecureSourcePackagePublishingHistory table.
470+
471 >>> latest_publishing = SecureSourcePackagePublishingHistory.get(
472 ... publishing_history[-1].id)
473 >>> universe = Component.byName('universe')
474@@ -92,6 +100,7 @@
475 >>> for release in firefox_warty.distinctreleases:
476 ... print release.component.name
477 main
478+
479 >>> firefox_warty.latest_published_component.name
480 u'universe'
481
482@@ -131,11 +140,12 @@
483 ... pmount_hoary['0.1-1'].publishing_history[0].id)
484 >>> secure_pub.datesuperseded is not None
485 True
486+
487 >>> secure_pub.dateremoved is None
488 True
489
490-We will emulate disk-removal to ensure it will continue to be
491-reachable. See bug #179028 for further information.
492+We will emulate disk-removal to ensure it will continue to be reachable.
493+See bug #179028 for further information.
494
495 >>> from datetime import timedelta
496 >>> secure_pub.dateremoved = secure_pub.datesuperseded + timedelta(days=1)
497@@ -152,11 +162,12 @@
498 >>> len(list(pmount_hoary.distinctreleases))
499 2
500
501-We will leave the pmount_0.1-1 marked as 'removed from disk' because
502-we do want it to affect the next test cases.
503-
504-
505-== Distribution Source Packages ==
506+We will leave the pmount_0.1-1 marked as 'removed from disk' because we
507+do want it to affect the next test cases.
508+
509+
510+Distribution Source Packages
511+----------------------------
512
513 In some cases it's useful to be able to refer to a source package at a
514 distribution level, independent of any particular distroseries. For
515@@ -167,20 +178,26 @@
516 To retrieve a distribution source package, use the getSourcePackage
517 method on a distribution:
518
519- >>> from canonical.launchpad.interfaces import (
520- ... IDistributionSet, IDistributionSourcePackage)
521+ >>> from lp.registry.interfaces.distribution import IDistributionSet
522+ >>> from lp.registry.interfaces.distributionsourcepackage import (
523+ ... IDistributionSourcePackage)
524 >>> ubuntu = getUtility(IDistributionSet).get(1)
525 >>> ubuntu_firefox = ubuntu.getSourcePackage(firefox)
526 >>> IDistributionSourcePackage.providedBy(ubuntu_firefox)
527 True
528+
529 >>> print ubuntu_firefox.name
530 mozilla-firefox
531+
532 >>> print ubuntu_firefox.title.encode('ascii', 'backslashreplace')
533 \u201cmozilla-firefox\u201d package in Ubuntu
534+
535 >>> print ubuntu_firefox.displayname
536 mozilla-firefox in ubuntu
537+
538 >>> ubuntu_firefox.distribution == ubuntu
539 True
540+
541 >>> ubuntu_firefox.sourcepackagename == firefox
542 True
543
544@@ -192,24 +209,27 @@
545
546 >>> ubuntu_firefox_also == ubuntu_firefox
547 True
548+
549 >>> ubuntu_firefox != debian_firefox
550 True
551
552 You can search for bugs in an IDistroSourcePackage using the
553 .searchTasks method:
554
555- >>> from canonical.launchpad.interfaces import (
556+ >>> from lp.bugs.interfaces.bugtask import (
557 ... BugTaskSearchParams, BugTaskStatus)
558 >>> params = BugTaskSearchParams(
559 ... status=BugTaskStatus.NEW, user=None)
560 >>> tasks = ubuntu_firefox.searchTasks(params)
561 >>> tasks.count()
562 1
563+
564 >>> tasks[0].id
565 17
566
567
568-== Packaging ==
569+Packaging
570+---------
571
572 Distribution packages are linked to upstream productseries through the
573 packaging process. Here we test the code that links all of those.
574@@ -230,7 +250,8 @@
575 >>> sid = DistroSeries.get(8)
576 >>> g2k5 = DistroSeries.get(9)
577
578-Now let's make sure that we can see a productseries for a source package.
579+Now let's make sure that we can see a productseries for a source
580+package.
581
582 >>> from lp.registry.model.sourcepackage import SourcePackage
583 >>> sp = SourcePackage(sourcepackagename=firefox, distroseries=hoary)
584@@ -239,9 +260,9 @@
585
586 Now we make sure there is no Packaging data for a52dec in hoary.
587
588- >>> from canonical.launchpad.database import PackagingUtil
589+ >>> from lp.registry.model.packaging import PackagingUtil
590 >>> a52decsp = SourcePackage(sourcepackagename=a52dec,
591- ... distroseries=hoary)
592+ ... distroseries=hoary)
593 >>> a52decsp.productseries.name
594 u'trunk'
595
596@@ -265,9 +286,10 @@
597 >>> a52decsp.productseries.product.name
598 u'a52dec'
599
600-Similarly, we should be able to get the packaging information from a parent
601-distroseries, on the basis that a derivative is highly unlikely to change
602-the packaging drastically without changing the name of the package.
603+Similarly, we should be able to get the packaging information from a
604+parent distroseries, on the basis that a derivative is highly unlikely
605+to change the packaging drastically without changing the name of the
606+package.
607
608 First, show there is no packging data for a52dec in g2k5:
609
610@@ -275,7 +297,7 @@
611 ... productseries=a52decsp.productseries,
612 ... sourcepackagename=a52dec,
613 ... distroseries=g2k5)
614- False
615+ False
616
617 Now verify we still get a product for that source package
618
619@@ -286,7 +308,7 @@
620 And if we want to link that productseries to a source package in that
621 distroseries
622
623- >>> from canonical.launchpad.interfaces import PackagingType
624+ >>> from lp.registry.interfaces.packaging import PackagingType
625 >>> from lp.registry.model.person import Person
626 >>> foobar = Person.byName('name16')
627 >>> PackagingUtil().createPackaging(
628@@ -314,10 +336,9 @@
629 ... distroseries=g2k5)
630 False
631
632-Linkified changelogs are available through SourcePackageReleaseView:
633-XXX julian 2007-09-17
634-This is duplicating the page test. Instead it should be more like the bug
635-number linkification just below.
636+Linkified changelogs are available through SourcePackageReleaseView: XXX
637+julian 2007-09-17 This is duplicating the page test. Instead it should
638+be more like the bug number linkification just below.
639
640 >>> from zope.component import queryMultiAdapter
641 >>> from zope.publisher.browser import TestRequest
642@@ -338,13 +359,13 @@
643 * Fix debian (Debian #2000)
644 * Fix warty (Warty Ubuntu #1)
645 <BLANKLINE>
646- -- Sample Person &lt;email address hidden&gt; Tue, 7 Feb 2006 12:10:08 +0300
647+ -- Sample Person &lt;email address hidden&gt; ... Feb 2006 12:10:08 +0300
648 <BLANKLINE>
649 <BLANKLINE>
650
651-The view will linkify bug numbers of the format "LP: #number" in the changelog
652-if number is a valid bug ID (also see Soyuz page tests
653-24-sourcepackage-changelog.txt). The changelog() method calls a method
654+The view will linkify bug numbers of the format "LP: #number" in the
655+changelog if number is a valid bug ID (also see Soyuz page tests 24
656+-sourcepackage-changelog.txt). The changelog() method calls a method
657 _linkify_bug_numbers() to do this.
658
659 Zero or more spaces may appear between the ":" and the "#".
660@@ -378,7 +399,8 @@
661 u'lp: <a href="/bugs/10" title="another test bug">#10</a>'
662
663
664-== Comparing Sourcepackages ==
665+Comparing Sourcepackages
666+------------------------
667
668 Lastly, note that sourcepackages know how to compare to each other:
669
670@@ -391,8 +413,10 @@
671
672 >>> hoary_firefox_one == hoary_firefox_two
673 True
674+
675 >>> hoary_firefox_one != warty_firefox
676 True
677+
678 >>> hoary_firefox_one == warty_firefox
679 False
680
681@@ -400,6 +424,7 @@
682
683 >>> hash(hoary_firefox_one) == hash(hoary_firefox_two)
684 True
685+
686 >>> hash(hoary_firefox_one) != hash(warty_firefox)
687 True
688
689@@ -408,26 +433,30 @@
690 >>> a_map[warty_firefox] = 'warty'
691 >>> a_map[hoary_firefox_two]
692 'hoary'
693+
694 >>> a_map[warty_firefox]
695 'warty'
696
697
698-== Direct Packagings ==
699+Direct Packagings
700+-----------------
701
702 The direct packaging returns the IPackaging related to the source
703 package.
704
705 >>> print sp.direct_packaging
706 None
707+
708 >>> print hoary_firefox_one.direct_packaging.productseries.title
709 Mozilla Firefox 1.0 series
710+
711 >>> print warty_firefox.direct_packaging.productseries.title
712 Mozilla Firefox trunk series
713
714 If multiple product series link to a sourcepackage, direct_packaging
715 returns the last packaging added:
716
717- >>> from canonical.launchpad.interfaces import IProductSet
718+ >>> from lp.registry.interfaces.product import IProductSet
719 >>> firefox_product = getUtility(IProductSet).getByName('firefox')
720 >>> firefox_trunk = firefox_product.getSeries('trunk')
721 >>> PackagingUtil().createPackaging(
722@@ -440,13 +469,14 @@
723 Mozilla Firefox trunk series
724
725
726-== Release History ==
727+Release History
728+---------------
729
730 The distinct release history for a SourcePackage is obtained via
731 'distinctreleases' property.
732
733-We will use `SoyuzTestPublisher` for creating source releases in
734-Ubuntu warty and hoary series.
735+We will use `SoyuzTestPublisher` for creating source releases in Ubuntu
736+warty and hoary series.
737
738 >>> from lp.soyuz.tests.test_publishing import (
739 ... SoyuzTestPublisher)
740@@ -465,8 +495,8 @@
741
742 >>> login(ANONYMOUS)
743
744-Warty, hoary and grumpy SourcePackages only consider their
745-corresponding versions, their history is isolated by series.
746+Warty, hoary and grumpy SourcePackages only consider their corresponding
747+versions, their history is isolated by series.
748
749 >>> def print_releases(sourcepackage):
750 ... releases = sourcepackage.distinctreleases
751@@ -490,8 +520,8 @@
752 No releases available
753
754 The SourcePackage history can overlap if releases are copied across
755-distroseries. The 'test-source - 1.0' is copied from warty to hoary
756-and is present in the history for both.
757+distroseries. The 'test-source - 1.0' is copied from warty to hoary and
758+is present in the history for both.
759
760 >>> login('foo.bar@canonical.com')
761 >>> copied_source = warty_source.copyTo(
762@@ -506,7 +536,8 @@
763 test-source - 1.0
764
765 We will create new source releases in warty and verify the ResultSet
766-returned from 'distinctreleases' is ordered by descending source version.
767+returned from 'distinctreleases' is ordered by descending source
768+version.
769
770 >>> login('foo.bar@canonical.com')
771
772@@ -524,7 +555,8 @@
773 test-source - 0.9
774
775
776-== Interface implementation ==
777+Interface implementation
778+------------------------
779
780 SourcePackage implements IHasTranslationImports interface:
781
782@@ -533,5 +565,8 @@
783 ... IHasTranslationImports)
784 >>> IHasTranslationImports.providedBy(warty_firefox)
785 True
786+
787 >>> verifyObject(IHasTranslationImports, warty_firefox)
788 True
789+
790+
791
792=== renamed file 'lib/canonical/launchpad/interfaces/packaging.py' => 'lib/lp/registry/interfaces/packaging.py'
793=== modified file 'lib/lp/registry/model/distribution.py'
794--- lib/lp/registry/model/distribution.py 2009-09-09 11:28:03 +0000
795+++ lib/lp/registry/model/distribution.py 2009-10-16 20:36:17 +0000
796@@ -90,7 +90,7 @@
797 from canonical.launchpad.interfaces.launchpad import (
798 IHasIcon, IHasLogo, IHasMugshot, ILaunchpadCelebrities, ILaunchpadUsage)
799 from lp.soyuz.interfaces.queue import PackageUploadStatus
800-from canonical.launchpad.interfaces.packaging import PackagingType
801+from lp.registry.interfaces.packaging import PackagingType
802 from lp.registry.interfaces.pillar import IPillarNameSet
803 from lp.soyuz.interfaces.publishing import (
804 active_publishing_status, PackagePublishingStatus)
805
806=== modified file 'lib/lp/registry/model/distroseries.py'
807--- lib/lp/registry/model/distroseries.py 2009-09-09 11:28:03 +0000
808+++ lib/lp/registry/model/distroseries.py 2009-10-16 20:36:17 +0000
809@@ -39,7 +39,7 @@
810 from lp.translations.model.pofiletranslator import (
811 POFileTranslator)
812 from lp.translations.model.pofile import POFile
813-from canonical.launchpad.interfaces import IStore
814+from canonical.launchpad.interfaces.lpstorm import IStore
815 from lp.soyuz.adapters.packagelocation import PackageLocation
816 from lp.soyuz.model.binarypackagename import BinaryPackageName
817 from lp.soyuz.model.binarypackagerelease import (
818@@ -66,7 +66,7 @@
819 from lp.registry.model.milestone import (
820 HasMilestonesMixin, Milestone)
821 from lp.soyuz.model.packagecloner import clone_packages
822-from canonical.launchpad.database.packaging import Packaging
823+from lp.registry.model.packaging import Packaging
824 from lp.registry.model.person import Person
825 from canonical.launchpad.database.librarian import LibraryFileAlias
826 from lp.translations.model.potemplate import (
827
828=== renamed file 'lib/canonical/launchpad/database/packaging.py' => 'lib/lp/registry/model/packaging.py'
829--- lib/canonical/launchpad/database/packaging.py 2009-06-25 05:30:52 +0000
830+++ lib/lp/registry/model/packaging.py 2009-10-16 20:36:17 +0000
831@@ -14,8 +14,8 @@
832 from canonical.database.datetimecol import UtcDateTimeCol
833 from canonical.database.enumcol import EnumCol
834 from canonical.database.sqlbase import SQLBase
835-from canonical.launchpad.interfaces import (
836- PackagingType, IPackaging, IPackagingUtil)
837+from lp.registry.interfaces.packaging import (
838+ IPackaging, IPackagingUtil, PackagingType)
839 from lp.registry.interfaces.person import validate_public_person
840
841
842
843=== modified file 'lib/lp/registry/model/product.py'
844--- lib/lp/registry/model/product.py 2009-10-07 22:30:34 +0000
845+++ lib/lp/registry/model/product.py 2009-10-16 20:36:17 +0000
846@@ -32,7 +32,7 @@
847 from canonical.database.datetimecol import UtcDateTimeCol
848 from canonical.database.enumcol import EnumCol
849 from canonical.database.sqlbase import quote, SQLBase, sqlvalues
850-from canonical.launchpad.interfaces import IStore
851+from canonical.launchpad.interfaces.lpstorm import IStore
852 from lp.code.model.branchvisibilitypolicy import (
853 BranchVisibilityPolicyMixin)
854 from lp.code.model.hasbranches import HasBranchesMixin, HasMergeProposalsMixin
855@@ -57,7 +57,7 @@
856 from lp.registry.interfaces.person import (
857 validate_person_not_private_membership, validate_public_person)
858 from lp.registry.model.announcement import MakesAnnouncements
859-from canonical.launchpad.database.packaging import Packaging
860+from lp.registry.model.packaging import Packaging
861 from lp.registry.model.pillar import HasAliasMixin
862 from lp.registry.model.person import Person
863 from lp.registry.model.productlicense import ProductLicense
864
865=== modified file 'lib/lp/registry/model/productseries.py'
866--- lib/lp/registry/model/productseries.py 2009-10-06 17:45:46 +0000
867+++ lib/lp/registry/model/productseries.py 2009-10-16 20:36:17 +0000
868@@ -33,7 +33,7 @@
869 from lp.services.worlddata.model.language import Language
870 from lp.registry.model.milestone import (
871 HasMilestonesMixin, Milestone)
872-from canonical.launchpad.database.packaging import Packaging
873+from lp.registry.model.packaging import Packaging
874 from lp.registry.interfaces.person import (
875 validate_person_not_private_membership)
876 from lp.translations.model.pofile import POFile
877@@ -53,7 +53,7 @@
878 from lp.registry.interfaces.distroseries import DistroSeriesStatus
879 from lp.registry.model.distroseries import SeriesMixin
880 from canonical.launchpad.interfaces.launchpad import ILaunchpadCelebrities
881-from canonical.launchpad.interfaces.packaging import PackagingType
882+from lp.registry.interfaces.packaging import PackagingType
883 from lp.translations.interfaces.potemplate import IHasTranslationTemplates
884 from lp.blueprints.interfaces.specification import (
885 SpecificationDefinitionStatus, SpecificationFilter,
886
887=== modified file 'lib/lp/registry/model/sourcepackage.py'
888--- lib/lp/registry/model/sourcepackage.py 2009-09-30 18:15:41 +0000
889+++ lib/lp/registry/model/sourcepackage.py 2009-10-16 20:36:17 +0000
890@@ -32,11 +32,11 @@
891 DistributionSourcePackageRelease)
892 from lp.soyuz.model.distroseriessourcepackagerelease import (
893 DistroSeriesSourcePackageRelease)
894-from canonical.launchpad.database.packaging import Packaging
895+from lp.registry.model.packaging import Packaging
896 from lp.translations.model.potemplate import (
897 HasTranslationTemplatesMixin,
898 POTemplate)
899-from canonical.launchpad.interfaces import IStore
900+from canonical.launchpad.interfaces.lpstorm import IStore
901 from lp.soyuz.model.publishing import (
902 SourcePackagePublishingHistory)
903 from lp.answers.model.question import (
904@@ -50,7 +50,7 @@
905 from canonical.launchpad.helpers import shortlist
906 from lp.soyuz.interfaces.build import BuildStatus
907 from lp.soyuz.interfaces.buildrecords import IHasBuildRecords
908-from canonical.launchpad.interfaces.packaging import PackagingType
909+from lp.registry.interfaces.packaging import PackagingType
910 from lp.translations.interfaces.potemplate import IHasTranslationTemplates
911 from lp.registry.interfaces.pocket import PackagePublishingPocket
912 from lp.soyuz.interfaces.publishing import PackagePublishingStatus
913
914=== added directory 'lib/lp/registry/stories/packaging'
915=== renamed file 'lib/canonical/launchpad/pagetests/packaging/xx-sourcepackage-packaging.txt' => 'lib/lp/registry/stories/packaging/xx-sourcepackage-packaging.txt'
916=== renamed file 'lib/canonical/launchpad/pagetests/packaging/xx-ubuntu-pkging.txt' => 'lib/lp/registry/stories/packaging/xx-ubuntu-pkging.txt'
917=== renamed file 'lib/canonical/launchpad/tests/test_packaging.py' => 'lib/lp/registry/tests/test_packaging.py'
918--- lib/canonical/launchpad/tests/test_packaging.py 2009-06-25 05:30:52 +0000
919+++ lib/lp/registry/tests/test_packaging.py 2009-10-16 20:36:17 +0000
920@@ -9,8 +9,10 @@
921
922 from zope.component import getUtility
923
924-from canonical.launchpad.interfaces import (
925- IDistributionSet, IProductSet, ISourcePackageNameSet, IPackagingUtil)
926+from lp.registry.interfaces.distribution import IDistributionSet
927+from lp.registry.interfaces.packaging import IPackagingUtil
928+from lp.registry.interfaces.product import IProductSet
929+from lp.registry.interfaces.sourcepackagename import ISourcePackageNameSet
930 from canonical.launchpad.ftests import login
931 from canonical.testing import LaunchpadFunctionalLayer
932
933
934=== modified file 'utilities/migrater/migrater.py'
935--- utilities/migrater/migrater.py 2009-09-17 17:29:33 +0000
936+++ utilities/migrater/migrater.py 2009-10-16 20:36:17 +0000
937@@ -33,6 +33,7 @@
938 svc='services',
939 tes='testing',
940 tra='translations',
941+ pkg='registry',
942 )
943
944 RENAME_MAP = dict(
945@@ -108,6 +109,7 @@
946
947 COLLIDED = []
948
949+
950 def move_it(old_path, new_path):
951 """Move a versioned file without colliding with another file."""
952 # Move the file and fix the imports. LBYL.
953@@ -233,8 +235,8 @@
954 # All unit tests except to browser unit tests move to the app
955 # tests dir.
956 new_path = os.sep.join(
957- path_part for path_part in path.split(os.sep)
958- if path_path not in unsupported_dirs)
959+ path_part for path_part in new_path.split(os.sep)
960+ if path_part not in unsupported_dirs)
961 # Create new_path's directory if it doesn't exist yet.
962 try:
963 test_dir, dummy = os.path.split(new_path)
964@@ -586,7 +588,7 @@
965 path, file_name = os.path.split(to_path)
966 spew(" to_path = %s", to_path)
967 new_path_to_dir = os.path.join(NEW_TOP, app_name, path)
968- new_path_to_fn = os.path.join(NEW_TOP, app_name, to_path)
969+ new_path_to_fn = os.path.join(NEW_TOP, app_name, to_path)
970 # Special cases.
971 if set(fpath.split(os.sep)) & TEST_PATHS:
972 handle_test(full_path, new_path_to_fn)