00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
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
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
00070
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);
00098
00099 return EXIT_SUCCESS;
00100 }