[Piuparts-devel] Bug#794575: support testing foreign arch installation

Helmut Grohne helmut at subdivi.de
Tue Aug 4 21:45:20 UTC 2015


Control: tags -1 + patch
Control: severity -1 normal

On Tue, Aug 04, 2015 at 08:44:34PM +0200, Andreas Beckmann wrote:
> On 2015-08-04 17:15, Helmut Grohne wrote:> Package: piuparts
> > So I tried to test a foreign arch installation of libc6 with piuparts
> > and noticed that it succeeds despite failing to install the foreign arch
> > libc6. The initial dpkg --unpack fails, because the architecture is not
> > added to dpkg, but piuparts swallows that failure. I argue that in this
> > situation, piuparts should either actually perform the test or fail.
> 
> It should fail. So what command did you use to test it?

On a amd64 system with an amd64 pbuilder base.tgz, the following command
succeeds (as in "PASS: All tests." and exit status 0) despite never
unpacking the given package.

piuparts -p /var/cache/apt/archives/libc6_2.19-19_i386.deb

As you say this behaviour is buggy, I am raising the severity
accordingly.

> I'd suggest explicit
>   --foreign-arch <arch>
> (which may be given multiple times)

Implemented in the attached patch. It actually gets simpler that way.

> Guessing from the dependencies won't work if the foreign dependency is
> further down the dependency chain.

This remark is correct. My previous patch would not handle e.g.
crossbuild-essential-ppc64el. It can now be tested, but correctly
determines that crossbuild-essential-ppc64el is currently not
installable.

Helmut
-------------- next part --------------
Binary files /tmp/WN39WQRhF9/piuparts-0.64/.piuparts.py.swp and /tmp/7lA5rM_eLG/piuparts-0.64+nmu1/.piuparts.py.swp differ
diff -Nru piuparts-0.64/debian/changelog piuparts-0.64+nmu1/debian/changelog
--- piuparts-0.64/debian/changelog	2015-06-12 13:44:18.000000000 +0200
+++ piuparts-0.64+nmu1/debian/changelog	2015-08-04 22:21:56.000000000 +0200
@@ -1,3 +1,10 @@
+piuparts (0.64+nmu1) UNRELEASED; urgency=medium
+
+  * Non-maintainer upload.
+  * Support testing foreign arch installations. (Closes: #-1)
+
+ -- Helmut Grohne <helmut at subdivi.de>  Tue, 04 Aug 2015 16:59:14 +0200
+
 piuparts (0.64) unstable; urgency=medium
 
   [ Holger Levsen ]
diff -Nru piuparts-0.64/piuparts.py piuparts-0.64+nmu1/piuparts.py
--- piuparts-0.64/piuparts.py	2015-06-12 13:43:13.000000000 +0200
+++ piuparts-0.64+nmu1/piuparts.py	2015-08-04 23:33:47.000000000 +0200
@@ -169,6 +169,7 @@
         self.allow_database = False
         # chroot setup
         self.arch = None
+        self.foreignarchs = set()
         self.basetgz = None
         self.savetgz = None
         self.lvm_volume = None
@@ -728,6 +729,7 @@
         if not settings.schroot:
             self.mount_proc()
             self.mount_selinux()
+        self.add_architectures(settings.foreignarchs)
         self.configure_chroot()
 
         # Copy scripts dirs into the chroot, merging all dirs together,
@@ -892,6 +894,17 @@
                     "\n".join(lines) + "\n")
         logging.debug("sources.list:\n" + indent_string("\n".join(lines)))
 
+    def add_architectures(self, architectures):
+        """Ensure that dpkg accepts the given architectures."""
+        architectures = set(architectures)
+        if architectures:
+            _, native_arch = self.run(["dpkg", "--print-architecture"])
+            architectures.discard(native_arch.strip())
+            _, foreign_arches = self.run(["dpkg", "--print-foreign-architectures"])
+            architectures.difference_update(foreign_arches.splitlines())
+            for arch in architectures:
+                self.run(["dpkg", "--add-architecture", arch])
+
     def enable_testdebs_repo(self, update=True):
         if settings.testdebs_repo:
             if settings.testdebs_repo.startswith("deb"):
@@ -2644,6 +2657,9 @@
     parser.add_option("--arch", metavar="ARCH", action="store",
                       help="Create chroot and run tests for (non-default) architecture ARCH.")
 
+    parser.add_option("--foreign-arch", metavar="ARCH", action="append", default=[],
+                      help="Enable ARCH architecture in the chroot prior to installation.")
+
     parser.add_option("--adt-virt",
                       metavar='CMDLINE', default=None,
                       help="Use CMDLINE via autopkgtest (adt-virt-*)"
@@ -2934,6 +2950,7 @@
     settings.allow_database = opts.allow_database
     # chroot setup
     settings.arch = opts.arch
+    settings.foreignarchs = set(opts.foreign_arch)
     settings.basetgz = opts.basetgz
     settings.savetgz = opts.save
     settings.lvm_volume = opts.lvm_volume


More information about the Piuparts-devel mailing list