launchpad-reviewers team mailing list archive
-
launchpad-reviewers team
-
Mailing list archive
-
Message #19961
[Merge] lp:~cjwatson/launchpad/build-depends-arch-user-defined into lp:launchpad
Colin Watson has proposed merging lp:~cjwatson/launchpad/build-depends-arch-user-defined into lp:launchpad.
Commit message:
Handle Build-Depends-Arch and Build-Conflicts-Arch from SPR.user_defined_fields in Sources generation and SP:+index.
Requested reviews:
Launchpad code reviewers (launchpad-reviewers)
Related bugs:
Bug #1489044 in Launchpad itself: "add Build-Depends-Arch support"
https://bugs.launchpad.net/launchpad/+bug/1489044
For more details, see:
https://code.launchpad.net/~cjwatson/launchpad/build-depends-arch-user-defined/+merge/285197
Handle Build-Depends-Arch and Build-Conflicts-Arch like their -Indep siblings.
This supersedes https://code.launchpad.net/~cjwatson/launchpad/db-build-depends-arch/+merge/282344 and https://code.launchpad.net/~cjwatson/launchpad/build-depends-arch/+merge/282345; rather than the approach taken there of adding new columns, this just special-cases entries in SPR.user_defined_fields if it finds them there.
--
Your team Launchpad code reviewers is requested to review the proposed merge of lp:~cjwatson/launchpad/build-depends-arch-user-defined into lp:launchpad.
=== modified file 'lib/lp/archivepublisher/indices.py'
--- lib/lp/archivepublisher/indices.py 2014-10-31 13:28:31 +0000
+++ lib/lp/archivepublisher/indices.py 2016-02-05 15:25:49 +0000
@@ -10,6 +10,7 @@
__metaclass__ = type
+from collections import OrderedDict
import hashlib
import os.path
import re
@@ -109,6 +110,9 @@
files_list.append((spf.libraryfile.content.md5, common))
sha1_list.append((spf.libraryfile.content.sha1, common))
sha256_list.append((spf.libraryfile.content.sha256, common))
+ user_defined_fields = OrderedDict([
+ (key.lower(), (key, value))
+ for key, value in spr.user_defined_fields])
# Filling stanza options.
fields = IndexStanzaFields()
fields.append('Package', spr.name)
@@ -118,8 +122,16 @@
fields.append('Maintainer', spr.dsc_maintainer_rfc822)
fields.append('Build-Depends', spr.builddepends)
fields.append('Build-Depends-Indep', spr.builddependsindep)
+ if 'build-depends-arch' in user_defined_fields:
+ fields.append(
+ 'Build-Depends-Arch',
+ user_defined_fields.pop('build-depends-arch')[1])
fields.append('Build-Conflicts', spr.build_conflicts)
fields.append('Build-Conflicts-Indep', spr.build_conflicts_indep)
+ if 'build-conflicts-arch' in user_defined_fields:
+ fields.append(
+ 'Build-Conflicts-Arch',
+ user_defined_fields.pop('build-conflicts-arch')[1])
fields.append('Architecture', spr.architecturehintlist)
fields.append('Standards-Version', spr.dsc_standards_version)
fields.append('Format', spr.dsc_format)
@@ -128,8 +140,7 @@
fields.append('Checksums-Sha1', format_file_list(sha1_list))
fields.append('Checksums-Sha256', format_file_list(sha256_list))
fields.append('Homepage', spr.homepage)
- if spr.user_defined_fields:
- fields.extend(spr.user_defined_fields)
+ fields.extend(user_defined_fields.values())
return fields
=== modified file 'lib/lp/archivepublisher/tests/test_indices.py'
--- lib/lp/archivepublisher/tests/test_indices.py 2014-10-31 13:05:52 +0000
+++ lib/lp/archivepublisher/tests/test_indices.py 2016-02-05 15:25:49 +0000
@@ -64,7 +64,10 @@
"""
pub_source = self.getPubSource(
builddepends='fooish', builddependsindep='pyfoo',
- build_conflicts='bar', build_conflicts_indep='pybar')
+ build_conflicts='bar', build_conflicts_indep='pybar',
+ user_defined_fields=[
+ ("Build-Depends-Arch", "libfoo-dev"),
+ ("Build-Conflicts-Arch", "libbar-dev")])
self.assertEqual(
[u'Package: foo',
@@ -74,8 +77,10 @@
u'Maintainer: Foo Bar <foo@xxxxxxx>',
u'Build-Depends: fooish',
u'Build-Depends-Indep: pyfoo',
+ u'Build-Depends-Arch: libfoo-dev',
u'Build-Conflicts: bar',
u'Build-Conflicts-Indep: pybar',
+ u'Build-Conflicts-Arch: libbar-dev',
u'Architecture: all',
u'Standards-Version: 3.6.2',
u'Format: 1.0',
@@ -102,7 +107,9 @@
build_conflicts='bar', build_conflicts_indep='pybar',
user_defined_fields=[
("Python-Version", "< 1.5"),
- ("CHECKSUMS-SHA1", "BLAH")])
+ ("CHECKSUMS-SHA1", "BLAH"),
+ ("Build-Depends-Arch", "libfoo-dev"),
+ ("Build-Conflicts-Arch", "libbar-dev")])
self.assertEqual(
[u'Package: foo',
@@ -112,8 +119,10 @@
u'Maintainer: Foo Bar <foo@xxxxxxx>',
u'Build-Depends: fooish',
u'Build-Depends-Indep: pyfoo',
+ u'Build-Depends-Arch: libfoo-dev',
u'Build-Conflicts: bar',
u'Build-Conflicts-Indep: pybar',
+ u'Build-Conflicts-Arch: libbar-dev',
u'Architecture: all',
u'Standards-Version: 3.6.2',
u'Format: 1.0',
=== modified file 'lib/lp/registry/browser/sourcepackage.py'
--- lib/lp/registry/browser/sourcepackage.py 2015-10-01 17:32:41 +0000
+++ lib/lp/registry/browser/sourcepackage.py 2016-02-05 15:25:49 +0000
@@ -520,6 +520,12 @@
self.context.currentrelease.builddependsindep)
@property
+ def builddependsarch(self):
+ return self._relationship_parser(
+ self.context.currentrelease.getUserDefinedField(
+ "Build-Depends-Arch"))
+
+ @property
def build_conflicts(self):
return self._relationship_parser(
self.context.currentrelease.build_conflicts)
@@ -529,6 +535,12 @@
return self._relationship_parser(
self.context.currentrelease.build_conflicts_indep)
+ @property
+ def build_conflicts_arch(self):
+ return self._relationship_parser(
+ self.context.currentrelease.getUserDefinedField(
+ "Build-Conflicts-Arch"))
+
def requestCountry(self):
return ICountry(self.request, None)
=== modified file 'lib/lp/registry/templates/sourcepackage-index.pt'
--- lib/lp/registry/templates/sourcepackage-index.pt 2015-11-24 01:44:28 +0000
+++ lib/lp/registry/templates/sourcepackage-index.pt 2016-02-05 15:25:49 +0000
@@ -124,6 +124,12 @@
<tal:block tal:condition="relationships/has_items"
replace="structure relationships/@@+render-list"/>
</td>
+ <td id="dependsarch"
+ tal:define="relationships view/builddependsarch">
+ <h3>Platform-dependent build dependencies</h3>
+ <tal:block tal:condition="relationships/has_items"
+ replace="structure relationships/@@+render-list"/>
+ </td>
</tr>
<tr>
<td id="conflicts" tal:define="relationships view/build_conflicts">
@@ -137,6 +143,12 @@
<tal:block tal:condition="relationships/has_items"
replace="structure relationships/@@+render-list"/>
</td>
+ <td id="conflictsarch"
+ tal:define="relationships view/build_conflicts_arch">
+ <h3>Platform-dependent build dependencies</h3>
+ <tal:block tal:condition="relationships/has_items"
+ replace="structure relationships/@@+render-list"/>
+ </td>
</tr>
</table>
</div>
=== modified file 'lib/lp/soyuz/doc/package-relationship.txt'
--- lib/lp/soyuz/doc/package-relationship.txt 2015-07-29 16:55:28 +0000
+++ lib/lp/soyuz/doc/package-relationship.txt 2016-02-05 15:25:49 +0000
@@ -1,12 +1,16 @@
= Package Relationship Model =
We call "package relationship" the DSC field which describes relation
-between the package in question and others availble:
+between the package in question and others available:
For sources DSC provides:
* builddepends
* builddependsindep
+ * builddependsarch
+ * build_conflicts
+ * build_conflicts_indep
+ * build_conflicts_arch
For binaries we have:
=== modified file 'lib/lp/soyuz/interfaces/sourcepackagerelease.py'
--- lib/lp/soyuz/interfaces/sourcepackagerelease.py 2015-09-28 17:38:45 +0000
+++ lib/lp/soyuz/interfaces/sourcepackagerelease.py 2016-02-05 15:25:49 +0000
@@ -50,7 +50,7 @@
"package depends to build"),
required=False)
builddependsindep = TextLine(
- title=_("DSC build depends"),
+ title=_("DSC arch-independent build depends"),
description=_("Same as builddepends, but the list is of "
"arch-independent packages"),
required=False)
=== modified file 'lib/lp/soyuz/model/sourcepackagerelease.py'
--- lib/lp/soyuz/model/sourcepackagerelease.py 2015-11-20 17:57:46 +0000
+++ lib/lp/soyuz/model/sourcepackagerelease.py 2016-02-05 15:25:49 +0000
@@ -8,6 +8,7 @@
import datetime
+import json
import operator
import re
from StringIO import StringIO
@@ -19,7 +20,6 @@
ChangelogParseError,
)
import pytz
-import simplejson
from sqlobject import (
ForeignKey,
SQLMultipleJoin,
@@ -132,7 +132,7 @@
def __init__(self, *args, **kwargs):
if 'user_defined_fields' in kwargs:
- kwargs['_user_defined_fields'] = simplejson.dumps(
+ kwargs['_user_defined_fields'] = json.dumps(
kwargs['user_defined_fields'])
del kwargs['user_defined_fields']
# copyright isn't on the Storm class, since we don't want it
@@ -173,13 +173,15 @@
"""See `IBinaryPackageRelease`."""
if self._user_defined_fields is None:
return []
- return simplejson.loads(self._user_defined_fields)
+ user_defined_fields = json.loads(self._user_defined_fields)
+ if user_defined_fields is None:
+ return []
+ return user_defined_fields
def getUserDefinedField(self, name):
- if self.user_defined_fields:
- for k, v in self.user_defined_fields:
- if k.lower() == name.lower():
- return v
+ for k, v in self.user_defined_fields:
+ if k.lower() == name.lower():
+ return v
@cachedproperty
def package_diffs(self):
=== modified file 'lib/lp/soyuz/stories/soyuz/xx-distroseries-sources.txt'
--- lib/lp/soyuz/stories/soyuz/xx-distroseries-sources.txt 2015-11-30 04:18:39 +0000
+++ lib/lp/soyuz/stories/soyuz/xx-distroseries-sources.txt 2016-02-05 15:25:49 +0000
@@ -118,12 +118,12 @@
... 'http://launchpad.dev/ubuntu/breezy-autotest/+source/'
... 'commercialpackage')
-PackageRelationships, 'builddepends', 'builddependsindep',
-'build_conflicts' and 'build_conflicts_indep' for the source in
-question are provided in this page.
+PackageRelationships, 'builddepends', 'builddependsindep', 'builddependsarch',
+'build_conflicts', 'build_conflicts_indep', and 'build_conflicts_arch' for the
+source in question are provided in this page.
-Even when the relationshipt section is empty they are presented,
-keeping the page format contant.
+Even when the relationship section is empty they are presented,
+keeping the page format constant.
>>> depends_section = find_tag_by_id(browser.contents, 'depends')
>>> parse_relationship_section(str(depends_section))
@@ -133,6 +133,10 @@
>>> parse_relationship_section(str(dependsindep_section))
EMPTY SECTION
+ >>> dependsarch_section = find_tag_by_id(browser.contents, 'dependsarch')
+ >>> parse_relationship_section(str(dependsarch_section))
+ EMPTY SECTION
+
>>> conflicts_section = find_tag_by_id(browser.contents, 'conflicts')
>>> parse_relationship_section(str(conflicts_section))
EMPTY SECTION
@@ -142,6 +146,11 @@
>>> parse_relationship_section(str(conflictsindep_section))
EMPTY SECTION
+ >>> conflictsarch_section = find_tag_by_id(
+ ... browser.contents, 'conflictsarch')
+ >>> parse_relationship_section(str(conflictsarch_section))
+ EMPTY SECTION
+
Let's inspect a page with non-empty relationships.
>>> browser.open(
@@ -163,6 +172,10 @@
LINK: "pmount" -> http://launchpad.dev/ubuntu/warty/+package/pmount
TEXT: "postgresql-client (>= 7.4)"
+ >>> dependsarch_section = find_tag_by_id(browser.contents, 'dependsarch')
+ >>> parse_relationship_section(str(dependsarch_section))
+ EMPTY SECTION
+
>>> conflicts_section = find_tag_by_id(browser.contents, 'conflicts')
>>> parse_relationship_section(str(conflicts_section))
TEXT: "gcc-4.0"
@@ -174,6 +187,11 @@
TEXT: "gcc-4.0-base"
LINK: "pmount" -> http://launchpad.dev/ubuntu/warty/+package/pmount
+ >>> conflictsarch_section = find_tag_by_id(
+ ... browser.contents, 'conflictsarch')
+ >>> parse_relationship_section(str(conflictsarch_section))
+ EMPTY SECTION
+
The '+changelog' page provides an aggregation of the changelogs for
SourcePackageReleases published in this DistroSeries.
Follow ups