tags 588818 + patch
thanks
On Mon, Jul 12, 2010 at 05:46:50PM +0200, Cyril Brulebois wrote:
as mentioned earlier, DEBIAN_FRONTEND doesn't get set to noninteractive
when using the aptitude resolver. The internal one uses run_apt, which
takes care of setting a sane(r) environment, while the aptitude one
calls aptitude directly, w/o setting DEBIAN_FRONTEND=noninteractive in
the environment.
That broke building a package pulling some debconf-using
build-dependencies, and interrupting the build broke the chroots,
meaning manual cleanup. Hence the severity.
I've attached a proof of concept patch to fix this. Please could
you give it a try? It's possible it needs a bit of tweaking; I'm
afraid I'm pushed for time so it's untested tonight.
Essentially, we add explicit support for Aptitude to Sbuild::Chroot
so that there are pipe_aptitude_command etc. methods just like
pipe_apt_command. These take care of setting up common aptitude
options and work just as for apt-get. Note I'm not sure if it
respects all of the apt-get options such as Dir::State, DPkg::Options
and DPkg::Run-Directory which are essential for $chroot_mode=split.
If you could verify that works too, I would appreciate it.
Regards,
Roger
--
.''`. Roger Leigh
: :' : Debian GNU/Linux http://people.debian.org/~rleigh/
`. `' Printing on GNU/Linux? http://gutenprint.sourceforge.net/
`-GPG Public Key: 0x25BFB848 Please GPG sign your mail.
diff --git a/configure.ac b/configure.ac
index 8214a5d..0ac8d48 100644
--- a/configure.ac
+++ b/configure.ac
@@ -85,6 +85,7 @@ fi
# Checks for programs.
AC_PATH_PROG([APT_CACHE], [apt-cache])
+AC_PATH_PROG([APTITUDE], [aptitude])
AC_PATH_PROG([APT_GET], [apt-get])
AC_PATH_PROG([CHMOD], [chmod])
AC_PATH_PROG([DATE], [date])
diff --git a/debian/rules b/debian/rules
index aee0b55..55561ff 100755
--- a/debian/rules
+++ b/debian/rules
@@ -16,7 +16,8 @@ debian/build/config.status: configure
DCMD=/usr/bin/dcmd \
SCHROOT=/usr/bin/schroot \
SSH=/usr/bin/ssh \
- SUDO=/usr/bin/sudo
+ SUDO=/usr/bin/sudo \
+ APTITUDE=/usr/bin/aptitude
build: debian/build/config.status debian/build-stamp
debian/build-stamp: debian/build/config.status
diff --git a/lib/Sbuild/AptitudeBuildDepSatisfier.pm b/lib/Sbuild/AptitudeBuildDepSatisfier.pm
index e1c68f9..0685c00 100644
--- a/lib/Sbuild/AptitudeBuildDepSatisfier.pm
+++ b/lib/Sbuild/AptitudeBuildDepSatisfier.pm
@@ -149,11 +149,11 @@ EOF
my @non_default_deps = $self-get_non_default_deps($dep, {});
my @aptitude_install_command = (
- 'aptitude',
- '-y',
- '--without-recommends',
- '-o', 'APT::Install-Recommends=false',
- '-o', 'Aptitude::ProblemResolver::StepScore=100',
+ $self-get_conf('APTITUDE'),
+ '-y',
+ '--without-recommends',
+ '-o', 'APT::Install-Recommends=false',
+ '-o', 'Aptitude::ProblemResolver::StepScore=100',
'-o', Aptitude::ProblemResolver::Hints::KeepDummy=reject $dummy_pkg_name :UNINST,
'-o', 'Aptitude::ProblemResolver::Keep-All-Tier=55000',
'-o', 'Aptitude::ProblemResolver::Remove-Essential-Tier=maximum',
@@ -164,8 +164,9 @@ EOF
$builder-log(join( , @aptitude_install_command), \n);
-my $pipe = $session-pipe_command(
+my $pipe = $session-pipe_aptitude_command(
{ COMMAND = \...@aptitude_install_command,
+ ENV = {'DEBIAN_FRONTEND' = 'noninteractive'},
PIPE = 'in',
USER = 'root',
CHROOT = 1,
diff --git a/lib/Sbuild/Chroot.pm b/lib/Sbuild/Chroot.pm
index b27c6de..5f06986 100644
--- a/lib/Sbuild/Chroot.pm
+++ b/lib/Sbuild/Chroot.pm
@@ -132,11 +132,17 @@ sub _setup_options {
'-o', DPkg::Options::=--root=$chroot_dir,
'-o', DPkg::Run-Directory=$chroot_dir]);
+ $self-set('Aptitude Options',
+ ['-o', Dir::State::status=$chroot_dir/var/lib/dpkg/status,
+ '-o', DPkg::Options::=--root=$chroot_dir,
+ '-o', DPkg::Run-Directory=$chroot_dir]);
+
# sudo uses an absolute path on the host system.
$self-get('Defaults')-{'ENV'}-{'APT_CONFIG'} =
$self-get('Chroot APT Conf');
} else { # no split
$self-set('APT Options', []);
+ $self-set('Aptitude Options', []);
$self-get('Defaults')-{'ENV'}-{'APT_CONFIG'} =
$self-get('APT Conf');
}
@@ -404,6 +410,55 @@ sub pipe_apt_command {
return $self-pipe_command_internal($options);
}
+sub get_aptitude_command_internal {
+my $self = shift;
+my $options = shift;
+
+my $command = $options-{'COMMAND'};
+my $apt_options = $self-get('Aptitude Options');
+
+debug(Aptitude Options: , join( , @$apt_options), \n)
+ if defined($apt_options);
+
+my @aptcommand = ();
+if (defined($apt_options)) {
+ push(@aptcommand, @{$command}[0]);
+ push(@aptcommand, @$apt_options);
+ if ($#$command 0) {
+ push(@aptcommand, @{$command}[1 .. $#$command]);
+ }
+} else {
+ @aptcommand = @$command;
+}
+
+debug(APT Command: , join( , @aptcommand), \n);
+
+$options-{'CHROOT'} = $self-apt_chroot();
+$options-{'CHDIR_CHROOT'} =