[Buildd-tools-devel] [PATCH 21/22] Clarify --session-name usage; fail on invalid use

Jan-Marek Glogowski glogow at fbihome.de
Thu Mar 26 21:13:59 UTC 2009


---
 bin/schroot/schroot-options-base.cc |    7 ++++++-
 bin/schroot/schroot-options.cc      |    2 +-
 bin/schroot/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 56c7d1c..10b009a 100644
--- a/bin/schroot/schroot-options-base.cc
+++ b/bin/schroot/schroot-options-base.cc
@@ -205,7 +205,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;
     }
@@ -215,6 +216,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 83dda3e..a41ac6e 100644
--- a/bin/schroot/schroot-options.cc
+++ b/bin/schroot/schroot-options.cc
@@ -83,7 +83,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/bin/schroot/schroot.1.in b/bin/schroot/schroot.1.in
index 4ed3b53..8f2512a 100644
--- a/bin/schroot/schroot.1.in
+++ b/bin/schroot/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.2.1




More information about the Buildd-tools-devel mailing list