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
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
|
Gina over Multiple Architectures (and Pockets, and Components)
--------------------------------------------------------------
Get the current counts of stuff in the database:
>>> from canonical.launchpad.database.emailaddress import EmailAddress
>>> from lp.registry.model.person import Person, WikiName
>>> from lp.registry.model.teammembership import TeamParticipation
>>> from lp.soyuz.model.binarypackagebuild import BinaryPackageBuild
>>> from lp.soyuz.model.binarypackagerelease import BinaryPackageRelease
>>> from lp.soyuz.model.publishing import (
... BinaryPackagePublishingHistory,
... SourcePackagePublishingHistory,
... )
>>> from lp.soyuz.model.sourcepackagerelease import SourcePackageRelease
>>> SSPPH = SourcePackagePublishingHistory
>>> SBPPH = BinaryPackagePublishingHistory
>>> orig_spr_count = SourcePackageRelease.select().count()
>>> orig_sspph_count = SSPPH.select().count()
>>> orig_person_count = Person.select().count()
>>> orig_tp_count = TeamParticipation.select().count()
>>> orig_email_count = EmailAddress.select().count()
>>> orig_wiki_count = WikiName.select().count()
>>> orig_bpr_count = BinaryPackageRelease.select().count()
>>> orig_build_count = BinaryPackageBuild.select().count()
>>> orig_sbpph_count = SBPPH.select().count()
Create a distribution series and an arch series for dapper:
>>> from lp.soyuz.model.distroarchseries import DistroArchSeries
>>> from lp.soyuz.model.processor import ProcessorFamily
>>> from lp.app.interfaces.launchpad import ILaunchpadCelebrities
>>> celebs = getUtility(ILaunchpadCelebrities)
>>> ubuntu = celebs.ubuntu
>>> hoary = ubuntu.getSeries("hoary")
# Only the distro owner or admins can create a series.
>>> login_person(ubuntu.owner.activemembers[0])
>>> dapper = ubuntu.newSeries("dapper", "Dapper Dragoon", "My title",
... "My summary", "My description", "5.10",
... hoary, celebs.launchpad_developers)
>>> login(ANONYMOUS)
Check it was properly created and create its DistroArchSeriess.
>>> from lp.registry.model.distroseries import DistroSeries
>>> dapper = DistroSeries.selectOneBy(name="dapper",
... distributionID=ubuntu.id)
>>> pf = ProcessorFamily.selectOneBy(name="x86")
>>> if pf is None:
... pf = ProcessorFamily(name="x86", title="X86",
... description="Intel X86")
>>> dar = DistroArchSeries(distroseries=dapper, processorfamily=pf,
... architecturetag="i386", official=True,
... owner=celebs.launchpad_developers)
>>> pf = ProcessorFamily.selectOneBy(name="amd64")
>>> if pf is None:
... pf = ProcessorFamily(name="amd64", title="AMD64",
... description="AMD 64")
>>> dar = DistroArchSeries(distroseries=dapper, processorfamily=pf,
... architecturetag="amd64", official=True,
... owner=celebs.launchpad_developers)
>>> pf = ProcessorFamily.selectOneBy(name="powerpc")
>>> if pf is None:
... pf = ProcessorFamily(name="powerpc", title="PowerPC",
... description="PowerPC")
>>> dar = DistroArchSeries(distroseries=dapper, processorfamily=pf,
... architecturetag="powerpc", official=True,
... owner=celebs.launchpad_developers)
>>> import transaction
>>> transaction.commit()
Let's set up the filesystem:
>>> import subprocess, sys, os
>>> try:
... os.unlink("/var/lock/launchpad-gina.lock")
... except OSError:
... pass
>>> try:
... os.remove('/tmp/gina_test_archive')
... except OSError:
... pass
>>> relative_path = ('lib/lp/soyuz/scripts/tests/gina_test_archive')
>>> path = os.path.join(os.getcwd(), relative_path)
>>> os.symlink(path, '/tmp/gina_test_archive')
Run gina without a powerpc processor for the powerpc family:
>>> gina_proc = [sys.executable, 'scripts/gina.py', '-q',
... 'dapper', 'dapper-updates']
>>> proc = subprocess.Popen(gina_proc, stderr=subprocess.PIPE)
>>> print proc.stderr.read()
ERROR Database setup required for run on powerpc
-> http://... (Unable to find a processor...dapper/powerpc)
<BLANKLINE>
>>> proc.wait()
1
Set up the processor, commit and run her again. Note that
dapper-updates/universe doesn't include the powerpc architecture, but we
just warn it and move right ahead.
>>> from lp.soyuz.model.processor import Processor
>>> p = Processor(name="powerpc", title="PowerPC", family=pf,
... description="The little processor that could")
>>> p == Processor.selectOneBy(familyID=pf.id)
True
>>> transaction.commit()
>>> gina_proc = [sys.executable, 'scripts/gina.py', '-q',
... 'dapper', 'dapper-updates']
>>> proc = subprocess.Popen(gina_proc, stderr=subprocess.PIPE)
>>> print proc.stderr.read()
WARNING No source package bdftopcf (0.99.0-1) listed for bdftopcf (0.99.0-1), scrubbing archive...
WARNING The archive for dapper-updates/universe doesn't contain a directory for powerpc, skipping
<BLANKLINE>
>>> proc.wait()
0
Make the changes visible elsewhere:
>>> transaction.commit()
Check the quantities that were returned. We have:
* bdftopdf, a binary package that comes from a source package that
isn't listed in the Sources file (but which we find).
* ekg, a source package that generates 3 binary packages.
We have two source packages, and we're only really publishing into
breezy:
>>> SourcePackageRelease.select().count() - orig_spr_count
2
>>> print SSPPH.select().count() - orig_sspph_count
2
Each source package has its own maintainer (in this case, fabbione and
porridge):
>>> print Person.select().count() - orig_person_count
2
>>> print TeamParticipation.select().count() - orig_tp_count
2
>>> print EmailAddress.select().count() - orig_email_count
2
There are 4 binary packages generated by the two builds of the two
source packages. We should only be publishing them into one
distroarchseries:
>>> BinaryPackageRelease.select().count() - orig_bpr_count
4
>>> BinaryPackageBuild.select().count() - orig_build_count
2
>>> SBPPH.select().count() - orig_sbpph_count
4
Check that the source package was correctly imported:
>>> from lp.soyuz.model.binarypackagename import BinaryPackageName
>>> from lp.registry.model.sourcepackagename import SourcePackageName
>>> n = SourcePackageName.selectOneBy(name="ekg")
>>> ekg = SourcePackageRelease.selectOneBy(sourcepackagenameID=n.id,
... version="1:1.5-4ubuntu1.2")
>>> print ekg.section.name
net
>>> print ekg.component.name
main
And that one of the packages in main is here too:
>>> n = BinaryPackageName.selectOneBy(name="libgadu-dev")
>>> ekg = BinaryPackageRelease.selectOneBy(binarypackagenameID=n.id,
... version="1:1.5-4ubuntu1.2")
>>> print ekg.section.name
libdevel
>>> print ekg.component.name
main
>>> print ekg.architecturespecific
True
>>> print ekg.build.processor.name
386
Check that the package it generates in universe was successfully
processed. In particular, its section should be stripped of the
component name.
>>> from lp.soyuz.enums import PackagePublishingPriority
>>> n = BinaryPackageName.selectOneBy(name="ekg")
>>> ekg = BinaryPackageRelease.selectOneBy(binarypackagenameID=n.id,
... version="1:1.5-4ubuntu1.2")
>>> print ekg.section.name
net
>>> print ekg.component.name
universe
>>> print ekg.priority == PackagePublishingPriority.OPTIONAL
True
The bdftopcf package is in a bit of a fix. Its binary package is present
in universe, but no source package is listed for it, and the actual
package files are in main! Gina to the rescue: she finds them in the
right place, updates the component, and creates it with a semi-bogus
DSC.
>>> n = BinaryPackageName.selectOneBy(name="bdftopcf")
>>> ekg = BinaryPackageRelease.selectOneBy(binarypackagenameID=n.id,
... version="0.99.0-1")
>>> print ekg.section.name
x11
>>> print ekg.component.name
universe
>>> print ekg.build.source_package_release.sourcepackagename.name
bdftopcf
>>> print ekg.build.source_package_release.component.name
main
>>> print ekg.build.source_package_release.version
0.99.0-1
Check that we publishing bdftopcf into the correct distroarchseries:
>>> pf = ProcessorFamily.selectOneBy(name="x86")
>>> dar = DistroArchSeries.selectOneBy(distroseriesID=dapper.id,
... processorfamilyID=pf.id, architecturetag="i386",
... official=True, ownerID=celebs.launchpad_developers.id)
>>> print dar.architecturetag
i386
>>> for entry in SBPPH.selectBy(distroarchseriesID=dar.id,
... orderBy="binarypackagerelease"):
... package = entry.binarypackagerelease
... print package.binarypackagename.name, package.version
bdftopcf 0.99.0-1
ekg 1:1.5-4ubuntu1.2
libgadu-dev 1:1.5-4ubuntu1.2
libgadu3 1:1.5-4ubuntu1.2
Be proper and clean up after ourselves.
>>> os.remove('/tmp/gina_test_archive')
|