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
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
|
DistributionSourcePackageRelease views
======================================
# Create a brand new publication of 'testing-dspr - 1.0' for tests.
>>> from lp.soyuz.tests.test_publishing import SoyuzTestPublisher
>>> stp = SoyuzTestPublisher()
>>> login('foo.bar@canonical.com')
>>> stp.prepareBreezyAutotest()
>>> source = stp.getPubSource('testing-dspr', version='1.0')
>>> login(ANONYMOUS)
>>> dspr = stp.ubuntutest.getSourcePackageRelease(
... source.sourcepackagerelease)
`DistributionSourcePackageReleaseView` provides 'page_title', which
simply mimics the `DistributionSourcePackageRelease.title`.
>>> dspr_view = create_initialized_view(dspr, name="+index")
>>> print dspr.title
"testing-dspr" 1.0 source package in ubuntutest
>>> dspr_view.page_title
u'\u201ctesting-dspr\u201d 1.0 source package in ubuntutest'
The 'files' property returns a list of files included in the source
upload encapsulated as `ProxiedLibraryFileAlias` objects. Their
'http_url' points to the LP proxied url which normalizes the path
tofiles allowing them to be downloaded using `dget`.
>>> for source_file in dspr_view.files:
... print source_file.filename, source_file.http_url
testing-dspr_1.0.dsc
http://.../ubuntutest/+archive/primary/+files/testing-dspr_1.0.dsc
The 'sponsor' property indicates whether the upload was 'sponsored' or
not. When the upload was signed by someone else than the source
creator, the upload signer is the sponsor.
>>> print dspr.creator.displayname
Foo Bar
>>> print dspr_view.sponsor
None
# Forcibly change the SPR.creator, so the source becomes 'sponsored'.
>>> from zope.security.proxy import removeSecurityProxy
>>> login('foo.bar@canonical.com')
>>> a_person = factory.makePerson(name='novice')
>>> removeSecurityProxy(dspr.sourcepackagerelease).creator = a_person
>>> login(ANONYMOUS)
>>> dspr_view = create_initialized_view(dspr, name="+index")
>>> print dspr.creator.displayname
Novice
>>> print dspr_view.sponsor.displayname
Foo Bar
'currently_published' contains only PUBLISHED publications for this
`DistributionSourcePackageRelease` object. Since the testing DSPR only
contains a PENDING publication (see `SoyuzTestPublisher.getPubSource`)
this property is empty.
>>> len(dspr_view.currently_published)
0
It gets populated according to the publishing cycle, and subsequent
copies.
# Publish the pending testing publication.
>>> login('foo.bar@canonical.com')
>>> source.setPublished()
>>> transaction.commit()
>>> login(ANONYMOUS)
>>> dspr_view = create_initialized_view(dspr, name="+index")
>>> for publishing in dspr_view.currently_published:
... print publishing.distroseries.name
breezy-autotest
# Copy the testing publication to another series.
>>> from lp.soyuz.interfaces.publishing import PackagePublishingPocket
>>> login('foo.bar@canonical.com')
>>> release_pocket = PackagePublishingPocket.RELEASE
>>> hoary = stp.ubuntutest.getSeries('hoary-test')
>>> copied_source = source.copyTo(
... hoary, release_pocket, stp.ubuntutest.main_archive)
>>> copied_source.setPublished()
>>> transaction.commit()
>>> login(ANONYMOUS)
>>> dspr_view = create_initialized_view(dspr, name="+index")
>>> for publishing in dspr_view.currently_published:
... print publishing.distroseries.name
hoary-test
breezy-autotest
'grouped_builds' returns a list of dictionaries which contains
`IBuild`s for a given `IDistroSeries`.
>>> def print_grouped_builds():
... for build_group in dspr_view.grouped_builds:
... arch_tags = ' '.join(
... build.arch_tag for build in build_group['builds'])
... print '%s: %s' % (build_group['distroseries'].name, arch_tags)
... print 'END'
>>> print_grouped_builds()
END
# Create default builds for the testing DSPR.
>>> login('foo.bar@canonical.com')
>>> unused = source.createMissingBuilds()
>>> login(ANONYMOUS)
>>> dspr_view = create_initialized_view(dspr, name="+index")
>>> print_grouped_builds()
breezy-autotest: i386
END
The returned dictionaries are ordered by descending distroseries
version and their 'builds' are ordered by ascending 'architecturetag'.
# Create extras builds for the testing DSPR.
>>> login('foo.bar@canonical.com')
>>> hoary_amd64 = hoary['amd64']
>>> unused = source.sourcepackagerelease.createBuild(
... hoary_amd64, release_pocket, stp.ubuntutest.main_archive)
>>> breezy_hppa = stp.breezy_autotest['hppa']
>>> unused = source.sourcepackagerelease.createBuild(
... breezy_hppa, release_pocket, stp.ubuntutest.main_archive)
>>> login(ANONYMOUS)
>>> dspr_view = create_initialized_view(dspr, name="+index")
>>> print_grouped_builds()
hoary-test: amd64
breezy-autotest: hppa i386
END
|