Package: sbuild
Version: 0.57.0
Severity: wishlist
Tags: patch
I would find it useful to have an option in sbuild that automatically runs
"apt-get update" in the build chroot immediately prior to building, which
ensures the build gets the newest dependencies, even if one has not done
an apt update in the source chroot recently.
I've attached a patch to implement this feature.
-Tim Abbottdiff -ur sbuild-0.57.0/bin/sbuild sbuild-0.57.0-tabbott/bin/sbuild
--- sbuild-0.57.0/bin/sbuild 2008-01-01 06:39:56.000000000 -0500
+++ sbuild-0.57.0-tabbott/bin/sbuild 2008-03-22 20:25:45.000000000 -0400
@@ -131,6 +131,7 @@
"binNMU=i" => \$main::binNMUver,
"database=s" => \$main::database,
"D|debug+" => \$conf::debug,
+ "apt-update" => \$conf::apt_update,
"d|dist=s" => sub {
$main::distribution = $_[1];
$main::distribution = "oldstable"
@@ -276,6 +277,19 @@
$main::arch = chroot_arch();
+ if ($conf::apt_update) {
+ if (!open(PIPE, Sbuild::Chroot::get_apt_command("$conf::apt_get", "-q update", "root", 1) . " 2>&1 |")) {
+ print PLOG "Can't open pipe to apt-get: $!\n";
+ return 0;
+ }
+ while(<PIPE>) {
+ print PLOG;
+ print STDERR;
+ }
+ close(PIPE);
+ print PLOG "apt-get update failed\n" if $?;
+ }
+
$main::pkg_fail_stage = "fetch-src";
my @files_to_rm = fetch_source_files( \$dscfile,
$dir, $pkg, $version, $download);
@@ -372,7 +386,7 @@
}
} else {
my %entries = ();
- my $retried = 0;
+ my $retried = $conf::apt_update;
retry:
print PLOG "Checking available source versions...\n";
my $command = get_apt_command("$conf::apt_cache", "-q showsrc $pkg", $main::username, 0);
diff -ur sbuild-0.57.0/lib/Sbuild/Conf.pm sbuild-0.57.0-tabbott/lib/Sbuild/Conf.pm
--- sbuild-0.57.0/lib/Sbuild/Conf.pm 2008-01-01 06:39:56.000000000 -0500
+++ sbuild-0.57.0-tabbott/lib/Sbuild/Conf.pm 2008-03-22 20:30:20.000000000 -0400
@@ -43,7 +43,8 @@
$srcdep_lock_wait @ignore_watches_no_build_deps
$build_dir $sbuild_mode $debug $force_orig_source
%individual_stalled_pkg_timeout $path
- $maintainer_name $uploader_name %watches $key_id); }
+ $maintainer_name $uploader_name %watches $key_id
+ $apt_update); }
# Originally from the main namespace.
(our $HOME = $ENV{'HOME'})
@@ -98,6 +99,7 @@
our $maintainer_name;
our $uploader_name;
our $key_id;
+our $apt_update = 0;
our %alternatives = ("info-browser" => "info",
"httpd" => "apache",
"postscript-viewer" => "ghostview",
diff -ur sbuild-0.57.0/man/sbuild.1.in sbuild-0.57.0-tabbott/man/sbuild.1.in
--- sbuild-0.57.0/man/sbuild.1.in 2008-01-01 06:39:56.000000000 -0500
+++ sbuild-0.57.0-tabbott/man/sbuild.1.in 2008-03-22 20:31:10.000000000 -0400
@@ -112,6 +112,9 @@
.IR \-D , "\-\-debug"
Enable debug output.
.TP
+.IR "\-\-apt\-update"
+Run apt-get update in the chroot before executing the build.
+.TP
.IR \-m , "\-\-maintainer=<maintainer>"
Passed to dpkg\-genchanges and is used to set the Maintainer: field in
the .changes file(s).