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 | 1338 | 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.'; | 1338 | 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 | 1339 | 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.'; | 1339 | 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 | 1340 | 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'; | 1340 | 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 | 1341 | 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 | 1341 | 1342 | ||
10 | 1342 | -- SourcePackageName | 1343 | -- SourcePackageName |
11 | 1343 | 1344 | ||
12 | @@ -1478,6 +1479,7 @@ | |||
13 | 1478 | 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.'; | 1479 | 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 | 1479 | 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.'; | 1480 | 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 | 1480 | COMMENT ON COLUMN BinaryPackageRelease.debug_package IS 'The corresponding binary package release containing debug symbols for this binary, if any.'; | 1481 | COMMENT ON COLUMN BinaryPackageRelease.debug_package IS 'The corresponding binary package release containing debug symbols for this binary, if any.'; |
16 | 1482 | 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 | 1481 | 1483 | ||
18 | 1482 | 1484 | ||
19 | 1483 | -- BinaryPackageFile | 1485 | -- BinaryPackageFile |
20 | 1484 | 1486 | ||
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 | 1 | -- Copyright 2010 Canonical Ltd. This software is licensed under the | ||
26 | 2 | -- GNU Affero General Public License version 3 (see the file LICENSE). | ||
27 | 3 | SET client_min_messages=ERROR; | ||
28 | 4 | |||
29 | 5 | ALTER TABLE BinaryPackageRelease | ||
30 | 6 | ADD COLUMN user_defined_fields TEXT; | ||
31 | 7 | |||
32 | 8 | ALTER TABLE SourcePackageRelease | ||
33 | 9 | ADD COLUMN user_defined_fields TEXT; | ||
34 | 10 | |||
35 | 11 | INSERT INTO LaunchpadDatabaseRevision VALUES (2207, 82, 0); | ||
36 | 0 | 12 | ||
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 | 572 | dsc_maintainer_rfc822, dsc_standards_version, dsc_format, | 572 | dsc_maintainer_rfc822, dsc_standards_version, dsc_format, |
42 | 573 | dsc_binaries, archive, copyright, build_conflicts, | 573 | dsc_binaries, archive, copyright, build_conflicts, |
43 | 574 | build_conflicts_indep, dateuploaded=None, | 574 | build_conflicts_indep, dateuploaded=None, |
45 | 575 | source_package_recipe_build=None): | 575 | source_package_recipe_build=None, user_defined_fields=None): |
46 | 576 | """Create an uploads `SourcePackageRelease`. | 576 | """Create an uploads `SourcePackageRelease`. |
47 | 577 | 577 | ||
48 | 578 | Set this distroseries set to be the uploadeddistroseries. | 578 | Set this distroseries set to be the uploadeddistroseries. |
49 | @@ -608,6 +608,8 @@ | |||
50 | 608 | :param archive: IArchive to where the upload was targeted | 608 | :param archive: IArchive to where the upload was targeted |
51 | 609 | :param dateuploaded: optional datetime, if omitted assumed nowUTC | 609 | :param dateuploaded: optional datetime, if omitted assumed nowUTC |
52 | 610 | :param source_package_recipe_build: optional SourcePackageRecipeBuild | 610 | :param source_package_recipe_build: optional SourcePackageRecipeBuild |
53 | 611 | :param user_defined_fields: optional sequence of key-value pairs with | ||
54 | 612 | user defined fields. | ||
55 | 611 | :return: the just creates `SourcePackageRelease` | 613 | :return: the just creates `SourcePackageRelease` |
56 | 612 | """ | 614 | """ |
57 | 613 | 615 | ||
58 | 614 | 616 | ||
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 | 1128 | dsc_maintainer_rfc822, dsc_standards_version, dsc_format, | 1128 | dsc_maintainer_rfc822, dsc_standards_version, dsc_format, |
64 | 1129 | dsc_binaries, archive, copyright, build_conflicts, | 1129 | dsc_binaries, archive, copyright, build_conflicts, |
65 | 1130 | build_conflicts_indep, dateuploaded=DEFAULT, | 1130 | build_conflicts_indep, dateuploaded=DEFAULT, |
67 | 1131 | source_package_recipe_build=None): | 1131 | source_package_recipe_build=None, user_defined_fields=None): |
68 | 1132 | """See `IDistroSeries`.""" | 1132 | """See `IDistroSeries`.""" |
69 | 1133 | return SourcePackageRelease( | 1133 | return SourcePackageRelease( |
70 | 1134 | upload_distroseries=self, sourcepackagename=sourcepackagename, | 1134 | upload_distroseries=self, sourcepackagename=sourcepackagename, |
71 | @@ -1144,7 +1144,8 @@ | |||
72 | 1144 | dsc_format=dsc_format, dsc_binaries=dsc_binaries, | 1144 | dsc_format=dsc_format, dsc_binaries=dsc_binaries, |
73 | 1145 | build_conflicts=build_conflicts, | 1145 | build_conflicts=build_conflicts, |
74 | 1146 | build_conflicts_indep=build_conflicts_indep, | 1146 | build_conflicts_indep=build_conflicts_indep, |
76 | 1147 | source_package_recipe_build=source_package_recipe_build) | 1147 | source_package_recipe_build=source_package_recipe_build, |
77 | 1148 | user_defined_fields=user_defined_fields) | ||
78 | 1148 | 1149 | ||
79 | 1149 | def getComponentByName(self, name): | 1150 | def getComponentByName(self, name): |
80 | 1150 | """See `IDistroSeries`.""" | 1151 | """See `IDistroSeries`.""" |
81 | 1151 | 1152 | ||
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 | 310 | >>> section = firefox_build.source_package_release.section.id | 310 | >>> section = firefox_build.source_package_release.section.id |
87 | 311 | >>> from canonical.launchpad.interfaces import PackagePublishingPriority | 311 | >>> from canonical.launchpad.interfaces import PackagePublishingPriority |
88 | 312 | >>> priority = PackagePublishingPriority.STANDARD | 312 | >>> priority = PackagePublishingPriority.STANDARD |
89 | 313 | >>> shlibdeps = None | ||
90 | 314 | >>> depends = None | ||
91 | 315 | >>> recommends = None | ||
92 | 316 | >>> suggests = None | ||
93 | 317 | >>> conflicts = None | ||
94 | 318 | >>> replaces = None | ||
95 | 319 | >>> provides = None | ||
96 | 320 | >>> essential = False | ||
97 | 321 | >>> installedsize = 0 | 313 | >>> installedsize = 0 |
98 | 322 | >>> architecturespecific = False | 314 | >>> architecturespecific = False |
99 | 323 | >>> pre_depends = None | ||
100 | 324 | >>> enhances = None | ||
101 | 325 | >>> breaks = None | ||
102 | 326 | >>> debug_package = None | ||
103 | 327 | 315 | ||
104 | 328 | Invoke createBinaryPackageRelease with all required arguments. | 316 | Invoke createBinaryPackageRelease with all required arguments. |
105 | 329 | 317 | ||
106 | @@ -331,11 +319,11 @@ | |||
107 | 331 | >>> pmount_build = getUtility(IBinaryPackageBuildSet).getByBuildID(19) | 319 | >>> pmount_build = getUtility(IBinaryPackageBuildSet).getByBuildID(19) |
108 | 332 | 320 | ||
109 | 333 | >>> bin = pmount_build.createBinaryPackageRelease( | 321 | >>> bin = pmount_build.createBinaryPackageRelease( |
115 | 334 | ... binarypackagename, version, summary, description, | 322 | ... binarypackagename=binarypackagename, version=version, |
116 | 335 | ... binpackageformat, component, section, priority, shlibdeps, | 323 | ... summary=summary, description=description, |
117 | 336 | ... depends, recommends, suggests, conflicts, replaces, provides, | 324 | ... binpackageformat=binpackageformat, component=component, |
118 | 337 | ... pre_depends, enhances, breaks, essential, installedsize, | 325 | ... section=section, priority=priority, installedsize=installedsize, |
119 | 338 | ... architecturespecific, debug_package) | 326 | ... architecturespecific=architecturespecific) |
120 | 339 | 327 | ||
121 | 340 | >>> from canonical.launchpad.interfaces import IBinaryPackageRelease | 328 | >>> from canonical.launchpad.interfaces import IBinaryPackageRelease |
122 | 341 | >>> from canonical.launchpad.webapp.testing import verifyObject | 329 | >>> from canonical.launchpad.webapp.testing import verifyObject |
123 | @@ -364,11 +352,12 @@ | |||
124 | 364 | ... version = "%d" % i | 352 | ... version = "%d" % i |
125 | 365 | ... binarypackagename = bpnameset.ensure("test-%d" % i).id | 353 | ... binarypackagename = bpnameset.ensure("test-%d" % i).id |
126 | 366 | ... b = pmount_build.createBinaryPackageRelease( | 354 | ... b = pmount_build.createBinaryPackageRelease( |
132 | 367 | ... binarypackagename, version, summary, description, | 355 | ... binarypackagename=binarypackagename, version=version, |
133 | 368 | ... binpackageformat, component, section, priority, shlibdeps, | 356 | ... summary=summary, description=description, |
134 | 369 | ... depends, recommends, suggests, conflicts, replaces, provides, | 357 | ... binpackageformat=binpackageformat, component=component, |
135 | 370 | ... pre_depends, enhances, breaks, essential, installedsize, | 358 | ... section=section, priority=priority, |
136 | 371 | ... architecturespecific, debug_package) | 359 | ... installedsize=installedsize, |
137 | 360 | ... architecturespecific=architecturespecific) | ||
138 | 372 | 361 | ||
139 | 373 | 362 | ||
140 | 374 | Check if the property is still working: | 363 | Check if the property is still working: |
141 | 375 | 364 | ||
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 | 125 | 125 | ||
147 | 126 | def createBinaryPackageRelease( | 126 | def createBinaryPackageRelease( |
148 | 127 | binarypackagename, version, summary, description, binpackageformat, | 127 | binarypackagename, version, summary, description, binpackageformat, |
153 | 128 | component, section, priority, shlibdeps, depends, recommends, | 128 | component, section, priority, installedsize, architecturespecific, |
154 | 129 | suggests, conflicts, replaces, provides, pre_depends, enhances, | 129 | shlibdeps=None, depends=None, recommends=None, suggests=None, |
155 | 130 | breaks, essential, installedsize, architecturespecific, | 130 | conflicts=None, replaces=None, provides=None, pre_depends=None, |
156 | 131 | debug_package): | 131 | enhances=None, breaks=None, essential=False, debug_package=None, |
157 | 132 | user_defined_fields=None): | ||
158 | 132 | """Create and return a `BinaryPackageRelease`. | 133 | """Create and return a `BinaryPackageRelease`. |
159 | 133 | 134 | ||
160 | 134 | The binarypackagerelease will be attached to this specific build. | 135 | The binarypackagerelease will be attached to this specific build. |
161 | 135 | 136 | ||
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 | 18 | from lazr.enum import DBEnumeratedType, DBItem | 18 | from lazr.enum import DBEnumeratedType, DBItem |
167 | 19 | from lazr.restful.declarations import exported, export_as_webservice_entry | 19 | from lazr.restful.declarations import exported, export_as_webservice_entry |
168 | 20 | from lazr.restful.fields import Reference, ReferenceChoice | 20 | from lazr.restful.fields import Reference, ReferenceChoice |
170 | 21 | from zope.schema import Bool, Date, Datetime, Int, Object, Text, TextLine | 21 | from zope.schema import Bool, Date, Datetime, Int, List, Object, Text, TextLine |
171 | 22 | from zope.interface import Interface, Attribute | 22 | from zope.interface import Interface, Attribute |
172 | 23 | 23 | ||
173 | 24 | from canonical.launchpad import _ | 24 | from canonical.launchpad import _ |
174 | @@ -56,6 +56,8 @@ | |||
175 | 56 | title=_("Debug package"), schema=Interface, required=False, | 56 | title=_("Debug package"), schema=Interface, required=False, |
176 | 57 | description=_("The corresponding package containing debug symbols " | 57 | description=_("The corresponding package containing debug symbols " |
177 | 58 | "for this binary.")) | 58 | "for this binary.")) |
178 | 59 | user_defined_fields = List( | ||
179 | 60 | title=_("Sequence of user-defined fields as key-value pairs.")) | ||
180 | 59 | 61 | ||
181 | 60 | files = Attribute("Related list of IBinaryPackageFile entries") | 62 | files = Attribute("Related list of IBinaryPackageFile entries") |
182 | 61 | 63 | ||
183 | 62 | 64 | ||
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 | 14 | 14 | ||
189 | 15 | 15 | ||
190 | 16 | from lazr.restful.fields import Reference | 16 | from lazr.restful.fields import Reference |
192 | 17 | from zope.schema import TextLine | 17 | from zope.schema import List, TextLine |
193 | 18 | from zope.interface import Interface, Attribute | 18 | from zope.interface import Interface, Attribute |
194 | 19 | 19 | ||
195 | 20 | from canonical.launchpad import _ | 20 | from canonical.launchpad import _ |
196 | @@ -96,8 +96,8 @@ | |||
197 | 96 | "was first uploaded in Launchpad") | 96 | "was first uploaded in Launchpad") |
198 | 97 | publishings = Attribute("MultipleJoin on SourcepackagePublishing") | 97 | publishings = Attribute("MultipleJoin on SourcepackagePublishing") |
199 | 98 | 98 | ||
202 | 99 | 99 | user_defined_fields = List( | |
203 | 100 | 100 | title=_("Sequence of user-defined fields as key-value pairs.")) | |
204 | 101 | # read-only properties | 101 | # read-only properties |
205 | 102 | name = Attribute('The sourcepackagename for this release, as text') | 102 | name = Attribute('The sourcepackagename for this release, as text') |
206 | 103 | title = Attribute('The title of this sourcepackagerelease') | 103 | title = Attribute('The title of this sourcepackagerelease') |
207 | 104 | 104 | ||
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 | 448 | 448 | ||
213 | 449 | def createBinaryPackageRelease( | 449 | def createBinaryPackageRelease( |
214 | 450 | self, binarypackagename, version, summary, description, | 450 | self, binarypackagename, version, summary, description, |
219 | 451 | binpackageformat, component,section, priority, shlibdeps, | 451 | binpackageformat, component, section, priority, installedsize, |
220 | 452 | depends, recommends, suggests, conflicts, replaces, provides, | 452 | architecturespecific, shlibdeps=None, depends=None, recommends=None, |
221 | 453 | pre_depends, enhances, breaks, essential, installedsize, | 453 | suggests=None, conflicts=None, replaces=None, provides=None, |
222 | 454 | architecturespecific, debug_package): | 454 | pre_depends=None, enhances=None, breaks=None, essential=False, |
223 | 455 | debug_package=None, user_defined_fields=None): | ||
224 | 455 | """See IBuild.""" | 456 | """See IBuild.""" |
225 | 456 | return BinaryPackageRelease( | 457 | return BinaryPackageRelease( |
226 | 457 | build=self, binarypackagename=binarypackagename, version=version, | 458 | build=self, binarypackagename=binarypackagename, version=version, |
227 | @@ -463,7 +464,8 @@ | |||
228 | 463 | provides=provides, pre_depends=pre_depends, enhances=enhances, | 464 | provides=provides, pre_depends=pre_depends, enhances=enhances, |
229 | 464 | breaks=breaks, essential=essential, installedsize=installedsize, | 465 | breaks=breaks, essential=essential, installedsize=installedsize, |
230 | 465 | architecturespecific=architecturespecific, | 466 | architecturespecific=architecturespecific, |
232 | 466 | debug_package=debug_package) | 467 | debug_package=debug_package, |
233 | 468 | user_defined_fields=user_defined_fields) | ||
234 | 467 | 469 | ||
235 | 468 | def estimateDuration(self): | 470 | def estimateDuration(self): |
236 | 469 | """See `IBuildBase`.""" | 471 | """See `IBuildBase`.""" |
237 | 470 | 472 | ||
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 | 13 | 13 | ||
243 | 14 | from zope.interface import implements | 14 | from zope.interface import implements |
244 | 15 | 15 | ||
245 | 16 | import simplejson | ||
246 | 17 | |||
247 | 16 | from sqlobject import StringCol, ForeignKey, IntCol, SQLMultipleJoin, BoolCol | 18 | from sqlobject import StringCol, ForeignKey, IntCol, SQLMultipleJoin, BoolCol |
248 | 17 | from storm.locals import Date, Int, Reference, Storm | 19 | from storm.locals import Date, Int, Reference, Storm |
249 | 18 | 20 | ||
250 | @@ -68,6 +70,22 @@ | |||
251 | 68 | files = SQLMultipleJoin('BinaryPackageFile', | 70 | files = SQLMultipleJoin('BinaryPackageFile', |
252 | 69 | joinColumn='binarypackagerelease', orderBy="libraryfile") | 71 | joinColumn='binarypackagerelease', orderBy="libraryfile") |
253 | 70 | 72 | ||
254 | 73 | _user_defined_fields = StringCol(dbName='user_defined_fields') | ||
255 | 74 | |||
256 | 75 | def __init__(self, *args, **kwargs): | ||
257 | 76 | if 'user_defined_fields' in kwargs: | ||
258 | 77 | kwargs['_user_defined_fields'] = simplejson.dumps( | ||
259 | 78 | kwargs['user_defined_fields']) | ||
260 | 79 | del kwargs['user_defined_fields'] | ||
261 | 80 | super(BinaryPackageRelease, self).__init__(*args, **kwargs) | ||
262 | 81 | |||
263 | 82 | @property | ||
264 | 83 | def user_defined_fields(self): | ||
265 | 84 | """See `IBinaryPackageRelease`.""" | ||
266 | 85 | if self._user_defined_fields is None: | ||
267 | 86 | return [] | ||
268 | 87 | return simplejson.loads(self._user_defined_fields) | ||
269 | 88 | |||
270 | 71 | @property | 89 | @property |
271 | 72 | def title(self): | 90 | def title(self): |
272 | 73 | """See `IBinaryPackageRelease`.""" | 91 | """See `IBinaryPackageRelease`.""" |
273 | 74 | 92 | ||
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 | 15 | import pytz | 15 | import pytz |
279 | 16 | from StringIO import StringIO | 16 | from StringIO import StringIO |
280 | 17 | import re | 17 | import re |
281 | 18 | import simplejson | ||
282 | 18 | 19 | ||
283 | 19 | from sqlobject import StringCol, ForeignKey, SQLMultipleJoin | 20 | from sqlobject import StringCol, ForeignKey, SQLMultipleJoin |
284 | 20 | from storm.expr import Join | 21 | from storm.expr import Join |
285 | @@ -147,6 +148,22 @@ | |||
286 | 147 | package_diffs = SQLMultipleJoin( | 148 | package_diffs = SQLMultipleJoin( |
287 | 148 | 'PackageDiff', joinColumn='to_source', orderBy="-date_requested") | 149 | 'PackageDiff', joinColumn='to_source', orderBy="-date_requested") |
288 | 149 | 150 | ||
289 | 151 | _user_defined_fields = StringCol(dbName='user_defined_fields') | ||
290 | 152 | |||
291 | 153 | def __init__(self, *args, **kwargs): | ||
292 | 154 | if 'user_defined_fields' in kwargs: | ||
293 | 155 | kwargs['_user_defined_fields'] = simplejson.dumps( | ||
294 | 156 | kwargs['user_defined_fields']) | ||
295 | 157 | del kwargs['user_defined_fields'] | ||
296 | 158 | super(SourcePackageRelease, self).__init__(*args, **kwargs) | ||
297 | 159 | |||
298 | 160 | @property | ||
299 | 161 | def user_defined_fields(self): | ||
300 | 162 | """See `IBinaryPackageRelease`.""" | ||
301 | 163 | if self._user_defined_fields is None: | ||
302 | 164 | return [] | ||
303 | 165 | return simplejson.loads(self._user_defined_fields) | ||
304 | 166 | |||
305 | 150 | @property | 167 | @property |
306 | 151 | def builds(self): | 168 | def builds(self): |
307 | 152 | """See `ISourcePackageRelease`.""" | 169 | """See `ISourcePackageRelease`.""" |
308 | 153 | 170 | ||
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 | 1 | # Copyright 2010 Canonical Ltd. This software is licensed under the | ||
314 | 2 | # GNU Affero General Public License version 3 (see the file LICENSE). | ||
315 | 3 | |||
316 | 4 | """Test BinaryPackageRelease.""" | ||
317 | 5 | |||
318 | 6 | __metaclass__ = type | ||
319 | 7 | |||
320 | 8 | from canonical.testing import LaunchpadFunctionalLayer | ||
321 | 9 | |||
322 | 10 | from lp.soyuz.interfaces.binarypackagerelease import ( | ||
323 | 11 | IBinaryPackageRelease, BinaryPackageFormat) | ||
324 | 12 | from lp.soyuz.interfaces.publishing import PackagePublishingPriority | ||
325 | 13 | |||
326 | 14 | from lp.testing import TestCaseWithFactory | ||
327 | 15 | |||
328 | 16 | |||
329 | 17 | class TestBinaryPackageRelease(TestCaseWithFactory): | ||
330 | 18 | """Tests for BinaryPackageRelease.""" | ||
331 | 19 | |||
332 | 20 | layer = LaunchpadFunctionalLayer | ||
333 | 21 | |||
334 | 22 | def test_provides(self): | ||
335 | 23 | build = self.factory.makeBinaryPackageBuild() | ||
336 | 24 | release = build.createBinaryPackageRelease( | ||
337 | 25 | binarypackagename=self.factory.makeBinaryPackageName(), | ||
338 | 26 | version="0.1", summary="My package", | ||
339 | 27 | description="My description", | ||
340 | 28 | binpackageformat=BinaryPackageFormat.DEB, | ||
341 | 29 | component=self.factory.makeComponent("main"), | ||
342 | 30 | section=self.factory.makeSection("net"), | ||
343 | 31 | priority=PackagePublishingPriority.OPTIONAL, | ||
344 | 32 | installedsize=0, architecturespecific=False) | ||
345 | 33 | self.assertProvides(release, IBinaryPackageRelease) | ||
346 | 34 | |||
347 | 35 | def test_user_defined_fields(self): | ||
348 | 36 | build = self.factory.makeBinaryPackageBuild() | ||
349 | 37 | release = build.createBinaryPackageRelease( | ||
350 | 38 | binarypackagename=self.factory.makeBinaryPackageName(), | ||
351 | 39 | version="0.1", summary="My package", | ||
352 | 40 | description="My description", | ||
353 | 41 | binpackageformat=BinaryPackageFormat.DEB, | ||
354 | 42 | component=self.factory.makeComponent("main"), | ||
355 | 43 | section=self.factory.makeSection("net"), | ||
356 | 44 | priority=PackagePublishingPriority.OPTIONAL, | ||
357 | 45 | installedsize=0, architecturespecific=False, | ||
358 | 46 | user_defined_fields=[ | ||
359 | 47 | ("Python-Version", ">= 2.4"), | ||
360 | 48 | ("Other", "Bla")]) | ||
361 | 49 | self.assertEquals([ | ||
362 | 50 | ["Python-Version", ">= 2.4"], | ||
363 | 51 | ["Other", "Bla"]], release.user_defined_fields) | ||
364 | 0 | 52 | ||
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 | 30 | spr = self.factory.makeSourcePackageRelease( | 30 | spr = self.factory.makeSourcePackageRelease( |
370 | 31 | source_package_recipe_build=recipe_build) | 31 | source_package_recipe_build=recipe_build) |
371 | 32 | self.assertEqual(recipe_build.requester, spr.uploader) | 32 | self.assertEqual(recipe_build.requester, spr.uploader) |
372 | 33 | |||
373 | 34 | def test_user_defined_fields(self): | ||
374 | 35 | release = self.factory.makeSourcePackageRelease( | ||
375 | 36 | user_defined_fields=[ | ||
376 | 37 | ("Python-Version", ">= 2.4"), | ||
377 | 38 | ("Other", "Bla")]) | ||
378 | 39 | self.assertEquals([ | ||
379 | 40 | ["Python-Version", ">= 2.4"], | ||
380 | 41 | ["Other", "Bla"]], release.user_defined_fields) | ||
381 | 33 | 42 | ||
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 | 2289 | dsc_format='1.0', dsc_binaries='foo-bin', | 2289 | dsc_format='1.0', dsc_binaries='foo-bin', |
387 | 2290 | date_uploaded=UTC_NOW, | 2290 | date_uploaded=UTC_NOW, |
388 | 2291 | source_package_recipe_build=None, | 2291 | source_package_recipe_build=None, |
390 | 2292 | dscsigningkey=None): | 2292 | dscsigningkey=None, |
391 | 2293 | user_defined_fields=None): | ||
392 | 2293 | """Make a `SourcePackageRelease`.""" | 2294 | """Make a `SourcePackageRelease`.""" |
393 | 2294 | if distroseries is None: | 2295 | if distroseries is None: |
394 | 2295 | if source_package_recipe_build is not None: | 2296 | if source_package_recipe_build is not None: |
395 | @@ -2355,7 +2356,8 @@ | |||
396 | 2355 | dsc_binaries=dsc_binaries, | 2356 | dsc_binaries=dsc_binaries, |
397 | 2356 | archive=archive, | 2357 | archive=archive, |
398 | 2357 | dateuploaded=date_uploaded, | 2358 | dateuploaded=date_uploaded, |
400 | 2358 | source_package_recipe_build=source_package_recipe_build) | 2359 | source_package_recipe_build=source_package_recipe_build, |
401 | 2360 | user_defined_fields=user_defined_fields) | ||
402 | 2359 | 2361 | ||
403 | 2360 | def makeSourcePackageReleaseFile(self, sourcepackagerelease=None, | 2362 | def makeSourcePackageReleaseFile(self, sourcepackagerelease=None, |
404 | 2361 | library_file=None, filetype=None): | 2363 | library_file=None, filetype=None): |
Fine, but needs comments on the new columns in comments.sql
patch-2207-82-0.sql