Source: sbuild
Version: 0.83.1
Severity: wishlist

sbuild-createchroot has an optional mirror argument, however if this is not
provided it has its own hardcoded mirror it uses when calling debootstrap.

This is unfortunate as debootstrap (and by extension sbuild) will happily work
with other distributions (such as ubuntu).

Included is a patch which makes sbuild let debootrap pick the mirror instead.

-- System Information:
Debian Release: 10.12
 APT prefers oldstable-updates
 APT policy: (500, 'oldstable-updates'), (500, 'oldstable')
Architecture: amd64 (x86_64)

Kernel: Linux 4.19.0-9-amd64 (SMP w/4 CPU cores)
Kernel taint flags: TAINT_OOT_MODULE, TAINT_UNSIGNED_MODULE
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8),
LANGUAGE=en_US:en (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash
Init: systemd (via /run/systemd/system)
LSM: AppArmor: enabled
From 5fd7b6e404c8f5cf5c644199cc0626a71f969736 Mon Sep 17 00:00:00 2001
From: Mattias Jernberg <nost...@gmail.com>
Date: Fri, 6 May 2022 14:16:46 +0200
Subject: [PATCH] bin/sbuild-createchroot: Do not hardcode mirror argument to
 debootstrap

debootstrap understands distros better than sbuild, for instance it
has profiles for Ubuntu. By not giving the mirror argument when it
wasn't specified debootstrap will make the right choice of mirror
for Ubuntu as well, making it possible to do

  sbuild-createchroot focal /sbuild/focal-root

and having it work magically.
---
 bin/sbuild-createchroot | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/bin/sbuild-createchroot b/bin/sbuild-createchroot
index 7a106ef7..f504b3ff 100755
--- a/bin/sbuild-createchroot
+++ b/bin/sbuild-createchroot
@@ -334,15 +334,15 @@ if (-e $target) {
 }
 $target = abs_path($target);
 my $script = undef;
-my $mirror = "http://deb.debian.org/debian";;
+my $mirror = undef;
 
 $mirror = $ARGV[2] if $#ARGV >= 2;
-$script = $ARGV[3] if $#ARGV == 3;
+$script = $ARGV[3] if $#ARGV >= 3;
 
 if ($conf->get('VERBOSE')) {
     print "I: SUITE: $suite\n";
     print "I: TARGET: $target\n";
-    print "I: MIRROR: $mirror\n";
+    print "I: MIRROR: $mirror\n" if (defined($mirror));
     print "I: SCRIPT: $script\n" if (defined($script));
 }
 
@@ -363,7 +363,8 @@ if ($conf->get('MERGED_USR') ne 'auto') {
 	push @args, $conf->get('MERGED_USR') ?
 	    "--merged-usr" : "--no-merged-usr";
 }
-push @args, "$suite", "$target", "$mirror";
+push @args, "$suite", "$target";
+push @args, "$mirror" if $mirror;
 push @args, "$script" if $script;
 
 # Set the path to debootstrap
-- 
2.20.1

Reply via email to