[buildd-tools-devel] Bug#691539: Bug#691539: sbuild: Does arch wildcard check outside build chroot not inside, which is wrong when new architectures are added

Johannes Schauer josch at debian.org
Thu Dec 24 00:07:15 UTC 2015


Control: tag -1 + patch

Hi,

On Sat, 3 Nov 2012 16:44:13 +0000 Roger Leigh <rleigh at codelibre.net> wrote:
> On Fri, Oct 26, 2012 at 05:13:10PM +0100, Wookey wrote:
> > If a new architecture is added to dpkg such that the version inside the
> > build chroot knows about this, but the version outside does not then the
> > Arch check stage can fail if the package arch is a wildcard like
> > 'linux-any'.
> > 
> > The offending code is in lib/Sbuild/Build.pm:
> > 
> > That arch check should (I think) be done inside the chroot, where it will
> > come out correct. 
> 
> This makes sense I think.  The only possible disadvantage is the performance
> hit of setting up the schroot session and then tearing it down immediately if
> invalid.  But that's not too a high cost, and correctness is better.
> 
> I'll just need to check where this occurs in the build sequence and maybe
> move it to a point where we have an active session, if it's not already in
> the right place.  I'll need to double-check that has no nasty side-effects as
> well.

the following untested patch should fix the problem:

diff --git a/lib/Sbuild/Build.pm b/lib/Sbuild/Build.pm
index d03401c..00f3c3a 100644
--- a/lib/Sbuild/Build.pm
+++ b/lib/Sbuild/Build.pm
@@ -1118,7 +1118,23 @@ sub fetch_source_files {
     } else {
        my $valid_arch;
        for my $a (split(/\s+/, $dscarchs)) {
-           if (Dpkg::Arch::debarch_is($host_arch, $a)) {
+           my $command = <<"EOF";
+               use strict;
+               use warnings;
+               use Dpkg::Arch;
+               if (Dpkg::Arch::debarch_is($host_arch, $a)) {
+                   exit 0;
+               }
+               exit 1;
+EOF
+           $self->run_command(
+               { COMMAND => ['perl',
+                       '-e',
+                       $command],
+                   USER => 'root',
+                   PRIORITY => 0,
+                   DIR => '/' });
+           if ($? == 0) {
                $valid_arch = 1;
                last;
            }


Thanks!

cheers, josch
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: signature
URL: <http://lists.alioth.debian.org/pipermail/buildd-tools-devel/attachments/20151224/7d0d6d44/attachment.sig>


More information about the Buildd-tools-devel mailing list