Package: sbuild Version: 0.57.5-1 Severity: normal Tags: patch Hello! I'd like to have the ability to run commands within the chroot before building. In a perfect world, I could specify a pre-existing chroot snapshot (one already started with schroot -b -c ....), and then I could open the chroot, run commands, run sbuild, and then destroy the chroot myself. I imagine this looking like so:
$ CMDS=$(mktemp -t cmds-XXXXXX) $ echo "stuff to run...." > "$CMDS" $ CHROOT=$(schroot -b -c unstable-i386) $ schroot -u root -r -c "$CHROOT" "$CMDS" $ rm -f "$CMDS" $ sbuild -d unstable -c "$CHROOT" -A somepkg.dsc $ schroot -e -c "$CHROOT" However, sbuild doesn't know how to look up this schroot nor to skip initialization, etc. Without this, I thought perhaps I could just run a script before starting the build. However, the sbuild options aren't passed into the environment anywhere, so in this example hack^Wpatch, I'm just passing the arguments I happened to need for my script. -Kees -- Kees Cook @outflux.net
--- sbuild-0.57.5.orig/bin/sbuild +++ sbuild-0.57.5/bin/sbuild @@ -184,6 +184,11 @@ goto cleanup_close; } + # Setup commands + if ($conf::setup_cmd) { + $session->run_command("$conf::setup_cmd ".$options->get('Distribution'), "root", 1); + } + $build->{'Pkg Fail Stage'} = "install-deps"; if (!$build->install_deps()) { print PLOG "Source-dependencies not satisfied; skipping " . only in patch2: unchanged: --- sbuild-0.57.5.orig/lib/Sbuild/Options.pm +++ sbuild-0.57.5/lib/Sbuild/Options.pm @@ -176,6 +176,7 @@ $self->set('Build Source', 1); }, "stats-dir=s" => \$Sbuild::Conf::stats_dir, + "setup-cmd=s" => \$Sbuild::Conf::setup_cmd, "use-snapshot" => sub { $self->set('GCC Snapshot', 1); $self->set('LD_LIBRARY_PATH', only in patch2: unchanged: --- sbuild-0.57.5.orig/lib/Sbuild/Conf.pm +++ sbuild-0.57.5/lib/Sbuild/Conf.pm @@ -45,7 +45,7 @@ $stalled_pkg_timeout $srcdep_lock_dir $srcdep_lock_wait $max_lock_trys $lock_interval @ignore_watches_no_build_deps $build_dir $sbuild_mode - $debug $force_orig_source + $debug $force_orig_source $setup_cmd %individual_stalled_pkg_timeout $path $maintainer_name $uploader_name %watches $key_id); } @@ -112,6 +112,7 @@ our $uploader_name; our $key_id; our $apt_update = 0; +our $setup_cmd = undef; our $apt_allow_unauthenticated = 0; our %alternatives = ("info-browser" => "info", "httpd" => "apache",