When you cann sbuild-createchroot with --use-qemu-debootstrap,
sbuild-createchroot will use qemu-debootstrap instead of the
standard debootstrap. This is particularly useful when
building for foreign architectures.

Signed-off-by: Alberto Milone <[email protected]>
---
 bin/sbuild-createchroot |   22 ++++++++++++++++++++--
 1 file changed, 20 insertions(+), 2 deletions(-)

diff --git a/bin/sbuild-createchroot b/bin/sbuild-createchroot
index ba37f80..0ac7cbf 100755
--- a/bin/sbuild-createchroot
+++ b/bin/sbuild-createchroot
@@ -54,6 +54,9 @@ sub setup {
        'KEEP_DEBOOTSTRAP_DIR'                  => {
            DEFAULT => 0
        },
+       'USE_QEMU_DEBOOTSTRAP'                  => {
+           DEFAULT => 0
+       },
        'KEYRING'                               => {
            DEFAULT => undef
        },
@@ -104,6 +107,9 @@ sub set_options {
        "keep-debootstrap-dir" => sub {
            $self->set_conf('KEEP_DEBOOTSTRAP_DIR', 1)
        },
+       "use-qemu-debootstrap" => sub {
+           $self->set_conf('USE_QEMU_DEBOOTSTRAP', 1)
+       },
        "exclude=s" => sub {
            $self->set_conf('EXCLUDE', $_[1]);
        },
@@ -192,13 +198,25 @@ push @args, $conf->get('RESOLVE_DEPS') ?
 push @args, "$suite", "$target", "$mirror";
 push @args, "$script" if $script;
 
+# Set the path to debootstrap
+my $debootstrap = "/usr/sbin/debootstrap";
+
+# Run qemu-debootstrap instead of debootstrap
+if ($conf->get('USE_QEMU_DEBOOTSTRAP')) {
+    $debootstrap = "/usr/sbin/qemu-debootstrap";
+}
+
+# Get the name of the debootstrap binary
+my $debootstrap_bin = $debootstrap;
+$debootstrap_bin =~ s/^.*\///s;
+
 if ($conf->get('VERBOSE')) {
-    print "I: Running debootstrap " . join(' ',@args) . "\n";
+    print "I: Running $debootstrap_bin " . join(' ',@args) . "\n";
 }
 
 # Run debootstrap with specified options.
 if (!$conf->get('SETUP_ONLY')) {
-    !system("/usr/sbin/debootstrap", @args) or die "E: Error running 
debootstrap";
+    !system($debootstrap, @args) or die "E: Error running $debootstrap_bin";
 }
 
 # Set up minimal /etc/hosts.
-- 
1.7.9.5


-- 
To UNSUBSCRIBE, email to [email protected]
with a subject of "unsubscribe". Trouble? Contact [email protected]

Reply via email to