[buildd-tools-devel] Bug#551917: Bug#551917: [sbuild] Please add a switch to disable/ignore free space calculation

Roger Leigh rleigh at codelibre.net
Sat Dec 12 14:33:29 UTC 2009


tags 551917 + fixed-upstream patch pending
thanks

On Wed, Oct 21, 2009 at 09:14:53PM +0200, Bruno Kleinert wrote:
> it would be great if it was possible to disable the disc space checking
> code for particular builds by a command line option. In my particular
> case sbuild assumed it will run out of disc sapce. I commented out the
> checking code in Build.pm, lines 663 to 676 and building the package
> worked just fine. I'm using sbuild together with schroot on a LVM
> snapshot.

Done.  The following patch was committed to the git master branch to
add this feature.


Regards,
Roger

 
diff --git a/etc/sbuild.conf b/etc/sbuild.conf
index 3d82caf..7b55581 100644
--- a/etc/sbuild.conf
+++ b/etc/sbuild.conf
@@ -129,6 +129,14 @@
 # each build, or 0 to disable.
 #$apt_update = 0;
 
+# Check free disk space prior to starting a build.  sbuild requires
+# the free space to be at least twice the size of the unpacked sources
+# to allow a build to proceed.  Can be disabled to allow building if
+# space is very limited, but the threshold to abort a build has been
+# exceeded despite there being sufficient space for the build to
+# complete.
+#$check_space = 1;
+
 # Check watched packages to discover missing build dependencies.  This
 # can be disabled to increase the speed of builds
 #$check_watches = 1;
diff --git a/lib/Sbuild/Build.pm b/lib/Sbuild/Build.pm
index 6aae838..b9d0d88 100644
--- a/lib/Sbuild/Build.pm
+++ b/lib/Sbuild/Build.pm
@@ -703,7 +703,7 @@ sub build {
     $current_usage = $1;
     if ($current_usage) {
 	my $free = df($dscdir);
-	if ($free < 2*$current_usage) {
+	if ($free < 2*$current_usage && $self->get_conf('CHECK_SPACE')) {
 	    $self->log("Disc space is propably not enough for building.\n".
 		       "(Source needs $current_usage KB, free are $free KB.)\n");
 	    # TODO: Only purge in a single place.
diff --git a/lib/Sbuild/Conf.pm b/lib/Sbuild/Conf.pm
index 0de778e..bab48e6 100644
--- a/lib/Sbuild/Conf.pm
+++ b/lib/Sbuild/Conf.pm
@@ -303,6 +303,9 @@ sub init_allowed_keys {
 	'APT_POLICY'				=> {
 	    DEFAULT => 1
 	},
+	'CHECK_SPACE'				=> {
+	    DEFAULT => 1
+	},
 	'CHECK_WATCHES'				=> {
 	    DEFAULT => 1
 	},
@@ -489,6 +492,7 @@ sub read_config {
     my $max_lock_trys = undef;
     my $lock_interval = undef;
     my $apt_policy = undef;
+    my $check_space = undef;
     my $check_watches = undef;
     my @ignore_watches_no_build_deps;
     undef @ignore_watches_no_build_deps;
@@ -570,6 +574,7 @@ sub read_config {
     $self->set('LOCK_INTERVAL', $lock_interval);
     $self->set('APT_POLICY', $apt_policy);
     $self->set('CHECK_WATCHES', $check_watches);
+    $self->set('CHECK_SPACE', $check_space);
     $self->set('IGNORE_WATCHES_NO_BUILD_DEPS',
 	       \@ignore_watches_no_build_deps)
 	if (@ignore_watches_no_build_deps);

-- 
  .''`.  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.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: Digital signature
URL: <http://lists.alioth.debian.org/pipermail/buildd-tools-devel/attachments/20091212/578d6892/attachment.pgp>


More information about the Buildd-tools-devel mailing list