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 2 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, write to the Free Software
00015  * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
00016  * MA  02111-1307  USA
00017  *
00018  *********************************************************************/
00019 
00020 #include <config.h>
00021 
00022 #include <sbuild/sbuild-i18n.h>
00023 
00024 #include "csbuild-options.h"
00025 
00026 #include <cstdlib>
00027 #include <iostream>
00028 
00029 #include <boost/format.hpp>
00030 #include <boost/program_options.hpp>
00031 
00032 using std::endl;
00033 using boost::format;
00034 using sbuild::string_list;
00035 using sbuild::_;
00036 namespace opt = boost::program_options;
00037 using namespace csbuild;
00038 
00039 const options::action_type options::ACTION_BUILD ("build");
00040 
00041 options::options ():
00042   schroot_base::options(),
00043   build(_("Build options")),
00044   user(_("User options")),
00045   special(_("Special options"))
00046 {
00047 }
00048 
00049 options::~options ()
00050 {
00051 }
00052 
00053 void
00054 options::add_options ()
00055 {
00056   // Chain up to add basic options.
00057   schroot_base::options::add_options();
00058 
00059   action.add(ACTION_BUILD);
00060   action.set_default(ACTION_BUILD);
00061 
00062   actions.add_options()
00063     ("build",
00064      _("Build source packages (default)"));
00065 
00066   general.add_options()
00067     ("nolog,n", opt::value<bool>(&this->nolog),
00068      _("Don't log program output"));
00069 
00070   build.add_options()
00071     ("distribution,d", opt::value<std::string>(&this->distribution),
00072      _("Distribution to build for"))
00073     ("arch-all,A", opt::value<bool>(&this->build_arch_all),
00074      _("Build architecture \"all\" packages"))
00075     ("source,s", opt::value<bool>(&this->build_source),
00076      _("Build a source package"))
00077     ("force-orig-source,f", opt::value<bool>(&this->force_orig_source),
00078      _("Force building of a source package, irrespective of Debian version"))
00079     ("binary-nmu,B", opt::value<bool>(&this->bin_nmu),
00080      _("Make a binary non-maintainer upload"))
00081     ("purge,p", opt::value<std::string>(&this->purge_string),
00082      _("Purge mode"));
00083 
00084   user.add_options()
00085     ("keyid,k", opt::value<std::string>(&this->keyid),
00086      _("GPG key identifier"))
00087     ("maintainer,m", opt::value<std::string>(&this->maintainer),
00088      _("Package maintainer"))
00089     ("uploader,u", opt::value<std::string>(&this->uploader),
00090      _("Package uploader"));
00091 
00092 
00093   special.add_options()
00094     ("add-depends", opt::value<string_list>(&this->additional_dependencies),
00095      _("Add a build dependency"))
00096     ("force-depends", opt::value<string_list>(&this->forced_dependencies),
00097      _("Force a build dependency"))
00098     ("gcc-snapshot,G", opt::value<bool>(&this->gcc_snapshot),
00099      _("Build using the current GCC development snapshot"));
00100 
00101 
00102 }
00103 
00104 void
00105 options::add_option_groups ()
00106 {
00107   // Chain up to add basic option groups.
00108   schroot_base::options::add_option_groups();
00109 
00110   visible.add(build);
00111   global.add(build);
00112 
00113   visible.add(user);
00114   global.add(user);
00115 
00116   visible.add(special);
00117   global.add(special);
00118 }
00119 
00120 void
00121 options::check_options ()
00122 {
00123   // Chain up to check basic options.
00124   schroot_base::options::check_options();
00125 
00126   if (vm.count("build"))
00127     this->action = ACTION_BUILD;
00128 }

Generated on Sun Jul 8 21:23:54 2007 for schroot by  doxygen 1.5.2