launchpad-reviewers team mailing list archive
-
launchpad-reviewers team
-
Mailing list archive
-
Message #00697
[Merge] lp:~jelmer/launchpad/621778-parse-homepage-field into lp:launchpad
Jelmer Vernooij has proposed merging lp:~jelmer/launchpad/621778-parse-homepage-field into lp:launchpad with lp:~jelmer/launchpad/621778-homepage-field as a prerequisite.
Requested reviews:
Launchpad code reviewers (launchpad-reviewers): code
This adds support for parsing the Homepage field from SourcePackageRelease/BinaryPackageRelease control files and storing that information in the appropriate database fields.
--
https://code.launchpad.net/~jelmer/launchpad/621778-parse-homepage-field/+merge/33334
Your team Launchpad code reviewers is requested to review the proposed merge of lp:~jelmer/launchpad/621778-parse-homepage-field into lp:launchpad.
=== modified file 'lib/lp/archiveuploader/dscfile.py'
--- lib/lp/archiveuploader/dscfile.py 2010-08-21 13:54:20 +0000
+++ lib/lp/archiveuploader/dscfile.py 2010-08-22 18:22:47 +0000
@@ -183,6 +183,7 @@
"format",
"standards-version",
"filecontents",
+ "homepage",
]))
# Note that files is actually only set inside verify().
@@ -673,6 +674,7 @@
architecturehintlist=encoded.get('architecture', ''),
creator=self.changes.changed_by['person'],
urgency=self.changes.converted_urgency,
+ homepage=encoded.get('homepage'),
dsc=encoded['filecontents'],
dscsigningkey=self.signingkey,
dsc_maintainer_rfc822=encoded['maintainer'],
=== modified file 'lib/lp/archiveuploader/nascentuploadfile.py'
--- lib/lp/archiveuploader/nascentuploadfile.py 2010-08-21 13:54:20 +0000
+++ lib/lp/archiveuploader/nascentuploadfile.py 2010-08-22 18:22:47 +0000
@@ -408,6 +408,7 @@
"Section",
"Maintainer",
"Source",
+ "Homepage",
]))
# Map priorities to their dbschema valuesa
@@ -929,6 +930,7 @@
pre_depends=encoded.get('Pre-Depends', ''),
enhances=encoded.get('Enhances', ''),
breaks=encoded.get('Breaks', ''),
+ homepage=encoded.get('Homepage'),
essential=is_essential,
installedsize=installedsize,
architecturespecific=architecturespecific,
=== modified file 'lib/lp/archiveuploader/tests/test_nascentuploadfile.py'
--- lib/lp/archiveuploader/tests/test_nascentuploadfile.py 2010-08-21 13:54:20 +0000
+++ lib/lp/archiveuploader/tests/test_nascentuploadfile.py 2010-08-22 18:22:47 +0000
@@ -192,6 +192,20 @@
self.assertEquals(
[["python-version", u"2.5"]], release.user_defined_fields)
+ def test_homepage(self):
+ # Test that storeInDatabase updates homepage.
+ dsc = self.getBaseDsc()
+ dsc["Homepage"] = "http://samba.org/~jelmer/bzr"
+ changes = self.getBaseChanges()
+ uploadfile = self.createDSCFile(
+ "foo.dsc", dsc, "main/net", "extra", "dulwich", "0.42",
+ self.createChangesFile("foo.changes", changes))
+ (uploadfile.changelog_path, changelog_digest, changelog_size) = (
+ self.writeUploadFile("changelog", "DUMMY"))
+ uploadfile.files = []
+ release = uploadfile.storeInDatabase(None)
+ self.assertEquals(u"http://samba.org/~jelmer/bzr", release.homepage)
+
class DebBinaryUploadFileTests(PackageUploadFileTestCase):
"""Tests for DebBinaryUploadFile."""
@@ -272,10 +286,7 @@
build = self.factory.makeBinaryPackageBuild()
bpr = uploadfile.storeInDatabase(build)
self.assertEquals(
- [
- [u"Homepage", u"http://samba.org/~jelmer/dulwich"],
- [u"Python-Version", u"2.5"]
- ], bpr.user_defined_fields)
+ [[u"Python-Version", u"2.5"]], bpr.user_defined_fields)
def test_user_defined_fields_newlines(self):
# storeInDatabase stores user defined fields and keeps newlines.
@@ -290,5 +301,17 @@
self.assertEquals(
[
[u"RandomData", u"Foo\nbar\nbla\n"],
- [u"Homepage", u"http://samba.org/~jelmer/dulwich"],
], bpr.user_defined_fields)
+
+ def test_homepage(self):
+ # storeInDatabase stores homepage field.
+ uploadfile = self.createDebBinaryUploadFile(
+ "foo_0.42_i386.deb", "main/python", "unknown", "mypkg", "0.42",
+ None)
+ control = self.getBaseControl()
+ control["Python-Version"] = "2.5"
+ uploadfile.parseControl(control)
+ build = self.factory.makeBinaryPackageBuild()
+ bpr = uploadfile.storeInDatabase(build)
+ self.assertEquals(u"http://samba.org/~jelmer/dulwich",
+ bpr.homepage)
=== modified file 'lib/lp/registry/interfaces/distroseries.py'
--- lib/lp/registry/interfaces/distroseries.py 2010-08-21 13:54:20 +0000
+++ lib/lp/registry/interfaces/distroseries.py 2010-08-22 18:22:47 +0000
@@ -602,7 +602,8 @@
dsc_maintainer_rfc822, dsc_standards_version, dsc_format,
dsc_binaries, archive, copyright, build_conflicts,
build_conflicts_indep, dateuploaded=None,
- source_package_recipe_build=None, user_defined_fields=None):
+ source_package_recipe_build=None, user_defined_fields=None,
+ homepage=None):
"""Create an uploads `SourcePackageRelease`.
Set this distroseries set to be the uploadeddistroseries.
=== modified file 'lib/lp/registry/model/distroseries.py'
--- lib/lp/registry/model/distroseries.py 2010-08-21 13:54:20 +0000
+++ lib/lp/registry/model/distroseries.py 2010-08-22 18:22:47 +0000
@@ -1183,7 +1183,8 @@
dsc_maintainer_rfc822, dsc_standards_version, dsc_format,
dsc_binaries, archive, copyright, build_conflicts,
build_conflicts_indep, dateuploaded=DEFAULT,
- source_package_recipe_build=None, user_defined_fields=None):
+ source_package_recipe_build=None, user_defined_fields=None,
+ homepage=None):
"""See `IDistroSeries`."""
return SourcePackageRelease(
upload_distroseries=self, sourcepackagename=sourcepackagename,
@@ -1200,7 +1201,7 @@
build_conflicts=build_conflicts,
build_conflicts_indep=build_conflicts_indep,
source_package_recipe_build=source_package_recipe_build,
- user_defined_fields=user_defined_fields)
+ user_defined_fields=user_defined_fields, homepage=homepage)
def getComponentByName(self, name):
"""See `IDistroSeries`."""
=== modified file 'lib/lp/soyuz/interfaces/binarypackagebuild.py'
--- lib/lp/soyuz/interfaces/binarypackagebuild.py 2010-08-21 13:54:20 +0000
+++ lib/lp/soyuz/interfaces/binarypackagebuild.py 2010-08-22 18:22:47 +0000
@@ -140,7 +140,7 @@
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_fields=None):
+ user_defined_fields=None, homepage=None):
"""Create and return a `BinaryPackageRelease`.
The binarypackagerelease will be attached to this specific build.
=== modified file 'lib/lp/soyuz/model/binarypackagebuild.py'
--- lib/lp/soyuz/model/binarypackagebuild.py 2010-08-21 13:54:20 +0000
+++ lib/lp/soyuz/model/binarypackagebuild.py 2010-08-22 18:22:47 +0000
@@ -485,7 +485,7 @@
architecturespecific, 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_fields=None):
+ debug_package=None, user_defined_fields=None, homepage=None):
"""See IBuild."""
return BinaryPackageRelease(
build=self, binarypackagename=binarypackagename, version=version,
@@ -498,7 +498,7 @@
breaks=breaks, essential=essential, installedsize=installedsize,
architecturespecific=architecturespecific,
debug_package=debug_package,
- user_defined_fields=user_defined_fields)
+ user_defined_fields=user_defined_fields, homepage=homepage)
def estimateDuration(self):
"""See `IBuildBase`."""
=== modified file 'lib/lp/soyuz/tests/test_publishing.py'
--- lib/lp/soyuz/tests/test_publishing.py 2010-08-21 13:54:20 +0000
+++ lib/lp/soyuz/tests/test_publishing.py 2010-08-22 18:22:47 +0000
@@ -355,7 +355,7 @@
depends=None, recommends=None, suggests=None, conflicts=None,
replaces=None, provides=None, pre_depends=None, enhances=None,
breaks=None, format=BinaryPackageFormat.DEB, debug_package=None,
- user_defined_fields=None):
+ user_defined_fields=None, homepage=None):
"""Return the corresponding `BinaryPackageRelease`."""
sourcepackagerelease = build.source_package_release
distroarchseries = build.distro_arch_series
@@ -388,7 +388,7 @@
binpackageformat=format,
priority=PackagePublishingPriority.STANDARD,
debug_package=debug_package,
- user_defined_fields=user_defined_fields)
+ user_defined_fields=user_defined_fields, homepage=homepage)
# Create the corresponding binary file.
if architecturespecific:
=== modified file 'lib/lp/testing/factory.py'
--- lib/lp/testing/factory.py 2010-08-21 13:54:20 +0000
+++ lib/lp/testing/factory.py 2010-08-22 18:22:47 +0000
@@ -2704,7 +2704,8 @@
provides=None, pre_depends=None,
enhances=None, breaks=None,
essential=False, installed_size=None,
- date_created=None, debug_package=None):
+ date_created=None, debug_package=None,
+ homepage=None):
"""Make a `BinaryPackageRelease`."""
if build is None:
build = self.makeBinaryPackageBuild()
@@ -2735,7 +2736,8 @@
suggests=suggests, conflicts=conflicts, replaces=replaces,
provides=provides, pre_depends=pre_depends,
enhances=enhances, breaks=breaks, essential=essential,
- installedsize=installed_size, debug_package=debug_package)
+ installedsize=installed_size, debug_package=debug_package,
+ homepage=homepage)
if date_created is not None:
removeSecurityProxy(bpr).datecreated = date_created
return bpr