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

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