36
30
<a name="l00011"></a>00011 <span class="comment"> * General Public License for more details.</span>
37
31
<a name="l00012"></a>00012 <span class="comment"> *</span>
38
32
<a name="l00013"></a>00013 <span class="comment"> * You should have received a copy of the GNU General Public License</span>
39
<a name="l00014"></a>00014 <span class="comment"> * along with this program; if not, write to the Free Software</span>
40
<a name="l00015"></a>00015 <span class="comment"> * Foundation, Inc., 59 Temple Place, Suite 330, Boston,</span>
41
<a name="l00016"></a>00016 <span class="comment"> * MA 02111-1307 USA</span>
42
<a name="l00017"></a>00017 <span class="comment"> *</span>
43
<a name="l00018"></a>00018 <span class="comment"> *********************************************************************/</span>
44
<a name="l00019"></a>00019
45
<a name="l00020"></a>00020 <span class="preprocessor">#include <config.h></span>
46
<a name="l00021"></a>00021
47
<a name="l00022"></a>00022 <span class="preprocessor">#include "<a class="code" href="csbuild-main_8h.html">csbuild-main.h</a>"</span>
48
<a name="l00023"></a>00023
49
<a name="l00024"></a>00024 <span class="preprocessor">#include <cerrno></span>
50
<a name="l00025"></a>00025 <span class="preprocessor">#include <cstdlib></span>
51
<a name="l00026"></a>00026 <span class="preprocessor">#include <ctime></span>
52
<a name="l00027"></a>00027 <span class="preprocessor">#include <iostream></span>
53
<a name="l00028"></a>00028 <span class="preprocessor">#include <locale></span>
54
<a name="l00029"></a>00029
55
<a name="l00030"></a>00030 <span class="preprocessor">#include <sys/types.h></span>
56
<a name="l00031"></a>00031 <span class="preprocessor">#include <sys/stat.h></span>
57
<a name="l00032"></a>00032 <span class="preprocessor">#include <unistd.h></span>
58
<a name="l00033"></a>00033
59
<a name="l00034"></a>00034 <span class="preprocessor">#include <boost/format.hpp></span>
60
<a name="l00035"></a>00035
61
<a name="l00036"></a>00036 <span class="keyword">using</span> std::endl;
62
<a name="l00037"></a>00037 <span class="keyword">using</span> boost::format;
63
<a name="l00038"></a>00038 <span class="keyword">using</span> sbuild::_;
64
<a name="l00039"></a>00039 <span class="keyword">using</span> sbuild::N_;
65
<a name="l00040"></a>00040 <span class="keyword">using namespace </span>csbuild;
66
<a name="l00041"></a>00041
67
<a name="l00042"></a>00042 <span class="keyword">namespace</span>
68
<a name="l00043"></a>00043 {
69
<a name="l00044"></a>00044
70
<a name="l00045"></a><a class="code" href="csbuild-main_8cc.html#7a38cdc9df52b3ddd266f28f3eeeaebb">00045</a> <span class="keyword">typedef</span> std::pair<main::error_code,const char *> <a class="code" href="schroot-main-base_8cc.html#72aa327d5cb9959ed40cdff3ddde9e25">emap</a>;
71
<a name="l00046"></a>00046
72
<a name="l00051"></a><a class="code" href="csbuild-main_8cc.html#f57f373df7f7c9fb0efae6da23690016">00051</a> emap <a class="code" href="schroot-main-base_8cc.html#f57f373df7f7c9fb0efae6da23690016" title="This is a list of the supported error codes.">init_errors</a>[] =
73
<a name="l00052"></a>00052 {
74
<a name="l00053"></a>00053 <a class="code" href="schroot-main-base_8cc.html#72aa327d5cb9959ed40cdff3ddde9e25">emap</a>(main::DEVICE_NOTBLOCK, N_(<span class="stringliteral">"File is not a block device"</span>)),
75
<a name="l00054"></a>00054 <span class="comment">// TRANSLATORS: %4% = integer process ID</span>
76
<a name="l00055"></a>00055 <a class="code" href="schroot-main-base_8cc.html#72aa327d5cb9959ed40cdff3ddde9e25">emap</a>(main::DEVICE_OWNED, N_(<span class="stringliteral">"Failed to release device lock (lock held by PID %4%)"</span>)),
77
<a name="l00056"></a>00056 <a class="code" href="schroot-main-base_8cc.html#72aa327d5cb9959ed40cdff3ddde9e25">emap</a>(main::DEVICE_RELEASE, N_(<span class="stringliteral">"Failed to release device lock"</span>)),
78
<a name="l00057"></a>00057 <a class="code" href="schroot-main-base_8cc.html#72aa327d5cb9959ed40cdff3ddde9e25">emap</a>(main::DEVICE_STAT, N_(<span class="stringliteral">"Failed to stat device"</span>))
79
<a name="l00058"></a>00058 };
80
<a name="l00059"></a>00059
81
<a name="l00060"></a>00060 }
82
<a name="l00061"></a>00061
83
<a name="l00062"></a>00062 <span class="keyword">template</span><>
84
<a name="l00063"></a>00063 <a class="codeRef" doxygen="sbuild.tag:/tmp/sr/schroot-1.1.5/doc/sbuild/html/" href="/tmp/sr/schroot-1.1.5/doc/sbuild/html/classsbuild_1_1error.html">sbuild::error<main::error_code>::map_type</a>
85
<a name="l00064"></a>00064 <a class="codeRef" doxygen="sbuild.tag:/tmp/sr/schroot-1.1.5/doc/sbuild/html/" href="/tmp/sr/schroot-1.1.5/doc/sbuild/html/classsbuild_1_1error.html#3ebc06008ada3b65bf2b25ce06b2926a">sbuild::error<main::error_code>::error_strings</a>
86
<a name="l00065"></a>00065 (<a class="code" href="schroot-main-base_8cc.html#f57f373df7f7c9fb0efae6da23690016" title="This is a list of the supported error codes.">init_errors</a>,
87
<a name="l00066"></a>00066 <a class="code" href="schroot-main-base_8cc.html#f57f373df7f7c9fb0efae6da23690016" title="This is a list of the supported error codes.">init_errors</a> + (<span class="keyword">sizeof</span>(<a class="code" href="schroot-main-base_8cc.html#f57f373df7f7c9fb0efae6da23690016" title="This is a list of the supported error codes.">init_errors</a>) / <span class="keyword">sizeof</span>(init_errors[0])));
88
<a name="l00067"></a>00067
89
<a name="l00068"></a><a class="code" href="classcsbuild_1_1main.html#e677b87c3fb420faf53007994ac8b6af">00068</a> <a class="code" href="schroot_8cc.html#0ddf1224851353fc92bfbff6f499fa97" title="Main routine.">main::main</a> (options::ptr& <a class="code" href="classcsbuild_1_1options.html" title="csbuild command-line options.">options</a>):
90
<a name="l00069"></a>00069 schroot_base::<a class="code" href="classcsbuild_1_1main.html" title="Frontend for schroot.">main</a>(<span class="stringliteral">"csbuild"</span>,
91
<a name="l00070"></a>00070 <span class="comment">// TRANSLATORS: '...' is an ellipsis e.g. U+2026,</span>
92
<a name="l00071"></a>00071 <span class="comment">// and '-' is an em-dash.</span>
93
<a name="l00072"></a>00072 _(<span class="stringliteral">"[OPTION...] - build Debian packages from source"</span>),
94
<a name="l00073"></a>00073 options,
95
<a name="l00074"></a>00074 false),
96
<a name="l00075"></a>00075 opts(options)
97
<a name="l00076"></a>00076 {
98
<a name="l00077"></a>00077 }
99
<a name="l00078"></a>00078
100
<a name="l00079"></a><a class="code" href="classcsbuild_1_1main.html#4444e261c1a635e1aab12e00e5b95f5a">00079</a> <a class="code" href="classcsbuild_1_1main.html#4444e261c1a635e1aab12e00e5b95f5a" title="The destructor.">main::~main</a> ()
101
<a name="l00080"></a>00080 {
102
<a name="l00081"></a>00081 }
103
<a name="l00082"></a>00082
104
<a name="l00083"></a>00083 <span class="keywordtype">void</span>
105
<a name="l00084"></a><a class="code" href="classcsbuild_1_1main.html#47cfafd4f80428f52d1461919aae453f">00084</a> <a class="code" href="classcsbuild_1_1main.html#47cfafd4f80428f52d1461919aae453f" title="Build packages.">main::action_build</a> ()
106
<a name="l00085"></a>00085 {
107
<a name="l00086"></a>00086 }
108
<a name="l00087"></a>00087
109
<a name="l00088"></a>00088 <span class="keywordtype">int</span>
110
<a name="l00089"></a><a class="code" href="classcsbuild_1_1main.html#266e0d62ec45cb0c73b03d277205fe8a">00089</a> <a class="code" href="classcsbuild_1_1main.html#266e0d62ec45cb0c73b03d277205fe8a" title="Run the program.">main::run_impl</a> ()
111
<a name="l00090"></a>00090 {
112
<a name="l00091"></a>00091 <span class="keywordflow">if</span> (this->opts->action == <a class="code" href="classschroot__base_1_1options.html#4c1f304c9f30b5965dcb7bbf51554124" title="Display program help.">options::ACTION_HELP</a>)
113
<a name="l00092"></a>00092 <a class="code" href="classschroot__base_1_1main.html#4c246d8a2cedf030e094ffdee5a38553" title="Print help information.">action_help</a>(std::cerr);
114
<a name="l00093"></a>00093 <span class="keywordflow">else</span> <span class="keywordflow">if</span> (this->opts->action == <a class="code" href="classschroot__base_1_1options.html#1064a6609731fbc80abb0c849ff3a3f8" title="Display program version.">options::ACTION_VERSION</a>)
115
<a name="l00094"></a>00094 <a class="code" href="classschroot__base_1_1main.html#cd9c1d4d7c52a423eb929a4bb6f644e0" title="Print version information.">action_version</a>(std::cerr);
116
<a name="l00095"></a>00095 <span class="keywordflow">else</span> <span class="keywordflow">if</span> (this->opts->action == <a class="code" href="classcsbuild_1_1options.html#0d341b72be643c338b8991ead7542b25" title="Begin, run and end a session.">options::ACTION_BUILD</a>)
117
<a name="l00096"></a>00096 <a class="code" href="classcsbuild_1_1main.html#47cfafd4f80428f52d1461919aae453f" title="Build packages.">action_build</a>();
118
<a name="l00097"></a>00097 <span class="keywordflow">else</span>
119
<a name="l00098"></a>00098 assert(0); <span class="comment">// Invalid action.</span>
120
<a name="l00099"></a>00099
121
<a name="l00100"></a>00100 <span class="keywordflow">return</span> EXIT_SUCCESS;
122
<a name="l00101"></a>00101 }
123
</pre></div><hr size="1"><address style="text-align: right;"><small>Generated on Sun Jul 8 21:23:54 2007 for schroot by
33
<a name="l00014"></a>00014 <span class="comment"> * along with this program. If not, see</span>
34
<a name="l00015"></a>00015 <span class="comment"> * <http://www.gnu.org/licenses/>.</span>
35
<a name="l00016"></a>00016 <span class="comment"> *</span>
36
<a name="l00017"></a>00017 <span class="comment"> *********************************************************************/</span>
37
<a name="l00018"></a>00018
38
<a name="l00019"></a>00019 <span class="preprocessor">#include <config.h></span>
39
<a name="l00020"></a>00020
40
<a name="l00021"></a>00021 <span class="preprocessor">#include "<a class="code" href="csbuild-main_8h.html">csbuild-main.h</a>"</span>
41
<a name="l00022"></a>00022
42
<a name="l00023"></a>00023 <span class="preprocessor">#include <cerrno></span>
43
<a name="l00024"></a>00024 <span class="preprocessor">#include <cstdlib></span>
44
<a name="l00025"></a>00025 <span class="preprocessor">#include <ctime></span>
45
<a name="l00026"></a>00026 <span class="preprocessor">#include <iostream></span>
46
<a name="l00027"></a>00027 <span class="preprocessor">#include <locale></span>
47
<a name="l00028"></a>00028
48
<a name="l00029"></a>00029 <span class="preprocessor">#include <sys/types.h></span>
49
<a name="l00030"></a>00030 <span class="preprocessor">#include <sys/stat.h></span>
50
<a name="l00031"></a>00031 <span class="preprocessor">#include <unistd.h></span>
51
<a name="l00032"></a>00032
52
<a name="l00033"></a>00033 <span class="preprocessor">#include <boost/format.hpp></span>
53
<a name="l00034"></a>00034
54
<a name="l00035"></a>00035 <span class="keyword">using</span> std::endl;
55
<a name="l00036"></a>00036 <span class="keyword">using</span> boost::format;
56
<a name="l00037"></a>00037 <span class="keyword">using</span> sbuild::_;
57
<a name="l00038"></a>00038 <span class="keyword">using</span> sbuild::N_;
58
<a name="l00039"></a>00039 <span class="keyword">using namespace </span>csbuild;
59
<a name="l00040"></a>00040
60
<a name="l00041"></a>00041 <span class="keyword">namespace</span>
61
<a name="l00042"></a>00042 {
62
<a name="l00043"></a>00043
63
<a name="l00044"></a><a class="code" href="csbuild-main_8cc.html#7a38cdc9df52b3ddd266f28f3eeeaebb">00044</a> <span class="keyword">typedef</span> std::pair<main::error_code,const char *> <a class="codeRef" doxygen="sbuild.tag:/tmp/sb/schroot/doc/sbuild/html/" href="/tmp/sb/schroot/doc/sbuild/html/sbuild-auth-conv-tty_8cc.html#9a3145af4184baebb22d7e1061da7f6e">emap</a>;
64
<a name="l00045"></a>00045
65
<a name="l00050"></a><a class="code" href="csbuild-main_8cc.html#f57f373df7f7c9fb0efae6da23690016">00050</a> emap <a class="code" href="schroot-main-base_8cc.html#f57f373df7f7c9fb0efae6da23690016" title="This is a list of the supported error codes.">init_errors</a>[] =
66
<a name="l00051"></a>00051 {
67
<a name="l00052"></a>00052 <a class="code" href="schroot-main-base_8cc.html#72aa327d5cb9959ed40cdff3ddde9e25">emap</a>(main::DEVICE_NOTBLOCK, N_(<span class="stringliteral">"File is not a block device"</span>)),
68
<a name="l00053"></a>00053 <span class="comment">// TRANSLATORS: %4% = integer process ID</span>
69
<a name="l00054"></a>00054 <a class="code" href="schroot-main-base_8cc.html#72aa327d5cb9959ed40cdff3ddde9e25">emap</a>(main::DEVICE_OWNED, N_(<span class="stringliteral">"Failed to release device lock (lock held by PID %4%)"</span>)),
70
<a name="l00055"></a>00055 <a class="code" href="schroot-main-base_8cc.html#72aa327d5cb9959ed40cdff3ddde9e25">emap</a>(main::DEVICE_RELEASE, N_(<span class="stringliteral">"Failed to release device lock"</span>)),
71
<a name="l00056"></a>00056 <a class="code" href="schroot-main-base_8cc.html#72aa327d5cb9959ed40cdff3ddde9e25">emap</a>(main::DEVICE_STAT, N_(<span class="stringliteral">"Failed to stat device"</span>))
72
<a name="l00057"></a>00057 };
73
<a name="l00058"></a>00058
74
<a name="l00059"></a>00059 }
75
<a name="l00060"></a>00060
76
<a name="l00061"></a>00061 <span class="keyword">template</span><>
77
<a name="l00062"></a>00062 <a class="codeRef" doxygen="sbuild.tag:/tmp/sb/schroot/doc/sbuild/html/" href="/tmp/sb/schroot/doc/sbuild/html/classsbuild_1_1error.html">sbuild::error<main::error_code>::map_type</a>
78
<a name="l00063"></a>00063 <a class="codeRef" doxygen="sbuild.tag:/tmp/sb/schroot/doc/sbuild/html/" href="/tmp/sb/schroot/doc/sbuild/html/classsbuild_1_1error.html#3ebc06008ada3b65bf2b25ce06b2926a">sbuild::error<main::error_code>::error_strings</a>
79
<a name="l00064"></a>00064 (<a class="code" href="schroot-main-base_8cc.html#f57f373df7f7c9fb0efae6da23690016" title="This is a list of the supported error codes.">init_errors</a>,
80
<a name="l00065"></a>00065 <a class="code" href="schroot-main-base_8cc.html#f57f373df7f7c9fb0efae6da23690016" title="This is a list of the supported error codes.">init_errors</a> + (<span class="keyword">sizeof</span>(<a class="code" href="schroot-main-base_8cc.html#f57f373df7f7c9fb0efae6da23690016" title="This is a list of the supported error codes.">init_errors</a>) / <span class="keyword">sizeof</span>(<a class="code" href="schroot-main-base_8cc.html#f57f373df7f7c9fb0efae6da23690016" title="This is a list of the supported error codes.">init_errors</a>[0])));
81
<a name="l00066"></a>00066
82
<a name="l00067"></a><a class="code" href="classcsbuild_1_1main.html#e677b87c3fb420faf53007994ac8b6af">00067</a> <a class="code" href="schroot_8cc.html#0ddf1224851353fc92bfbff6f499fa97" title="Main routine.">main::main</a> (options::ptr& <a class="code" href="classcsbuild_1_1options.html" title="csbuild command-line options.">options</a>):
83
<a name="l00068"></a>00068 schroot_base::<a class="code" href="classcsbuild_1_1main.html" title="Frontend for schroot.">main</a>(<span class="stringliteral">"csbuild"</span>,
84
<a name="l00069"></a>00069 <span class="comment">// TRANSLATORS: '...' is an ellipsis e.g. U+2026,</span>
85
<a name="l00070"></a>00070 <span class="comment">// and '-' is an em-dash.</span>
86
<a name="l00071"></a>00071 _(<span class="stringliteral">"[OPTION...] - build Debian packages from source"</span>),
87
<a name="l00072"></a>00072 options,
88
<a name="l00073"></a>00073 false),
89
<a name="l00074"></a>00074 opts(options)
90
<a name="l00075"></a>00075 {
91
<a name="l00076"></a>00076 }
92
<a name="l00077"></a>00077
93
<a name="l00078"></a><a class="code" href="classcsbuild_1_1main.html#4444e261c1a635e1aab12e00e5b95f5a">00078</a> <a class="code" href="classcsbuild_1_1main.html#4444e261c1a635e1aab12e00e5b95f5a" title="The destructor.">main::~main</a> ()
94
<a name="l00079"></a>00079 {
95
<a name="l00080"></a>00080 }
96
<a name="l00081"></a>00081
97
<a name="l00082"></a>00082 <span class="keywordtype">void</span>
98
<a name="l00083"></a><a class="code" href="classcsbuild_1_1main.html#47cfafd4f80428f52d1461919aae453f">00083</a> <a class="code" href="classcsbuild_1_1main.html#47cfafd4f80428f52d1461919aae453f" title="Build packages.">main::action_build</a> ()
99
<a name="l00084"></a>00084 {
100
<a name="l00085"></a>00085 }
101
<a name="l00086"></a>00086
102
<a name="l00087"></a>00087 <span class="keywordtype">int</span>
103
<a name="l00088"></a><a class="code" href="classcsbuild_1_1main.html#266e0d62ec45cb0c73b03d277205fe8a">00088</a> <a class="code" href="classcsbuild_1_1main.html#266e0d62ec45cb0c73b03d277205fe8a" title="Run the program.">main::run_impl</a> ()
104
<a name="l00089"></a>00089 {
105
<a name="l00090"></a>00090 <span class="keywordflow">if</span> (this->opts->action == <a class="code" href="classschroot__base_1_1options.html#4c1f304c9f30b5965dcb7bbf51554124" title="Display program help.">options::ACTION_HELP</a>)
106
<a name="l00091"></a>00091 <a class="code" href="classschroot__base_1_1main.html#4c246d8a2cedf030e094ffdee5a38553" title="Print help information.">action_help</a>(std::cerr);
107
<a name="l00092"></a>00092 <span class="keywordflow">else</span> <span class="keywordflow">if</span> (this->opts->action == <a class="code" href="classschroot__base_1_1options.html#1064a6609731fbc80abb0c849ff3a3f8" title="Display program version.">options::ACTION_VERSION</a>)
108
<a name="l00093"></a>00093 <a class="code" href="classschroot__base_1_1main.html#cd9c1d4d7c52a423eb929a4bb6f644e0" title="Print version information.">action_version</a>(std::cerr);
109
<a name="l00094"></a>00094 <span class="keywordflow">else</span> <span class="keywordflow">if</span> (this->opts->action == <a class="code" href="classcsbuild_1_1options.html#0d341b72be643c338b8991ead7542b25" title="Begin, run and end a session.">options::ACTION_BUILD</a>)
110
<a name="l00095"></a>00095 <a class="code" href="classcsbuild_1_1main.html#47cfafd4f80428f52d1461919aae453f" title="Build packages.">action_build</a>();
111
<a name="l00096"></a>00096 <span class="keywordflow">else</span>
112
<a name="l00097"></a>00097 assert(0); <span class="comment">// Invalid action.</span>
113
<a name="l00098"></a>00098
114
<a name="l00099"></a>00099 <span class="keywordflow">return</span> EXIT_SUCCESS;
115
<a name="l00100"></a>00100 }
116
</pre></div><hr size="1"><address style="text-align: right;"><small>Generated on Mon Jan 21 00:38:28 2008 for schroot by
124
117
<a href="http://www.doxygen.org/index.html">
125
<img src="doxygen.png" alt="doxygen" align="middle" border="0"></a> 1.5.2 </small></address>
118
<img src="doxygen.png" alt="doxygen" align="middle" border="0"></a> 1.5.4 </small></address>