[Buildd-tools-devel] Bug#482804: Bug#482804: sbuild: lvm-snapshot managed chroots uninstall packages after builds

Roger Leigh rleigh at whinlatter.ukfsn.org
Sun May 25 20:36:51 UTC 2008


tags 482804 + patch fixed-upstream pending
thanks

Timothy G Abbott <tabbott at MIT.EDU> writes:

> In using sbuild with the latest version of schroot, lvm-snapshot type 
> chroots uninstall the dependencies that they installed, rather than 
> allowing them to be removed by the LVM snapshot being destroyed.
>
> The cause seems to be that the function sbuild::chroot::session_flags in 
> schroot-1.2.0/sbuild/sbuild-chroot-source.cc is concluding that it should 
> set the flags to CHROOT_SESSION_PURGE instead of CHROOT_SESSION_CLONE; but 
> sbuild is checking for whether it is Session Cloned, not Session Purged. 
> The documentation in the schroot code in sbuild::chroot::session_flags 
> suggest that sbuild is checking the wrong field ('Session Cloned' rather 
> than 'Session Purged') here, but I'm not entirely certain.

You are entirely correct.  The meaning of "cloned" used to mean the
chroot could be purged, but this turned out not to always be the case
so the purged flag was added to make it unambiguous.  I thought I had
updated sbuild to use this, but I must have missed it.

I have attached the patch used to correct this, which is also in the
upstream GIT repository.


Regards,
Roger


diff --git a/bin/sbuild b/bin/sbuild
index c8c64a7..6ce46e5 100755
--- a/bin/sbuild
+++ b/bin/sbuild
@@ -304,8 +304,8 @@ sub main ($) {
 	$self->append_to_FINISHED($pkgv);
 
       cleanup_packages:
-	if (defined ($session->{'Session Cloned'}) &&
-	    $session->{'Session Cloned'} == 1) {
+	if (defined ($session->{'Session Purged'}) &&
+	    $session->{'Session Purged'} == 1) {
 	    print PLOG "Not removing build depends: cloned chroot in use\n";
 	} else {
 	    $self->uninstall_deps();
diff --git a/debian/changelog b/debian/changelog
index 050228b..74f6356 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -2,8 +2,10 @@ sbuild (0.57.3-1) unstable; urgency=low
 
   * New release.
   * --chroot and --arch now work together (Closes: #479714).
+  * Use schroot "Session Purged" flag rather than "Session Cloned"
+    (Closes: #482804).  Thanks to Timothy G Abbott.
 
- -- Roger Leigh <rleigh at debian.org>  Sun, 11 May 2008 10:49:17 +0100
+ -- Roger Leigh <rleigh at debian.org>  Sun, 25 May 2008 21:32:39 +0100
 
 sbuild (0.57.2-1) unstable; urgency=low
 
diff --git a/lib/Sbuild/Chroot.pm b/lib/Sbuild/Chroot.pm
index 0750af5..592cb3e 100644
--- a/lib/Sbuild/Chroot.pm
+++ b/lib/Sbuild/Chroot.pm
@@ -98,7 +98,7 @@ sub _setup_options (\$\$) {
 
 	$self->set('Priority', $info->{'Priority'});
 	$self->set('Location', $info->{'Location'});
-	$self->set('Session Cloned', $info->{'Session Cloned'});
+	$self->set('Session Purged', $info->{'Session Purged'});
 	$self->set('Build Location', $self->get('Location') . "/build");
 	$self->set('Srcdep Lock Dir', $self->get('Location') . "/$Sbuild::Conf::srcdep_lock_dir");
 	$self->set('Install Lock', $self->get('Srcdep Lock Dir') . "/install");
diff --git a/lib/Sbuild/ChrootInfo.pm b/lib/Sbuild/ChrootInfo.pm
index 8a8794f..5d43d0a 100644
--- a/lib/Sbuild/ChrootInfo.pm
+++ b/lib/Sbuild/ChrootInfo.pm
@@ -54,7 +54,7 @@ sub get_chroot_info ($) {
     my $chroot_type = "";
     my %tmp = ('Priority' => 0,
 	       'Location' => "",
-	       'Session Cloned' => 0);
+	       'Session Purged' => 0);
     open CHROOT_DATA, '-|', $Sbuild::Conf::schroot, '--info', '--chroot', $chroot or die "Can't run $Sbuild::Conf::schroot to get chroot data";
     while (<CHROOT_DATA>) {
 	chomp;
@@ -76,9 +76,9 @@ sub get_chroot_info ($) {
 	if (/^\s*Priority:?\s+(\d+)$/) {
 	    $tmp{'Priority'} = $1;
 	}
-	if (/^\s*Session Cloned\s+(.*)$/) {
+	if (/^\s*Session Purged\s+(.*)$/) {
 	    if ($1 eq "true") {
-		$tmp{'Session Cloned'} = 1;
+		$tmp{'Session Purged'} = 1;
 	    }
 	}
     }
@@ -99,7 +99,7 @@ sub get_chroot_info_all () {
     foreach (glob("${Sbuild::Conf::build_dir}/chroot-*")) {
 	my %tmp = ('Priority' => 0,
 		   'Location' => $_,
-		   'Session Cloned' => 0);
+		   'Session Purged' => 0);
 	if (-d $tmp{'Location'}) {
 	    my $name = $_;
 	    $name =~ s/\Q${Sbuild::Conf::build_dir}\/chroot-\E//;


-- 
  .''`.  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: 188 bytes
Desc: not available
Url : http://lists.alioth.debian.org/pipermail/buildd-tools-devel/attachments/20080525/89ad56ab/attachment.pgp 


More information about the Buildd-tools-devel mailing list