[buildd-tools-devel] [PATCH 07/11] [schroot-options] Clarify --session-name usage

Jan-Marek Glogowski glogow at fbihome.de
Mon Aug 10 18:12:16 UTC 2009


Additionally fail on invalid use.
---
 bin/schroot/schroot-options-base.cc |    7 ++++++-
 bin/schroot/schroot-options.cc      |    2 +-
 man/schroot.1.in                    |    9 ++++++---
 3 files changed, 13 insertions(+), 5 deletions(-)

diff --git a/bin/schroot/schroot-options-base.cc b/bin/schroot/schroot-options-base.cc
index b1276bd..69f6d1f 100644
--- a/bin/schroot/schroot-options-base.cc
+++ b/bin/schroot/schroot-options-base.cc
@@ -200,7 +200,8 @@ options_base::check_actions ()
       this->load_chroots = true;
       this->load_sessions = false;
       if (this->chroots.size() != 1 || all_used())
-	throw opt::validation_error(_("Exactly one chroot must be specified when beginning a session"));
+	throw opt::validation_error
+	  (_("Exactly one chroot must be specified when beginning a session"));
 
       this->all = this->all_chroots = this->all_sessions = false;
     }
@@ -210,6 +211,10 @@ options_base::check_actions ()
     {
       // Session operations work on all chroots.
       this->load_chroots = this->load_sessions = true;
+
+      if (!this->session_name.empty())
+        throw opt::validation_error
+	  (_("Session name not allowed - probably you want to use --chroot"));
     }
   else if (this->action == ACTION_HELP ||
 	   this->action == ACTION_VERSION)
diff --git a/bin/schroot/schroot-options.cc b/bin/schroot/schroot-options.cc
index dae40bc..47b157e 100644
--- a/bin/schroot/schroot-options.cc
+++ b/bin/schroot/schroot-options.cc
@@ -81,7 +81,7 @@ options::add_options ()
 
   session_options.add_options()
     ("session-name,n", opt::value<std::string>(&this->session_name),
-     _("Session name (defaults to an automatically generated name)"))
+     _("Replace generated session name on session startup"))
     ("force,f",
      _("Force operation, even if it fails"));
 }
diff --git a/man/schroot.1.in b/man/schroot.1.in
index 03def96..f4798d3 100644
--- a/man/schroot.1.in
+++ b/man/schroot.1.in
@@ -145,13 +145,16 @@ Note that the session identifier may be specified with the
 .BR \-\-recover\-session
 Recover an existing session.  If an existing session has become unavailable,
 for example becoming unmounted due to a reboot, this option will make the
-session available for use again, for example by remounting it.
+session available for use again, for example by remounting it.  The session ID
+is specified with the \fI\-\-chroot\fP option.
 .TP
 .BR \-r ", " \-\-run\-session
-Run an existing session.  The session ID is specified with the \fI\-\-chroot\fP option.
+Run an existing session.  The session ID is specified with the 
+\fI\-\-chroot\fP option.
 .TP
 .BR \-e ", " \-\-end\-session
-End an existing session.  The session ID is specified with the \fI\-\-chroot\fP option.
+End an existing session.  The session ID is specified with the 
+\fI\-\-chroot\fP option.
 .SS Session options
 .TP
 .BR \-n ", " \-\-session\-name=\fIsession-name\fP
-- 
1.6.4




More information about the Buildd-tools-devel mailing list