[buildd-tools-devel] Bug#605997: Do not skip purging of build directory if chroot is cloned.

Modestas Vainius modestas at vainius.eu
Sun Dec 5 12:23:06 UTC 2010


Package: libsbuild-perl
Version: 0.60.5-1
Severity: normal
File: /usr/share/perl5/Sbuild/Build.pm
Tags: patch

Hello,

This is necessary if /build in chroots is (bind-)mounted to the outside of the
session. However, if /build is part of the cloned session,
$purge_build_directory='never' could be used in order to avoid wasting time
when session ends.

The attached patch is basically against 0.60.5-1.

-- System Information:
Debian Release: squeeze/sid
  APT prefers unstable
  APT policy: (500, 'unstable'), (100, 'experimental')
Architecture: amd64 (x86_64)

Kernel: Linux 2.6.36-trunk-amd64 (SMP w/4 CPU cores)
Locale: LANG=lt_LT.UTF-8, LC_CTYPE=lt_LT.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash

Versions of packages libsbuild-perl depends on:
ii  adduser                       3.112+nmu2 add and remove users and groups
ii  apt                           0.8.10     Advanced front-end for dpkg
ii  dctrl-tools                   2.14.5     Command-line tools to process Debi
ii  devscripts                    2.10.69    scripts to make the life of a Debi
ii  dpkg-dev                      1.15.8.6   Debian package development tools
ii  exim4                         4.72-2     metapackage to ease Exim MTA (v4) 
ii  exim4-daemon-light [mail-tran 4.72-2     lightweight Exim MTA (v4) daemon
ii  libfilesys-df-perl            0.92-3+b1  Module to obtain filesystem disk s
ii  perl                          5.10.1-16  Larry Wall's Practical Extraction 
ii  perl-modules [libio-zlib-perl 5.10.1-16  Core Perl modules
ii  schroot                       1.4.15-1   Execute commands in a chroot envir

libsbuild-perl recommends no packages.

libsbuild-perl suggests no packages.

-- no debconf information
-------------- next part --------------
>From 1a73ea7fbea8f9ab4114ddf78d678c875cf02f35 Mon Sep 17 00:00:00 2001
From: Modestas Vainius <modax at debian.org>
Date: Sun, 5 Dec 2010 13:43:16 +0200
Subject: [PATCH 2/2] Do not skip purging of build directory if chroot is cloned.

This is necessary if /build in chroots is (bind-)mounted to the outside of the
session.  However, if /build is part of the cloned session,
$purge_build_directory='never' could be used in order to avoid wasting time
when session ends.
---
 debian/changelog    |    5 +++++
 lib/Sbuild/Build.pm |   24 ++++++++++++------------
 2 files changed, 17 insertions(+), 12 deletions(-)

diff --git a/debian/changelog b/debian/changelog
index 07b2c78..e1739b3 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,5 +1,10 @@
 sbuild (0.60.5-1mdx1) UNRELEASED; urgency=low
 
+  * Do not skip purging of build directory if chroot is cloned. This is
+    necessary if /build in chroots is (bind-)mounted to the outside of the
+    session.  However, if /build is part of the cloned session,
+    $purge_build_directory='never' could be used in order to avoid wasting time
+    when session ends.
 
  -- Modestas Vainius <modax at debian.org>  Sun, 05 Dec 2010 13:28:54 +0200
 
diff --git a/lib/Sbuild/Build.pm b/lib/Sbuild/Build.pm
index a282527..f13077c 100644
--- a/lib/Sbuild/Build.pm
+++ b/lib/Sbuild/Build.pm
@@ -561,24 +561,24 @@ sub run {
     my $is_cloned_session = (defined ($session->get('Session Purged')) &&
 			     $session->get('Session Purged') == 1) ? 1 : 0;
 
+    if ($purge_build_directory) {
+	# Purge package build directory
+	$self->log("Purging " . $self->get('Chroot Build Dir') . "\n");
+	my $bdir = $self->get('Session')->strip_chroot_path($self->get('Chroot Build Dir'));
+	$self->get('Session')->run_command(
+	    { COMMAND => ['rm', '-rf', $bdir],
+	      USER => 'root',
+	      CHROOT => 1,
+	      PRIORITY => 0,
+	      DIR => '/' });
+    }
+
     # Purge non-cloned session
     if ($is_cloned_session) {
 	$self->log("Not cleaning session: cloned chroot in use\n");
 	$end_session = 0
 	    if ($purge_build_directory == 0 || $purge_build_deps == 0);
     } else {
-	if ($purge_build_directory) {
-	    # Purge package build directory
-	    $self->log("Purging " . $self->get('Chroot Build Dir') . "\n");
-	    my $bdir = $self->get('Session')->strip_chroot_path($self->get('Chroot Build Dir'));
-	    $self->get('Session')->run_command(
-		{ COMMAND => ['rm', '-rf', $bdir],
-		  USER => 'root',
-		  CHROOT => 1,
-		  PRIORITY => 0,
-		  DIR => '/' });
-	}
-
 	if ($purge_build_deps) {
 	    # Removing dependencies
 	    $resolver->uninstall_deps();
-- 
1.7.2.3



More information about the Buildd-tools-devel mailing list