launchpad-reviewers team mailing list archive
-
launchpad-reviewers team
-
Mailing list archive
-
Message #32860
[Merge] ~mwhudson/launchpad:accept-variant-build into launchpad:master
Michael Hudson-Doyle has proposed merging ~mwhudson/launchpad:accept-variant-build into launchpad:master.
Commit message:
handle variants when processing binary uploads
Requested reviews:
Launchpad code reviewers (launchpad-reviewers)
For more details, see:
https://code.launchpad.net/~mwhudson/launchpad/+git/launchpad/+merge/490638
Nothing seems to actually check that the uploaded binaries match the architecture of the distroseries that built them...
--
Your team Launchpad code reviewers is requested to review the proposed merge of ~mwhudson/launchpad:accept-variant-build into launchpad:master.
diff --git a/lib/lp/archiveuploader/nascentuploadfile.py b/lib/lp/archiveuploader/nascentuploadfile.py
index 01b2243..5f5c114 100644
--- a/lib/lp/archiveuploader/nascentuploadfile.py
+++ b/lib/lp/archiveuploader/nascentuploadfile.py
@@ -739,6 +739,9 @@ class BaseBinaryUploadFile(PackageUploadFile):
Also check if it is a valid architecture in LP context.
"""
control_arch = six.ensure_text(self.control.get("Architecture", b""))
+ control_arch_variant = six.ensure_text(
+ self.control.get("Architecture-Variant", control_arch)
+ )
valid_archs = [
a.architecturetag for a in self.policy.distroseries.architectures
]
@@ -755,7 +758,7 @@ class BaseBinaryUploadFile(PackageUploadFile):
"in the changes file." % (self.filename, control_arch)
)
- if control_arch != self.architecture:
+ if control_arch_variant != self.architecture:
yield UploadError(
"%s: control file lists arch as '%s' which doesn't "
"agree with version '%s' in the filename."
diff --git a/lib/lp/archiveuploader/tests/data/suite/bar_1.0-1_variant/bar_1.0-1_amd64v3.buildinfo b/lib/lp/archiveuploader/tests/data/suite/bar_1.0-1_variant/bar_1.0-1_amd64v3.buildinfo
new file mode 100644
index 0000000..e839edc
--- /dev/null
+++ b/lib/lp/archiveuploader/tests/data/suite/bar_1.0-1_variant/bar_1.0-1_amd64v3.buildinfo
@@ -0,0 +1,25 @@
+-----BEGIN PGP SIGNED MESSAGE-----
+Hash: SHA1
+
+Format: 1.0
+Source: bar
+Binary: bar
+Architecture: amd64
+Architecture-Variant: amd64v3
+Version: 1.0-1
+Checksums-Md5:
+ 224a95bb17616a86e02e8e3850851e2b 608 bar_1.0-1_amd64v3.deb
+Build-Origin: Ubuntu
+Build-Architecture: amd64
+Build-Date: Wed, 29 Mar 2017 00:01:21 +0100
+Installed-Build-Depends:
+ dpkg (= 1.18.22),
+ dpkg-dev (= 1.18.22)
+
+-----BEGIN PGP SIGNATURE-----
+
+iHQEARECADQWIQQ0DKO7Jw4nFsnuC3aOfrcIbGSoxQUCaIreyxYcZm9vLmJhckBj
+YW5vbmljYWwuY29tAAoJEI5+twhsZKjF/twAn1h3gkpBuqzQ/X8PUoq3wxvITTRS
+AJwIh6ElUPyc41i0qBnXWY7prTx7pA==
+=xkiw
+-----END PGP SIGNATURE-----
diff --git a/lib/lp/archiveuploader/tests/data/suite/bar_1.0-1_variant/bar_1.0-1_amd64v3.changes b/lib/lp/archiveuploader/tests/data/suite/bar_1.0-1_variant/bar_1.0-1_amd64v3.changes
new file mode 100644
index 0000000..528661b
--- /dev/null
+++ b/lib/lp/archiveuploader/tests/data/suite/bar_1.0-1_variant/bar_1.0-1_amd64v3.changes
@@ -0,0 +1,31 @@
+-----BEGIN PGP SIGNED MESSAGE-----
+Hash: SHA1
+
+Format: 1.7
+Date: Thu, 30 Mar 2006 01:36:14 +0100
+Source: bar
+Binary: bar
+Architecture: amd64
+Architecture-Variant: amd64v3
+Version: 1.0-1
+Distribution: breezy
+Urgency: low
+Maintainer: Launchpad team <launchpad@xxxxxxxxxxxxxxxxxxx>
+Changed-By: Daniel Silverstone <daniel.silverstone@xxxxxxxxxxxxx>
+Description:
+ bar - Stuff for testing
+Changes:
+ bar (1.0-1) breezy; urgency=low
+ .
+ * A variant build
+Files:
+ 224a95bb17616a86e02e8e3850851e2b 608 devel optional bar_1.0-1_amd64v3.deb
+ 92888986ce2a3fac29edcc42db3b12b6 609 devel optional bar_1.0-1_amd64v3.buildinfo
+
+-----BEGIN PGP SIGNATURE-----
+
+iHQEARECADQWIQQ0DKO7Jw4nFsnuC3aOfrcIbGSoxQUCaIre5RYcZm9vLmJhckBj
+YW5vbmljYWwuY29tAAoJEI5+twhsZKjF98UAn03R2Au8dzcnuxPIjvgIjP7UFbgo
+AJwMe0oIFkgAIMUcRqRwLQQx9QqXtg==
+=pdPo
+-----END PGP SIGNATURE-----
diff --git a/lib/lp/archiveuploader/tests/data/suite/bar_1.0-1_variant/bar_1.0-1_amd64v3.deb b/lib/lp/archiveuploader/tests/data/suite/bar_1.0-1_variant/bar_1.0-1_amd64v3.deb
new file mode 100644
index 0000000..1c55544
Binary files /dev/null and b/lib/lp/archiveuploader/tests/data/suite/bar_1.0-1_variant/bar_1.0-1_amd64v3.deb differ
diff --git a/lib/lp/archiveuploader/tests/test_nascentuploadfile.py b/lib/lp/archiveuploader/tests/test_nascentuploadfile.py
index 0de2157..fd86c57 100644
--- a/lib/lp/archiveuploader/tests/test_nascentuploadfile.py
+++ b/lib/lp/archiveuploader/tests/test_nascentuploadfile.py
@@ -874,6 +874,34 @@ class DebBinaryUploadFileTests(PackageUploadFileTestCase):
self.assertEqual(BuildStatus.FULLYBUILT, build.status)
self.assertIs(None, build.upload_log)
+ def test_checkBuild_variant(self):
+ # checkBuild() verifies consistency with a build.
+ das = self.factory.makeDistroArchSeries(
+ distroseries=self.policy.distroseries, architecturetag="i386"
+ )
+ build = self.factory.makeBinaryPackageBuild(
+ distroarchseries=das, archive=self.policy.archive
+ )
+ control = self.getBaseControl()
+ control["Architecture"] = b"amd64"
+ control["Architecture-Variant"] = b"amd64v3"
+ uploadfile = self.createDebBinaryUploadFile(
+ "foo_0.42_amd64v3.deb",
+ "main/python",
+ "unknown",
+ "mypkg",
+ "0.42",
+ None,
+ control=control,
+ data_format="gz",
+ control_format="gz",
+ )
+ uploadfile.checkBuild(build)
+ # checkBuild() sets the build status to FULLYBUILT and
+ # removes the upload log.
+ self.assertEqual(BuildStatus.FULLYBUILT, build.status)
+ self.assertIs(None, build.upload_log)
+
def test_checkBuild_inconsistent(self):
# checkBuild() raises UploadError if inconsistencies between build
# and upload file are found.
diff --git a/lib/lp/archiveuploader/tests/test_uploadprocessor.py b/lib/lp/archiveuploader/tests/test_uploadprocessor.py
index 95c1b8b..4b62808 100644
--- a/lib/lp/archiveuploader/tests/test_uploadprocessor.py
+++ b/lib/lp/archiveuploader/tests/test_uploadprocessor.py
@@ -2893,6 +2893,67 @@ class TestUploadHandler(TestUploadProcessorBase):
# Upon full build the upload log is unset.
self.assertIs(None, build.upload_log)
+ def testBinaryPackageBuilds_variant(self):
+ # Properly uploaded binaries should result in the
+ # build status changing to FULLYBUILT.
+ # Upload a source package
+ self.switchToAdmin()
+ self.factory.makeBuildableDistroArchSeries(
+ distroseries=self.breezy, architecturetag="amd64"
+ )
+ das_amd64v3 = self.factory.makeBuildableDistroArchSeries(
+ distroseries=self.breezy,
+ architecturetag="amd64v3",
+ underlying_architecturetag="amd64",
+ )
+ archive = self.breezy.distribution.main_archive
+ procs = list(archive.processors)
+ procs.append(das_amd64v3.processor)
+ removeSecurityProxy(archive).processors = procs
+
+ self.switchToUploader()
+ upload_dir = self.queueUpload("bar_1.0-1")
+ self.processUpload(self.uploadprocessor, upload_dir)
+ source_pub = self.publishPackage("bar", "1.0-1")
+ builds = source_pub.createMissingBuilds()
+ for b in builds:
+ if b.distro_arch_series.architecturetag == "amd64v3":
+ build = b
+
+ # Move the source from the accepted queue.
+ self.switchToAdmin()
+ [queue_item] = self.breezy.getPackageUploads(
+ status=PackageUploadStatus.ACCEPTED, version="1.0-1", name="bar"
+ )
+ queue_item.setDone()
+
+ build.buildqueue_record.markAsBuilding(self.factory.makeBuilder())
+ build.updateStatus(BuildStatus.UPLOADING)
+ self.switchToUploader()
+
+ # Upload and accept a binary for the primary archive source.
+ shutil.rmtree(upload_dir)
+
+ # Commit so the build cookie has the right ids.
+ self.layer.txn.commit()
+ behaviour = IBuildFarmJobBehaviour(build)
+ leaf_name = behaviour.getUploadDirLeaf(build.build_cookie)
+ upload_dir = self.queueUpload(
+ "bar_1.0-1_variant", queue_entry=leaf_name
+ )
+ self.options.context = "buildd"
+ self.options.builds = True
+ pop_notifications()
+ BuildUploadHandler(
+ self.uploadprocessor, self.incoming_folder, leaf_name
+ ).process()
+ self.layer.txn.commit()
+ # No emails are sent on success
+ self.assertEmailQueueLength(0)
+ self.assertEqual(BuildStatus.FULLYBUILT, build.status)
+ # Upon full build the upload log is unset.
+ self.assertIs(None, build.upload_log)
+
def doSuccessRecipeBuild(self):
# Upload a source package
self.switchToAdmin()