csbuild-options.cc

Go to the documentation of this file.
00001 /* Copyright © 2005-2007  Roger Leigh <rleigh@debian.org>
00002  *
00003  * schroot is free software: you can redistribute it and/or modify it
00004  * under the terms of the GNU General Public License as published by
00005  * the Free Software Foundation, either version 3 of the License, or
00006  * (at your option) any later version.
00007  *
00008  * schroot is distributed in the hope that it will be useful, but
00009  * WITHOUT ANY WARRANTY; without even the implied warranty of
00010  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00011  * General Public License for more details.
00012  *
00013  * You should have received a copy of the GNU General Public License
00014  * along with this program.  If not, see
00015  * <http://www.gnu.org/licenses/>.
00016  *
00017  *********************************************************************/
00018 
00019 #include <config.h>
00020 
00021 #include <sbuild/sbuild-i18n.h>
00022 
00023 #include "csbuild-options.h"
00024 
00025 #include <cstdlib>
00026 #include <iostream>
00027 
00028 #include <boost/format.hpp>
00029 #include <boost/program_options.hpp>
00030 
00031 using std::endl;
00032 using boost::format;
00033 using sbuild::string_list;
00034 using sbuild::_;
00035 namespace opt = boost::program_options;
00036 using namespace csbuild;
00037 
00038 const options::action_type options::ACTION_BUILD ("build");
00039 
00040 options::options ():
00041   schroot_base::options(),
00042   build(_("Build options")),
00043   user(_("User options")),
00044   special(_("Special options"))
00045 {
00046 }
00047 
00048 options::~options ()
00049 {
00050 }
00051 
00052 void
00053 options::add_options ()
00054 {
00055   // Chain up to add basic options.
00056   schroot_base::options::add_options();
00057 
00058   action.add(ACTION_BUILD);
00059   action.set_default(ACTION_BUILD);
00060 
00061   actions.add_options()
00062     ("build",
00063      _("Build source packages (default)"));
00064 
00065   general.add_options()
00066     ("nolog,n", opt::value<bool>(&this->nolog),
00067      _("Don't log program output"));
00068 
00069   build.add_options()
00070     ("distribution,d", opt::value<std::string>(&this->distribution),
00071      _("Distribution to build for"))
00072     ("arch-all,A", opt::value<bool>(&this->build_arch_all),
00073      _("Build architecture \"all\" packages"))
00074     ("source,s", opt::value<bool>(&this->build_source),
00075      _("Build a source package"))
00076     ("force-orig-source,f", opt::value<bool>(&this->force_orig_source),
00077      _("Force building of a source package, irrespective of Debian version"))
00078     ("binary-nmu,B", opt::value<bool>(&this->bin_nmu),
00079      _("Make a binary non-maintainer upload"))
00080     ("purge,p", opt::value<std::string>(&this->purge_string),
00081      _("Purge mode"));
00082 
00083   user.add_options()
00084     ("keyid,k", opt::value<std::string>(&this->keyid),
00085      _("GPG key identifier"))
00086     ("maintainer,m", opt::value<std::string>(&this->maintainer),
00087      _("Package maintainer"))
00088     ("uploader,u", opt::value<std::string>(&this->uploader),
00089      _("Package uploader"));
00090 
00091 
00092   special.add_options()
00093     ("add-depends", opt::value<string_list>(&this->additional_dependencies),
00094      _("Add a build dependency"))
00095     ("force-depends", opt::value<string_list>(&this->forced_dependencies),
00096      _("Force a build dependency"))
00097     ("gcc-snapshot,G", opt::value<bool>(&this->gcc_snapshot),
00098      _("Build using the current GCC development snapshot"));
00099 
00100 
00101 }
00102 
00103 void
00104 options::add_option_groups ()
00105 {
00106   // Chain up to add basic option groups.
00107   schroot_base::options::add_option_groups();
00108 
00109   visible.add(build);
00110   global.add(build);
00111 
00112   visible.add(user);
00113   global.add(user);
00114 
00115   visible.add(special);
00116   global.add(special);
00117 }
00118 
00119 void
00120 options::check_options ()
00121 {
00122   // Chain up to check basic options.
00123   schroot_base::options::check_options();
00124 
00125   if (vm.count("build"))
00126     this->action = ACTION_BUILD;
00127 }

Generated on Mon Jan 21 00:38:28 2008 for schroot by  doxygen 1.5.4