csbuild-main.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 "csbuild-main.h"
00022 
00023 #include <cerrno>
00024 #include <cstdlib>
00025 #include <ctime>
00026 #include <iostream>
00027 #include <locale>
00028 
00029 #include <sys/types.h>
00030 #include <sys/stat.h>
00031 #include <unistd.h>
00032 
00033 #include <boost/format.hpp>
00034 
00035 using std::endl;
00036 using boost::format;
00037 using sbuild::_;
00038 using sbuild::N_;
00039 using namespace csbuild;
00040 
00041 namespace
00042 {
00043 
00044   typedef std::pair<main::error_code,const char *> emap;
00045 
00050   emap init_errors[] =
00051     {
00052       emap(main::DEVICE_NOTBLOCK, N_("File is not a block device")),
00053       // TRANSLATORS: %4% = integer process ID
00054       emap(main::DEVICE_OWNED,    N_("Failed to release device lock (lock held by PID %4%)")),
00055       emap(main::DEVICE_RELEASE,  N_("Failed to release device lock")),
00056       emap(main::DEVICE_STAT,     N_("Failed to stat device"))
00057 };
00058 
00059 }
00060 
00061 template<>
00062 sbuild::error<main::error_code>::map_type
00063 sbuild::error<main::error_code>::error_strings
00064 (init_errors,
00065  init_errors + (sizeof(init_errors) / sizeof(init_errors[0])));
00066 
00067 main::main (options::ptr& options):
00068   schroot_base::main("csbuild",
00069                      // TRANSLATORS: '...' is an ellipsis e.g. U+2026,
00070                      // and '-' is an em-dash.
00071                      _("[OPTION...] - build Debian packages from source"),
00072                      options,
00073                      false),
00074   opts(options)
00075 {
00076 }
00077 
00078 main::~main ()
00079 {
00080 }
00081 
00082 void
00083 main::action_build ()
00084 {
00085 }
00086 
00087 int
00088 main::run_impl ()
00089 {
00090   if (this->opts->action == options::ACTION_HELP)
00091     action_help(std::cerr);
00092   else if (this->opts->action == options::ACTION_VERSION)
00093     action_version(std::cerr);
00094   else if (this->opts->action == options::ACTION_BUILD)
00095     action_build();
00096   else
00097     assert(0); // Invalid action.
00098 
00099   return EXIT_SUCCESS;
00100 }

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