~launchpad-pqm/launchpad/devel

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
= SourcePackage View Classes =

  >>> from zope.component import queryMultiAdapter
  >>> from canonical.launchpad.webapp.servers import LaunchpadTestRequest
  >>> from lp.registry.interfaces.distribution import IDistributionSet

Empty request.

  >>> mock_form = {}
  >>> request = LaunchpadTestRequest(form=mock_form)

Retrieve an known Sourcepackage object:

  >>> ubuntu = getUtility(IDistributionSet)['ubuntu']
  >>> hoary = ubuntu['hoary']
  >>> pmount = hoary.getSourcePackage('pmount')

Retrieve its respective View class:

  >>> pmount_view = queryMultiAdapter((pmount, request), name="+index")

Check the consistency of a handy structure containing the organized
published history of a sourcepackage. It should contain a list of
dictionaries containing all supported pockets as key 'pocketdetails'
and a list of packages represented by IDistroSeriesSourcePackageRelease
as 'packages', as:

  [
   {'pocketdetails': PackagePublishingPocket,
    'packages': [IDistroSeriesSourcePackagerelease, ...]}
   ...
  ]

Each pocket should only contain packages marked as PUBLISHED.

  >>> for pub in pmount_view.published_by_pocket():
  ...     pkg_versions = [p.version for p in pub['packages']]
  ...     print pub['pocketdetails'].title, sorted(pkg_versions)
  Release [u'0.1-2']
  Security []
  Updates []
  Proposed []
  Backports []


Check the consistence of the binaries dictionary, it should contains a
binarypackagename and the architecture where it was built.

Let's retrieve a new view with useful dependency data:

  >>> warty = ubuntu['warty']
  >>> firefox = warty.getSourcePackage('mozilla-firefox')
  >>> firefox_view = queryMultiAdapter((firefox, request), name="+index")

XXX cprov 20060210: this method is very confusing because the
architecturespecific attribute is hidden, i.e, this binary is
architecture independent and we don't know at this point, that's why we
have only on binary.

  >>> for bin_name, archs in firefox_view.binaries().items():
  ...    print bin_name, archs
  mozilla-firefox [u'hppa', u'i386']
  mozilla-firefox-data [u'hppa', u'i386']

Check the formatted dependency lines provided by the view class, they
return a IPackageRelationshipSet object (see package-relationship.txt).

  >>> firefox_parsed_depends = firefox_view.builddepends

  >>> from lp.soyuz.interfaces.packagerelationship import IPackageRelationshipSet
  >>> from canonical.launchpad.webapp.testing import verifyObject
  >>> verifyObject(IPackageRelationshipSet, firefox_parsed_depends)
  True

  >>> for dep in firefox_parsed_depends:
  ...    dep.name, dep.operator, dep.version, dep.url
  ('gcc-3.4', '>=', '3.4.1-4sarge1', None)
  ('gcc-3.4', '<<', '3.4.2', None)
  ('gcc-3.4-base', None, '', None)
  ('libc6', '>=', '2.3.2.ds1-4', None)
  ('libstdc++6-dev', '>=', '3.4.1-4sarge1', None)
  ('pmount', None, '', u'http://launchpad.dev/ubuntu/warty/+package/pmount')


  >>> firefox_parsed_dependsindep = firefox_view.builddependsindep

  >>> verifyObject(IPackageRelationshipSet, firefox_parsed_dependsindep)
  True

  >>> for dep in firefox_parsed_dependsindep:
  ...    dep.name, dep.operator, dep.version, dep.url
  ('bacula-common', '=', '1.34.6-2', None)
  ('bacula-director-common', '=', '1.34.6-2', None)
  ('pmount', None, '', u'http://launchpad.dev/ubuntu/warty/+package/pmount')
  ('postgresql-client', '>=', '7.4', None)

Ensure we have fixed bug 31039, by properly escape the
sourcepackagename before passing to regexp.

  >>> libc = hoary.getSourcePackage('libstdc++')['b8p']
  >>> libc_view = queryMultiAdapter((libc, request), name="+changelog")
  >>> print libc_view.changelog_entry
  libstdc++ (9.9-1) hoary; urgency=high
  <BLANKLINE>
   * Placeholder
  <BLANKLINE>
   -- Sample Person &lt;email address hidden&gt; Tue, 10 Feb 2006 10:10:08 +0300
  <BLANKLINE>
  <BLANKLINE>