tags 528312 + patch fixed-upstream pending thanks On Mon, May 11, 2009 at 05:40:36PM -0700, Joey Korkames wrote: > For a failed build, it lets me chroot in manually and start hacking in > the build dir to discover/fix bugs. For successful builds, destroying > the snapshot is faster than waiting for "apt-get remove foo bar" to > finish (and then having to destroy the snapshot afterward, anyways).
Please could you see if the attached patch fixes things for you. It adds a --purge-deps=(always|never|successful) option, which is also settable in the configuration file with $purge_build_deps. In your case, setting it to "never" will do what you want. 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/etc/sbuild.conf b/etc/sbuild.conf index 416b98c..3d82caf 100644 --- a/etc/sbuild.conf +++ b/etc/sbuild.conf @@ -102,6 +102,10 @@ # "successful", and "always". "always" is the default. #$purge_build_directory="successful"; +# When to purge the build dependencies afterwards; possible values are "never", +# "successful", and "always". "always" is the default. +#$purge_build_deps="always"; + # sbuild behaviour; possible values are "user" (exit status reports # build failures) and "buildd" (exit status does not report build # failures) for use in a buildd setup. "buildd" also currently diff --git a/lib/Sbuild/Build.pm b/lib/Sbuild/Build.pm index b71273d..adb6740 100644 --- a/lib/Sbuild/Build.pm +++ b/lib/Sbuild/Build.pm @@ -300,7 +300,13 @@ sub run { $session->get('Session Purged') == 1) { $self->log("Not removing build depends: cloned chroot in use\n"); } else { - $self->uninstall_deps(); + if ($self->get_conf('PURGE_BUILD_DEPS') eq 'always' || + ($self->get_conf('PURGE_BUILD_DEPS') eq 'successful' && + $self->get_status() eq 'successful')) { + $self->uninstall_deps(); + } else { + $self->log("Not removing build depends: as requested\n"); + } } $self->remove_srcdep_lock_file(); cleanup_close: diff --git a/lib/Sbuild/Conf.pm b/lib/Sbuild/Conf.pm index f657ec6..701b388 100644 --- a/lib/Sbuild/Conf.pm +++ b/lib/Sbuild/Conf.pm @@ -226,6 +226,19 @@ sub init_allowed_keys { 'MAILFROM' => { DEFAULT => "Source Builder <sbuild>" }, + 'PURGE_BUILD_DEPS' => { + CHECK => sub { + my $self = shift; + my $entry = shift; + my $key = $entry->{'NAME'}; + + die "Bad purge mode \'" . + $self->get('PURGE_BUILD_DEPS') . "\'" + if !isin($self->get('PURGE_BUILD_DEPS'), + qw(always successful never)); + }, + DEFAULT => 'always' + }, 'PURGE_BUILD_DIRECTORY' => { CHECK => sub { my $self = shift; @@ -476,6 +489,7 @@ sub read_config { my %mailto; undef %mailto; my $mailfrom = undef; + my $purge_build_deps = undef; my $purge_build_directory = undef; my @toolchain_regex; undef @toolchain_regex; @@ -554,6 +568,7 @@ sub read_config { $self->set('MAILTO_HASH', \%mailto) if (%mailto); $self->set('MAILFROM', $mailfrom); + $self->set('PURGE_BUILD_DEPS', $purge_build_deps); $self->set('PURGE_BUILD_DIRECTORY', $purge_build_directory); $self->set('TOOLCHAIN_REGEX', \...@toolchain_regex) if (@toolchain_regex); diff --git a/lib/Sbuild/Options.pm b/lib/Sbuild/Options.pm index e86cc6e..e5742fc 100644 --- a/lib/Sbuild/Options.pm +++ b/lib/Sbuild/Options.pm @@ -133,6 +133,9 @@ sub set_options { "p|purge=s" => sub { $self->set_conf('PURGE_BUILD_DIRECTORY', $_[1]); }, + "purge-deps=s" => sub { + $self->set_conf('PURGE_BUILD_DEPS', $_[1]); + }, "s|source" => sub { $self->set_conf('BUILD_SOURCE', 1); }, diff --git a/man/sbuild.1.in b/man/sbuild.1.in index 33c3d86..198e98c 100644 --- a/man/sbuild.1.in +++ b/man/sbuild.1.in @@ -40,6 +40,7 @@ sbuild \- build debian packages from source .RB [ \-e \[or] \-\-uploader=\fIuploader\fP ] .RB [ \-k \[or] \-\-keyid=\fIkey-id\fP ] .RB [ \-\-purge=\fPpurge-mode\fP ] +.RB [ \-\-purge\-deps=\fPpurge-mode\fP ] .RB [ \-b \[or] \-\-batch] .RB [ \-n \[or] \-\-nolog ] .RB [ \-\-setup\-hook=\fIhook-script\fP ] @@ -171,6 +172,10 @@ log mails. \fIpurge-mode\fR determines if the build directory will be deleted after a build. Possible values are \fBalways\fR, \fBnever\fR, and \fBsuccessful\fR. .TP +.BR \-p ", " "\-\-purge\-deps=\fIpurge-mode\fP" +\fIpurge-mode\fR determines if the build dependencies will be removed after a +build. Possible values are \fBalways\fR, \fBnever\fR, and \fBsuccessful\fR. +.TP .BR \-s ", " "\-\-source" Also build source package, i.e. use dpkg\-buildpackage without \-B. .TP