Merge lp:~jelmer/launchpad/613468-xb-ppa-db into lp:launchpad/db-devel
- 613468-xb-ppa-db
- Merge into db-devel
Status: | Merged |
---|---|
Approved by: | Jelmer Vernooij |
Approved revision: | no longer in the source branch. |
Merged at revision: | 9651 |
Proposed branch: | lp:~jelmer/launchpad/613468-xb-ppa-db |
Merge into: | lp:launchpad/db-devel |
Diff against target: |
404 lines (+147/-40) 14 files modified
database/schema/comments.sql (+2/-0) database/schema/patch-2207-82-0.sql (+11/-0) lib/lp/registry/interfaces/distroseries.py (+3/-1) lib/lp/registry/model/distroseries.py (+3/-2) lib/lp/soyuz/doc/binarypackagebuild.txt (+11/-22) lib/lp/soyuz/interfaces/binarypackagebuild.py (+5/-4) lib/lp/soyuz/interfaces/binarypackagerelease.py (+3/-1) lib/lp/soyuz/interfaces/sourcepackagerelease.py (+3/-3) lib/lp/soyuz/model/binarypackagebuild.py (+7/-5) lib/lp/soyuz/model/binarypackagerelease.py (+18/-0) lib/lp/soyuz/model/sourcepackagerelease.py (+17/-0) lib/lp/soyuz/tests/test_binarypackagerelease.py (+51/-0) lib/lp/soyuz/tests/test_sourcepackagerelease.py (+9/-0) lib/lp/testing/factory.py (+4/-2) |
To merge this branch: | bzr merge lp:~jelmer/launchpad/613468-xb-ppa-db |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Michael Nelson (community) | code | Approve | |
Stuart Bishop (community) | db | Approve | |
Robert Collins | db | Pending | |
Review via email: mp+32307@code.launchpad.net |
Commit message
Add SourcePackageRe
Description of the change
This adds a database field for user_defined_fields to SourcePackageRe
Pre-implementation call: with bigjools
Tests:
./bin/test lp.soyuz.
Michael Nelson (michael.nelson) wrote : | # |
Hi Jelmer! Nice clean branch :)
> === modified file 'lib/lp/
> --- lib/lp/
> +++ lib/lp/
> @@ -125,10 +125,11 @@
>
> def createBinaryPac
> binarypackagename, version, summary, description, binpackageformat,
> - component, section, priority, shlibdeps, depends, recommends,
> - suggests, conflicts, replaces, provides, pre_depends, enhances,
> - breaks, essential, installedsize, architecturespe
> - debug_package):
> + component, section, priority, installedsize, architecturespe
> + shlibdeps=None, depends=None, recommends=None, suggests=None,
> + conflicts=None, replaces=None, provides=None, pre_depends=None,
> + enhances=None, breaks=None, essential=False, debug_package=None,
> + user_defined_
I'm assuming you've checked that all call-sites use kwargs before re-ordering... and my next question was going to be are you sure that all those kwargs are really optional, but your test_provides() ensures that too :)
> """Create and return a `BinaryPackageR
>
> The binarypackagere
>
> === modified file 'lib/lp/
> --- lib/lp/
> +++ lib/lp/
> @@ -56,6 +56,8 @@
> title=_("Debug package"), schema=Interface, required=False,
> description=_("The corresponding package containing debug symbols "
> "for this binary."))
> + user_defined_fields = Attribute(
> + "Sequence of user-defined fields as key-value pairs.")
you could use zope.schema.List instead of attribute:
user_
if that's what it is.
>
> files = Attribute("Related list of IBinaryPackageFile entries")
>
>
> === modified file 'lib/lp/
> --- lib/lp/
> +++ lib/lp/
> @@ -96,8 +96,8 @@
> "was first uploaded in Launchpad")
> publishings = Attribute(
>
> -
> -
> + user_defined_fields = Attribute(
> + "Sequence of user-defined fields as key-value pairs.")
Same here.
> # read-only properties
> name = Attribute('The sourcepackagename for this release, as text')
> title = Attribute('The title of this sourcepackagere
>
> === modified file 'lib/lp/
> --- lib/lp/
> +++ lib/lp/
> @@ -13,6...
Preview Diff
1 | === modified file 'database/schema/comments.sql' |
2 | --- database/schema/comments.sql 2010-08-10 05:50:08 +0000 |
3 | +++ database/schema/comments.sql 2010-08-12 19:10:59 +0000 |
4 | @@ -1338,6 +1338,7 @@ |
5 | COMMENT ON COLUMN SourcePackageRelease.build_conflicts IS 'The list of packages that will conflict with this source while building, as mentioned in the control file "Build-Conflicts:" field.'; |
6 | COMMENT ON COLUMN SourcePackageRelease.build_conflicts_indep IS 'The list of packages that will conflict with this source while building in architecture independent environment, as mentioned in the control file "Build-Conflicts-Indep:" field.'; |
7 | COMMENT ON COLUMN SourcePackageRelease.changelog IS 'The LibraryFileAlias ID of changelog associated with this sourcepackage. Often in the case of debian packages and will be found after the installation in /usr/share/doc/<binarypackagename>/changelog.Debian.gz'; |
8 | +COMMENT ON COLUMN SourcePackageRelease.user_defined_fields IS 'A JSON struct containing a sequence of key-value pairs with user defined fields in the control file.'; |
9 | |
10 | -- SourcePackageName |
11 | |
12 | @@ -1478,6 +1479,7 @@ |
13 | COMMENT ON COLUMN BinaryPackageRelease.enhances IS 'The list of packages pointed as "enhanced" after the installation of this package, as it is in control file "Enhances:" field.'; |
14 | COMMENT ON COLUMN BinaryPackageRelease.breaks IS 'The list of packages which will be broken by the installtion of this package, as it is in the control file "Breaks:" field.'; |
15 | COMMENT ON COLUMN BinaryPackageRelease.debug_package IS 'The corresponding binary package release containing debug symbols for this binary, if any.'; |
16 | +COMMENT ON COLUMN BinaryPackageRelease.user_defined_fields IS 'A JSON struct containing a sequence of key-value pairs with user defined fields in the control file.'; |
17 | |
18 | |
19 | -- BinaryPackageFile |
20 | |
21 | === added file 'database/schema/patch-2207-82-0.sql' |
22 | --- database/schema/patch-2207-82-0.sql 1970-01-01 00:00:00 +0000 |
23 | +++ database/schema/patch-2207-82-0.sql 2010-08-12 19:10:59 +0000 |
24 | @@ -0,0 +1,11 @@ |
25 | +-- Copyright 2010 Canonical Ltd. This software is licensed under the |
26 | +-- GNU Affero General Public License version 3 (see the file LICENSE). |
27 | +SET client_min_messages=ERROR; |
28 | + |
29 | +ALTER TABLE BinaryPackageRelease |
30 | + ADD COLUMN user_defined_fields TEXT; |
31 | + |
32 | +ALTER TABLE SourcePackageRelease |
33 | + ADD COLUMN user_defined_fields TEXT; |
34 | + |
35 | +INSERT INTO LaunchpadDatabaseRevision VALUES (2207, 82, 0); |
36 | |
37 | === modified file 'lib/lp/registry/interfaces/distroseries.py' |
38 | --- lib/lp/registry/interfaces/distroseries.py 2010-08-05 00:25:36 +0000 |
39 | +++ lib/lp/registry/interfaces/distroseries.py 2010-08-12 19:10:59 +0000 |
40 | @@ -572,7 +572,7 @@ |
41 | dsc_maintainer_rfc822, dsc_standards_version, dsc_format, |
42 | dsc_binaries, archive, copyright, build_conflicts, |
43 | build_conflicts_indep, dateuploaded=None, |
44 | - source_package_recipe_build=None): |
45 | + source_package_recipe_build=None, user_defined_fields=None): |
46 | """Create an uploads `SourcePackageRelease`. |
47 | |
48 | Set this distroseries set to be the uploadeddistroseries. |
49 | @@ -608,6 +608,8 @@ |
50 | :param archive: IArchive to where the upload was targeted |
51 | :param dateuploaded: optional datetime, if omitted assumed nowUTC |
52 | :param source_package_recipe_build: optional SourcePackageRecipeBuild |
53 | + :param user_defined_fields: optional sequence of key-value pairs with |
54 | + user defined fields. |
55 | :return: the just creates `SourcePackageRelease` |
56 | """ |
57 | |
58 | |
59 | === modified file 'lib/lp/registry/model/distroseries.py' |
60 | --- lib/lp/registry/model/distroseries.py 2010-08-10 21:54:41 +0000 |
61 | +++ lib/lp/registry/model/distroseries.py 2010-08-12 19:10:59 +0000 |
62 | @@ -1128,7 +1128,7 @@ |
63 | dsc_maintainer_rfc822, dsc_standards_version, dsc_format, |
64 | dsc_binaries, archive, copyright, build_conflicts, |
65 | build_conflicts_indep, dateuploaded=DEFAULT, |
66 | - source_package_recipe_build=None): |
67 | + source_package_recipe_build=None, user_defined_fields=None): |
68 | """See `IDistroSeries`.""" |
69 | return SourcePackageRelease( |
70 | upload_distroseries=self, sourcepackagename=sourcepackagename, |
71 | @@ -1144,7 +1144,8 @@ |
72 | dsc_format=dsc_format, dsc_binaries=dsc_binaries, |
73 | build_conflicts=build_conflicts, |
74 | build_conflicts_indep=build_conflicts_indep, |
75 | - source_package_recipe_build=source_package_recipe_build) |
76 | + source_package_recipe_build=source_package_recipe_build, |
77 | + user_defined_fields=user_defined_fields) |
78 | |
79 | def getComponentByName(self, name): |
80 | """See `IDistroSeries`.""" |
81 | |
82 | === modified file 'lib/lp/soyuz/doc/binarypackagebuild.txt' |
83 | --- lib/lp/soyuz/doc/binarypackagebuild.txt 2010-08-10 21:54:41 +0000 |
84 | +++ lib/lp/soyuz/doc/binarypackagebuild.txt 2010-08-12 19:10:59 +0000 |
85 | @@ -310,20 +310,8 @@ |
86 | >>> section = firefox_build.source_package_release.section.id |
87 | >>> from canonical.launchpad.interfaces import PackagePublishingPriority |
88 | >>> priority = PackagePublishingPriority.STANDARD |
89 | - >>> shlibdeps = None |
90 | - >>> depends = None |
91 | - >>> recommends = None |
92 | - >>> suggests = None |
93 | - >>> conflicts = None |
94 | - >>> replaces = None |
95 | - >>> provides = None |
96 | - >>> essential = False |
97 | >>> installedsize = 0 |
98 | >>> architecturespecific = False |
99 | - >>> pre_depends = None |
100 | - >>> enhances = None |
101 | - >>> breaks = None |
102 | - >>> debug_package = None |
103 | |
104 | Invoke createBinaryPackageRelease with all required arguments. |
105 | |
106 | @@ -331,11 +319,11 @@ |
107 | >>> pmount_build = getUtility(IBinaryPackageBuildSet).getByBuildID(19) |
108 | |
109 | >>> bin = pmount_build.createBinaryPackageRelease( |
110 | - ... binarypackagename, version, summary, description, |
111 | - ... binpackageformat, component, section, priority, shlibdeps, |
112 | - ... depends, recommends, suggests, conflicts, replaces, provides, |
113 | - ... pre_depends, enhances, breaks, essential, installedsize, |
114 | - ... architecturespecific, debug_package) |
115 | + ... binarypackagename=binarypackagename, version=version, |
116 | + ... summary=summary, description=description, |
117 | + ... binpackageformat=binpackageformat, component=component, |
118 | + ... section=section, priority=priority, installedsize=installedsize, |
119 | + ... architecturespecific=architecturespecific) |
120 | |
121 | >>> from canonical.launchpad.interfaces import IBinaryPackageRelease |
122 | >>> from canonical.launchpad.webapp.testing import verifyObject |
123 | @@ -364,11 +352,12 @@ |
124 | ... version = "%d" % i |
125 | ... binarypackagename = bpnameset.ensure("test-%d" % i).id |
126 | ... b = pmount_build.createBinaryPackageRelease( |
127 | - ... binarypackagename, version, summary, description, |
128 | - ... binpackageformat, component, section, priority, shlibdeps, |
129 | - ... depends, recommends, suggests, conflicts, replaces, provides, |
130 | - ... pre_depends, enhances, breaks, essential, installedsize, |
131 | - ... architecturespecific, debug_package) |
132 | + ... binarypackagename=binarypackagename, version=version, |
133 | + ... summary=summary, description=description, |
134 | + ... binpackageformat=binpackageformat, component=component, |
135 | + ... section=section, priority=priority, |
136 | + ... installedsize=installedsize, |
137 | + ... architecturespecific=architecturespecific) |
138 | |
139 | |
140 | Check if the property is still working: |
141 | |
142 | === modified file 'lib/lp/soyuz/interfaces/binarypackagebuild.py' |
143 | --- lib/lp/soyuz/interfaces/binarypackagebuild.py 2010-08-10 21:54:41 +0000 |
144 | +++ lib/lp/soyuz/interfaces/binarypackagebuild.py 2010-08-12 19:10:59 +0000 |
145 | @@ -125,10 +125,11 @@ |
146 | |
147 | def createBinaryPackageRelease( |
148 | binarypackagename, version, summary, description, binpackageformat, |
149 | - component, section, priority, shlibdeps, depends, recommends, |
150 | - suggests, conflicts, replaces, provides, pre_depends, enhances, |
151 | - breaks, essential, installedsize, architecturespecific, |
152 | - debug_package): |
153 | + component, section, priority, installedsize, architecturespecific, |
154 | + shlibdeps=None, depends=None, recommends=None, suggests=None, |
155 | + conflicts=None, replaces=None, provides=None, pre_depends=None, |
156 | + enhances=None, breaks=None, essential=False, debug_package=None, |
157 | + user_defined_fields=None): |
158 | """Create and return a `BinaryPackageRelease`. |
159 | |
160 | The binarypackagerelease will be attached to this specific build. |
161 | |
162 | === modified file 'lib/lp/soyuz/interfaces/binarypackagerelease.py' |
163 | --- lib/lp/soyuz/interfaces/binarypackagerelease.py 2010-07-10 04:52:43 +0000 |
164 | +++ lib/lp/soyuz/interfaces/binarypackagerelease.py 2010-08-12 19:10:59 +0000 |
165 | @@ -18,7 +18,7 @@ |
166 | from lazr.enum import DBEnumeratedType, DBItem |
167 | from lazr.restful.declarations import exported, export_as_webservice_entry |
168 | from lazr.restful.fields import Reference, ReferenceChoice |
169 | -from zope.schema import Bool, Date, Datetime, Int, Object, Text, TextLine |
170 | +from zope.schema import Bool, Date, Datetime, Int, List, Object, Text, TextLine |
171 | from zope.interface import Interface, Attribute |
172 | |
173 | from canonical.launchpad import _ |
174 | @@ -56,6 +56,8 @@ |
175 | title=_("Debug package"), schema=Interface, required=False, |
176 | description=_("The corresponding package containing debug symbols " |
177 | "for this binary.")) |
178 | + user_defined_fields = List( |
179 | + title=_("Sequence of user-defined fields as key-value pairs.")) |
180 | |
181 | files = Attribute("Related list of IBinaryPackageFile entries") |
182 | |
183 | |
184 | === modified file 'lib/lp/soyuz/interfaces/sourcepackagerelease.py' |
185 | --- lib/lp/soyuz/interfaces/sourcepackagerelease.py 2010-07-29 22:55:15 +0000 |
186 | +++ lib/lp/soyuz/interfaces/sourcepackagerelease.py 2010-08-12 19:10:59 +0000 |
187 | @@ -14,7 +14,7 @@ |
188 | |
189 | |
190 | from lazr.restful.fields import Reference |
191 | -from zope.schema import TextLine |
192 | +from zope.schema import List, TextLine |
193 | from zope.interface import Interface, Attribute |
194 | |
195 | from canonical.launchpad import _ |
196 | @@ -96,8 +96,8 @@ |
197 | "was first uploaded in Launchpad") |
198 | publishings = Attribute("MultipleJoin on SourcepackagePublishing") |
199 | |
200 | - |
201 | - |
202 | + user_defined_fields = List( |
203 | + title=_("Sequence of user-defined fields as key-value pairs.")) |
204 | # read-only properties |
205 | name = Attribute('The sourcepackagename for this release, as text') |
206 | title = Attribute('The title of this sourcepackagerelease') |
207 | |
208 | === modified file 'lib/lp/soyuz/model/binarypackagebuild.py' |
209 | --- lib/lp/soyuz/model/binarypackagebuild.py 2010-08-10 21:54:41 +0000 |
210 | +++ lib/lp/soyuz/model/binarypackagebuild.py 2010-08-12 19:10:59 +0000 |
211 | @@ -448,10 +448,11 @@ |
212 | |
213 | def createBinaryPackageRelease( |
214 | self, binarypackagename, version, summary, description, |
215 | - binpackageformat, component,section, priority, shlibdeps, |
216 | - depends, recommends, suggests, conflicts, replaces, provides, |
217 | - pre_depends, enhances, breaks, essential, installedsize, |
218 | - architecturespecific, debug_package): |
219 | + binpackageformat, component, section, priority, installedsize, |
220 | + architecturespecific, shlibdeps=None, depends=None, recommends=None, |
221 | + suggests=None, conflicts=None, replaces=None, provides=None, |
222 | + pre_depends=None, enhances=None, breaks=None, essential=False, |
223 | + debug_package=None, user_defined_fields=None): |
224 | """See IBuild.""" |
225 | return BinaryPackageRelease( |
226 | build=self, binarypackagename=binarypackagename, version=version, |
227 | @@ -463,7 +464,8 @@ |
228 | provides=provides, pre_depends=pre_depends, enhances=enhances, |
229 | breaks=breaks, essential=essential, installedsize=installedsize, |
230 | architecturespecific=architecturespecific, |
231 | - debug_package=debug_package) |
232 | + debug_package=debug_package, |
233 | + user_defined_fields=user_defined_fields) |
234 | |
235 | def estimateDuration(self): |
236 | """See `IBuildBase`.""" |
237 | |
238 | === modified file 'lib/lp/soyuz/model/binarypackagerelease.py' |
239 | --- lib/lp/soyuz/model/binarypackagerelease.py 2010-07-10 04:46:49 +0000 |
240 | +++ lib/lp/soyuz/model/binarypackagerelease.py 2010-08-12 19:10:59 +0000 |
241 | @@ -13,6 +13,8 @@ |
242 | |
243 | from zope.interface import implements |
244 | |
245 | +import simplejson |
246 | + |
247 | from sqlobject import StringCol, ForeignKey, IntCol, SQLMultipleJoin, BoolCol |
248 | from storm.locals import Date, Int, Reference, Storm |
249 | |
250 | @@ -68,6 +70,22 @@ |
251 | files = SQLMultipleJoin('BinaryPackageFile', |
252 | joinColumn='binarypackagerelease', orderBy="libraryfile") |
253 | |
254 | + _user_defined_fields = StringCol(dbName='user_defined_fields') |
255 | + |
256 | + def __init__(self, *args, **kwargs): |
257 | + if 'user_defined_fields' in kwargs: |
258 | + kwargs['_user_defined_fields'] = simplejson.dumps( |
259 | + kwargs['user_defined_fields']) |
260 | + del kwargs['user_defined_fields'] |
261 | + super(BinaryPackageRelease, self).__init__(*args, **kwargs) |
262 | + |
263 | + @property |
264 | + def user_defined_fields(self): |
265 | + """See `IBinaryPackageRelease`.""" |
266 | + if self._user_defined_fields is None: |
267 | + return [] |
268 | + return simplejson.loads(self._user_defined_fields) |
269 | + |
270 | @property |
271 | def title(self): |
272 | """See `IBinaryPackageRelease`.""" |
273 | |
274 | === modified file 'lib/lp/soyuz/model/sourcepackagerelease.py' |
275 | --- lib/lp/soyuz/model/sourcepackagerelease.py 2010-08-02 02:13:52 +0000 |
276 | +++ lib/lp/soyuz/model/sourcepackagerelease.py 2010-08-12 19:10:59 +0000 |
277 | @@ -15,6 +15,7 @@ |
278 | import pytz |
279 | from StringIO import StringIO |
280 | import re |
281 | +import simplejson |
282 | |
283 | from sqlobject import StringCol, ForeignKey, SQLMultipleJoin |
284 | from storm.expr import Join |
285 | @@ -147,6 +148,22 @@ |
286 | package_diffs = SQLMultipleJoin( |
287 | 'PackageDiff', joinColumn='to_source', orderBy="-date_requested") |
288 | |
289 | + _user_defined_fields = StringCol(dbName='user_defined_fields') |
290 | + |
291 | + def __init__(self, *args, **kwargs): |
292 | + if 'user_defined_fields' in kwargs: |
293 | + kwargs['_user_defined_fields'] = simplejson.dumps( |
294 | + kwargs['user_defined_fields']) |
295 | + del kwargs['user_defined_fields'] |
296 | + super(SourcePackageRelease, self).__init__(*args, **kwargs) |
297 | + |
298 | + @property |
299 | + def user_defined_fields(self): |
300 | + """See `IBinaryPackageRelease`.""" |
301 | + if self._user_defined_fields is None: |
302 | + return [] |
303 | + return simplejson.loads(self._user_defined_fields) |
304 | + |
305 | @property |
306 | def builds(self): |
307 | """See `ISourcePackageRelease`.""" |
308 | |
309 | === added file 'lib/lp/soyuz/tests/test_binarypackagerelease.py' |
310 | --- lib/lp/soyuz/tests/test_binarypackagerelease.py 1970-01-01 00:00:00 +0000 |
311 | +++ lib/lp/soyuz/tests/test_binarypackagerelease.py 2010-08-12 19:10:59 +0000 |
312 | @@ -0,0 +1,51 @@ |
313 | +# Copyright 2010 Canonical Ltd. This software is licensed under the |
314 | +# GNU Affero General Public License version 3 (see the file LICENSE). |
315 | + |
316 | +"""Test BinaryPackageRelease.""" |
317 | + |
318 | +__metaclass__ = type |
319 | + |
320 | +from canonical.testing import LaunchpadFunctionalLayer |
321 | + |
322 | +from lp.soyuz.interfaces.binarypackagerelease import ( |
323 | + IBinaryPackageRelease, BinaryPackageFormat) |
324 | +from lp.soyuz.interfaces.publishing import PackagePublishingPriority |
325 | + |
326 | +from lp.testing import TestCaseWithFactory |
327 | + |
328 | + |
329 | +class TestBinaryPackageRelease(TestCaseWithFactory): |
330 | + """Tests for BinaryPackageRelease.""" |
331 | + |
332 | + layer = LaunchpadFunctionalLayer |
333 | + |
334 | + def test_provides(self): |
335 | + build = self.factory.makeBinaryPackageBuild() |
336 | + release = build.createBinaryPackageRelease( |
337 | + binarypackagename=self.factory.makeBinaryPackageName(), |
338 | + version="0.1", summary="My package", |
339 | + description="My description", |
340 | + binpackageformat=BinaryPackageFormat.DEB, |
341 | + component=self.factory.makeComponent("main"), |
342 | + section=self.factory.makeSection("net"), |
343 | + priority=PackagePublishingPriority.OPTIONAL, |
344 | + installedsize=0, architecturespecific=False) |
345 | + self.assertProvides(release, IBinaryPackageRelease) |
346 | + |
347 | + def test_user_defined_fields(self): |
348 | + build = self.factory.makeBinaryPackageBuild() |
349 | + release = build.createBinaryPackageRelease( |
350 | + binarypackagename=self.factory.makeBinaryPackageName(), |
351 | + version="0.1", summary="My package", |
352 | + description="My description", |
353 | + binpackageformat=BinaryPackageFormat.DEB, |
354 | + component=self.factory.makeComponent("main"), |
355 | + section=self.factory.makeSection("net"), |
356 | + priority=PackagePublishingPriority.OPTIONAL, |
357 | + installedsize=0, architecturespecific=False, |
358 | + user_defined_fields=[ |
359 | + ("Python-Version", ">= 2.4"), |
360 | + ("Other", "Bla")]) |
361 | + self.assertEquals([ |
362 | + ["Python-Version", ">= 2.4"], |
363 | + ["Other", "Bla"]], release.user_defined_fields) |
364 | |
365 | === modified file 'lib/lp/soyuz/tests/test_sourcepackagerelease.py' |
366 | --- lib/lp/soyuz/tests/test_sourcepackagerelease.py 2010-07-29 23:09:34 +0000 |
367 | +++ lib/lp/soyuz/tests/test_sourcepackagerelease.py 2010-08-12 19:10:59 +0000 |
368 | @@ -30,3 +30,12 @@ |
369 | spr = self.factory.makeSourcePackageRelease( |
370 | source_package_recipe_build=recipe_build) |
371 | self.assertEqual(recipe_build.requester, spr.uploader) |
372 | + |
373 | + def test_user_defined_fields(self): |
374 | + release = self.factory.makeSourcePackageRelease( |
375 | + user_defined_fields=[ |
376 | + ("Python-Version", ">= 2.4"), |
377 | + ("Other", "Bla")]) |
378 | + self.assertEquals([ |
379 | + ["Python-Version", ">= 2.4"], |
380 | + ["Other", "Bla"]], release.user_defined_fields) |
381 | |
382 | === modified file 'lib/lp/testing/factory.py' |
383 | --- lib/lp/testing/factory.py 2010-08-06 10:48:49 +0000 |
384 | +++ lib/lp/testing/factory.py 2010-08-12 19:10:59 +0000 |
385 | @@ -2289,7 +2289,8 @@ |
386 | dsc_format='1.0', dsc_binaries='foo-bin', |
387 | date_uploaded=UTC_NOW, |
388 | source_package_recipe_build=None, |
389 | - dscsigningkey=None): |
390 | + dscsigningkey=None, |
391 | + user_defined_fields=None): |
392 | """Make a `SourcePackageRelease`.""" |
393 | if distroseries is None: |
394 | if source_package_recipe_build is not None: |
395 | @@ -2355,7 +2356,8 @@ |
396 | dsc_binaries=dsc_binaries, |
397 | archive=archive, |
398 | dateuploaded=date_uploaded, |
399 | - source_package_recipe_build=source_package_recipe_build) |
400 | + source_package_recipe_build=source_package_recipe_build, |
401 | + user_defined_fields=user_defined_fields) |
402 | |
403 | def makeSourcePackageReleaseFile(self, sourcepackagerelease=None, |
404 | library_file=None, filetype=None): |
Fine, but needs comments on the new columns in comments.sql
patch-2207-82-0.sql