tags 579701 + patch fixed-upstream pending
thanks

On Fri, Apr 30, 2010 at 01:37:33AM +0200, Cyril Brulebois wrote:
> Source: schroot
> Version: 1.4.1-2
> Severity: serious
> Justification: FTBFS

Updated to add configure check for
boost::program_options::validation_error construction semantics and to
cope with different semantics for different Boost versions.

I'll merge this patch onto the stable release branch and make a new
point release shortly.


Regards,
Roger

-- 
  .''`.  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.
diff --git a/AUTHORS b/AUTHORS
index 596af3d..c0b75b4 100644
--- a/AUTHORS
+++ b/AUTHORS
@@ -4,6 +4,9 @@ principal areas that each contributed to are listed in addition.
 Tim Abbott		<tabb...@mit.edu>
 	schroot bash completion.
 
+Andy Bailey		<bai...@akamai.com>
+     	Boost 1.42 compatibility
+
 Andreas Bombe		<a...@debian.org>
 	Documentation improvements.
 
diff --git a/bin/csbuild/csbuild-options.cc b/bin/csbuild/csbuild-options.cc
index a5c3957..4554320 100644
--- a/bin/csbuild/csbuild-options.cc
+++ b/bin/csbuild/csbuild-options.cc
@@ -220,9 +220,19 @@ options::check_options ()
   if (vm.count("binNMU") && vm.count("make-binNMU"))
     this->bin_nmu = true;
   else if (vm.count("binNMU"))
-    throw opt::validation_error(_("--makebinNMU missing"));
+    throw opt::validation_error
+      (
+#ifndef BOOST_PROGRAM_OPTIONS_VALIDATION_ERROR_OLD
+       opt::validation_error::at_least_one_value_required,
+#endif
+       _("--makebinNMU missing"));
   else if (vm.count("make-binNMU"))
-    throw opt::validation_error(_("--binNMU missing"));
+    throw opt::validation_error
+      (
+#ifndef BOOST_PROGRAM_OPTIONS_VALIDATION_ERROR_OLD
+       opt::validation_error::at_least_one_value_required,
+#endif
+       _("--binNMU missing"));
 
   if (!deb_build_options_string.empty())
     {
diff --git a/bin/dchroot-dsa/dchroot-dsa-options.cc b/bin/dchroot-dsa/dchroot-dsa-options.cc
index fec282d..14cace1 100644
--- a/bin/dchroot-dsa/dchroot-dsa-options.cc
+++ b/bin/dchroot-dsa/dchroot-dsa-options.cc
@@ -90,11 +90,21 @@ options::check_options ()
 
   // dchroot-dsa only allows one command.
   if (this->command.size() > 1)
-    throw opt::validation_error(_("Only one command may be specified"));
+	throw opt::validation_error
+	  (
+#ifndef BOOST_PROGRAM_OPTIONS_VALIDATION_ERROR_OLD
+	   opt::validation_error::multiple_values_not_allowed,
+#endif
+	   _("Only one command may be specified"));
 
   if (!this->command.empty() &&
       !sbuild::is_absname(this->command[0]))
-    throw opt::validation_error(_("Command must have an absolute path"));
+	throw opt::validation_error
+	  (
+#ifndef BOOST_PROGRAM_OPTIONS_VALIDATION_ERROR_OLD
+	   opt::validation_error::invalid_option,
+#endif
+	   _("Command must have an absolute path"));
 
   if (this->chroots.empty() && !all_used() &&
       (this->action != ACTION_CONFIG &&
@@ -103,5 +113,10 @@ options::check_options ()
        this->action != ACTION_LOCATION &&
        this->action != ACTION_HELP &&
        this->action != ACTION_VERSION))
-    throw opt::validation_error(_("No chroot specified"));
+	throw opt::validation_error
+	  (
+#ifndef BOOST_PROGRAM_OPTIONS_VALIDATION_ERROR_OLD
+	   opt::validation_error::at_least_one_value_required,
+#endif
+	   _("No chroot specified"));
 }
diff --git a/bin/schroot-base/schroot-base-option-action.cc b/bin/schroot-base/schroot-base-option-action.cc
index e0638a5..df8b9e0 100644
--- a/bin/schroot-base/schroot-base-option-action.cc
+++ b/bin/schroot-base/schroot-base-option-action.cc
@@ -82,7 +82,12 @@ option_action::set (action_type const& action)
       if (this->current_action == "")
 	this->current_action = action;
       else
-	throw opt::validation_error(_("Only one action may be specified"));
+	throw opt::validation_error
+	  (
+#ifndef BOOST_PROGRAM_OPTIONS_VALIDATION_ERROR_OLD
+	   opt::validation_error::multiple_values_not_allowed,
+#endif
+	   _("Only one action may be specified"));
     }
   else
     throw std::logic_error((format(_("%1%: invalid action")) % action).str());
diff --git a/bin/schroot-base/schroot-base-options.cc b/bin/schroot-base/schroot-base-options.cc
index d32a0d7..567733f 100644
--- a/bin/schroot-base/schroot-base-options.cc
+++ b/bin/schroot-base/schroot-base-options.cc
@@ -155,7 +155,12 @@ options::check_options ()
       else if (this->debug_level == "critical")
 	sbuild::debug_log_level = sbuild::DEBUG_CRITICAL;
       else
-	throw opt::validation_error(_("Invalid debug level"));
+	throw opt::validation_error
+	  (
+#ifndef BOOST_PROGRAM_OPTIONS_VALIDATION_ERROR_OLD
+	   opt::validation_error::invalid_option_value,
+#endif
+	   _("Invalid debug level"));
     }
   else
     sbuild::debug_log_level = sbuild::DEBUG_NONE;
diff --git a/bin/schroot-listmounts/schroot-listmounts-options.cc b/bin/schroot-listmounts/schroot-listmounts-options.cc
index 0b24582..a008984 100644
--- a/bin/schroot-listmounts/schroot-listmounts-options.cc
+++ b/bin/schroot-listmounts/schroot-listmounts-options.cc
@@ -86,5 +86,10 @@ options::check_options ()
 
   if (this->action == ACTION_LISTMOUNTS &&
       this->mountpoint.empty())
-    throw opt::validation_error(_("No mount point specified"));
+	throw opt::validation_error
+	  (
+#ifndef BOOST_PROGRAM_OPTIONS_VALIDATION_ERROR_OLD
+	   opt::validation_error::at_least_one_value_required,
+#endif
+	   _("No mount point specified"));
 }
diff --git a/bin/schroot-mount/schroot-mount-options.cc b/bin/schroot-mount/schroot-mount-options.cc
index a0719a9..7c9bfe7 100644
--- a/bin/schroot-mount/schroot-mount-options.cc
+++ b/bin/schroot-mount/schroot-mount-options.cc
@@ -99,5 +99,10 @@ options::check_options ()
 
   if (this->action == ACTION_MOUNT &&
       this->mountpoint.empty())
-    throw opt::validation_error(_("No mount point specified"));
+	throw opt::validation_error
+	  (
+#ifndef BOOST_PROGRAM_OPTIONS_VALIDATION_ERROR_OLD
+	   opt::validation_error::at_least_one_value_required,
+#endif
+	   _("No mount point specified"));
 }
diff --git a/bin/schroot-releaselock/schroot-releaselock-options.cc b/bin/schroot-releaselock/schroot-releaselock-options.cc
index 52c490a..d807b92 100644
--- a/bin/schroot-releaselock/schroot-releaselock-options.cc
+++ b/bin/schroot-releaselock/schroot-releaselock-options.cc
@@ -89,5 +89,10 @@ options::check_options ()
 
   if (this->action == ACTION_RELEASELOCK &&
       this->device.empty())
-    throw opt::validation_error(_("No device specified"));
+	throw opt::validation_error
+	  (
+#ifndef BOOST_PROGRAM_OPTIONS_VALIDATION_ERROR_OLD
+	   opt::validation_error::at_least_one_value_required,
+#endif
+	   _("No device specified"));
 }
diff --git a/bin/schroot/schroot-options-base.cc b/bin/schroot/schroot-options-base.cc
index a773565..d4d8d16 100644
--- a/bin/schroot/schroot-options-base.cc
+++ b/bin/schroot/schroot-options-base.cc
@@ -201,7 +201,11 @@ options_base::check_actions ()
       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"));
+	  (
+#ifndef BOOST_PROGRAM_OPTIONS_VALIDATION_ERROR_OLD
+	   opt::validation_error::multiple_values_not_allowed,
+#endif
+	   _("Exactly one chroot must be specified when beginning a session"));
 
       this->all = this->all_chroots = this->all_sessions = false;
     }
@@ -214,7 +218,11 @@ options_base::check_actions ()
 
       if (!this->session_name.empty())
         throw opt::validation_error
-	  (_("--session-name is not permitted for the specified action; did you mean to use --chroot?"));
+	  (
+#ifndef BOOST_PROGRAM_OPTIONS_VALIDATION_ERROR_OLD
+	   opt::validation_error::invalid_option,
+#endif
+	   _("--session-name is not permitted for the specified action; did you mean to use --chroot?"));
     }
   else if (this->action == ACTION_HELP ||
 	   this->action == ACTION_VERSION)
@@ -234,7 +242,12 @@ options_base::check_actions ()
       if (this->all_sessions)
 	this->load_sessions = true;
       if (!this->chroots.empty())
-	throw opt::validation_error(_("--chroot may not be used with --list"));
+	throw opt::validation_error
+	  (
+#ifndef BOOST_PROGRAM_OPTIONS_VALIDATION_ERROR_OLD
+	   opt::validation_error::invalid_option,
+#endif
+	   _("--chroot may not be used with --list"));
     }
   else if (this->action == ACTION_INFO ||
 	   this->action == ACTION_LOCATION ||
@@ -259,6 +272,11 @@ options_base::check_actions ()
       // Something went wrong
       this->load_chroots = this->load_sessions = false;
       this->all = this->all_chroots = this->all_sessions = false;
-      throw opt::validation_error(_("Unknown action specified"));
+      throw opt::validation_error
+	(
+#ifndef BOOST_PROGRAM_OPTIONS_VALIDATION_ERROR_OLD
+	 opt::validation_error::invalid_option,
+#endif
+	 _("Unknown action specified"));
     }
 }
diff --git a/configure.ac b/configure.ac
index 0bc7491..883d6a2 100644
--- a/configure.ac
+++ b/configure.ac
@@ -563,6 +563,30 @@ if test "$BOOST_PROGRAM_OPTIONS_DESCRIPTION_METHODS" = "old"; then
   AC_DEFINE(BOOST_PROGRAM_OPTIONS_DESCRIPTION_OLD, 1)
 fi
 
+AC_MSG_CHECKING([for boost::program_options::validation_error in -lboost_program_options])
+saved_LIBS="${LIBS}"
+LIBS="${saved_LIBS} -lboost_program_options"
+define([boost_error], [AC_LANG_PROGRAM([#include <boost/program_options.hpp>],
+                                   [boost::program_options::validation_error err(boost::program_options::validation_error::invalid_option, "error");
+])])
+define([boost_error_old], [AC_LANG_PROGRAM([#include <boost/program_options.hpp>],
+                                   [boost::program_options::validation_error err("error");
+])])
+AC_LINK_IFELSE(boost_error,
+               [AC_MSG_RESULT([yes (Boost >= 1.42)])
+                BOOST_PROGRAM_OPTIONS_VALIDATION_ERROR="current"],
+LIBS="${saved_LIBS} -lboost_program_options"
+[AC_LINK_IFELSE(boost_error_old,
+               [AC_MSG_RESULT([yes (Boost < 1.42)])
+                BOOST_PROGRAM_OPTIONS_VALIDATION_ERROR="old"],
+               [AC_MSG_RESULT([no])
+	        AC_MSG_FAILURE([libboost_program_options (Boost C++ Libraries) is not installed, but is required by schroot])])])
+LIBS="${saved_LIBS}"
+AH_TEMPLATE(BOOST_PROGRAM_OPTIONS_VALIDATION_ERROR_OLD, [Set if boost::program_options::validation error uses old construction semantics])
+if test "$BOOST_PROGRAM_OPTIONS_VALIDATION_ERROR" = "old"; then
+  AC_DEFINE(BOOST_PROGRAM_OPTIONS_VALIDATION_ERROR_OLD, 1)
+fi
+
 AC_MSG_CHECKING([for boost::regex in -lboost_regex])
 saved_LIBS="${LIBS}"
 LIBS="${saved_LIBS} -lboost_regex"

Attachment: signature.asc
Description: Digital signature

Reply via email to