Hello,

On šeštadienis 26 Kovas 2011 22:56:12 you wrote:
> I've replaced --keep-session with
> --purge-session=(always|successful|never). This allows it to take the same
> values as the other --purge options.
> 
> I have also allowed $end_session to take the same values rather than a
> single boolean value.

I renamed $end_session to $purge_session for consistency. Btw, you forgot to 
change some properties after copy&pasting from 'PURGE_BUILD_DEPS'. Both 
changes are in the attached patch (to be applied on top of current master).

-- 
Modestas Vainius <mo...@debian.org>
From 1149a804a5fd0c20ee7301efc3f117b54e88a943 Mon Sep 17 00:00:00 2001
From: Modestas Vainius <mo...@debian.org>
Date: Sun, 27 Mar 2011 00:56:37 +0200
Subject: Rename end_session to purge_session everywhere + post copy&paste fixes.

Rename:
    $end_session -> $purge_session
    END_SESSION -> PURGE_SESSION

for consistency with the rest of similar sbuild.conf settings.

Also fix PURGE_SESSION key properties (TYPE, HELP, CHECK) which were forgotten
after copy&paste from PURGE_BUILD_DEPS.
---
 NEWS                  |    2 +-
 debian/changelog      |    2 +-
 lib/Sbuild/Build.pm   |    4 ++--
 lib/Sbuild/Conf.pm    |   12 ++++++------
 lib/Sbuild/Options.pm |    2 +-
 5 files changed, 11 insertions(+), 11 deletions(-)

diff --git a/NEWS b/NEWS
index aa3eba9..5d01cf0 100644
--- a/NEWS
+++ b/NEWS
@@ -18,7 +18,7 @@ configuration.
      session to be purged for all, successful and no builds,
      respectively.
 
-  3) $end_session uses the same purge modes as $purge_build_deps and
+  3) $purge_session uses the same purge modes as $purge_build_deps and
      $purge_build_directory, rather than a boolean value.
 
 * Major changes in 0.62.1:
diff --git a/debian/changelog b/debian/changelog
index e29d9a5..8bc74e7 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -20,7 +20,7 @@ sbuild (0.62.2-1) unstable; urgency=low
       This value is set each run, and so varies between builds when
       generating the configuration file.  Exclude from the generated
       output to prevent unnecessary differences between builds.
-    - $end_session uses the same purge modes as $purge_build_deps and
+    - $purge_session uses the same purge modes as $purge_build_deps and
       $purge_build_directory, rather than a boolean value.
 
  -- Roger Leigh <rle...@debian.org>  Sat, 26 Mar 2011 20:51:11 +0000
diff --git a/lib/Sbuild/Build.pm b/lib/Sbuild/Build.pm
index 0f267c1..c833edc 100644
--- a/lib/Sbuild/Build.pm
+++ b/lib/Sbuild/Build.pm
@@ -531,8 +531,8 @@ sub run_chroot_session {
     # End chroot session
     my $session = $self->get('Session');
     my $end_session =
-	($self->get_conf('END_SESSION') eq 'always' ||
-	 ($self->get_conf('END_SESSION') eq 'successful' &&
+	($self->get_conf('PURGE_SESSION') eq 'always' ||
+	 ($self->get_conf('PURGE_SESSION') eq 'successful' &&
 	  $self->get_status() eq 'successful')) ? 1 : 0;
     if ($end_session) {
 	$session->end_session();
diff --git a/lib/Sbuild/Conf.pm b/lib/Sbuild/Conf.pm
index b705fc7..e5698ad 100644
--- a/lib/Sbuild/Conf.pm
+++ b/lib/Sbuild/Conf.pm
@@ -477,9 +477,9 @@ sub setup ($) {
 	    DEFAULT => 'always',
 	    HELP => 'When to purge the build directory after a build; possible values are "never", "successful", and "always"'
 	},
-	'END_SESSION'			=> {
-	    TYPE => 'BOOL',
-	    VARNAME => 'end_session',
+	'PURGE_SESSION'			=> {
+	    TYPE => 'STRING',
+	    VARNAME => 'purge_session',
 	    GROUP => 'Chroot options',
 	    CHECK => sub {
 		my $conf = shift;
@@ -487,12 +487,12 @@ sub setup ($) {
 		my $key = $entry->{'NAME'};
 
 		die "Bad purge mode \'" .
-		    $conf->get('PURGE_BUILD_DEPS') . "\'"
-		    if !isin($conf->get('PURGE_BUILD_DEPS'),
+		    $conf->get('PURGE_SESSION') . "\'"
+		    if !isin($conf->get('PURGE_SESSION'),
 			     qw(always successful never));
 	    },
 	    DEFAULT => 'always',
-	    HELP => 'When to purge the build directory after a build; possible values are "never", "successful", and "always".  By default, the chroot session is always ended following a build.  When using schroot and cloned chroots such as LVM or Btrfs snapshots, the snapshot is deleted.  If you want to keep the build directory, or inspect the chroot after a build, then by disabling session ending the snapshot will be kept rather than deleted.  This is useful in conjunction with PURGE_BUILD_DEPS and PURGE_BUILD_DIRECTORY.'
+	    HELP => 'Purge the schroot session following a build.  This is useful in conjunction with the --purge and --purge-deps options when using snapshot chroots, since by default the snapshot will be deleted. Possible values are "always" (default), "never", and "successful"'
 	},
 	'TOOLCHAIN_REGEX'			=> {
 	    TYPE => 'ARRAY:STRING',
diff --git a/lib/Sbuild/Options.pm b/lib/Sbuild/Options.pm
index 7013c5d..88638f9 100644
--- a/lib/Sbuild/Options.pm
+++ b/lib/Sbuild/Options.pm
@@ -163,7 +163,7 @@ sub set_options {
 			   $self->set_conf('PURGE_BUILD_DEPS', $_[1]);
 		       },
 		       "purge-session=s" => sub {
-			   $self->set_conf('END_SESSION', $_[1]);
+			   $self->set_conf('PURGE_SESSION', $_[1]);
 		       },
 		       "s|source" => sub {
 			   $self->set_conf('BUILD_SOURCE', 1);
-- 
1.7.4.1

Attachment: signature.asc
Description: This is a digitally signed message part.

Reply via email to