1
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
2
<html><head><meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1">
3
<title>schroot: sbuild/sbuild-run-parts.h Source File</title>
4
<link href="doxygen.css" rel="stylesheet" type="text/css">
5
<link href="tabs.css" rel="stylesheet" type="text/css">
7
<!-- Generated by Doxygen 1.4.7 -->
10
<li><a href="index.html"><span>Main Page</span></a></li>
11
<li><a href="namespaces.html"><span>Namespaces</span></a></li>
12
<li><a href="annotated.html"><span>Classes</span></a></li>
13
<li id="current"><a href="files.html"><span>Files</span></a></li>
14
<li><a href="dirs.html"><span>Directories</span></a></li>
18
<li><a href="files.html"><span>File List</span></a></li>
19
<li><a href="globals.html"><span>File Members</span></a></li>
22
<a class="el" href="dir_5769d7dd62c6719d79ec5ec7998dae58.html">sbuild</a></div>
23
<h1>sbuild-run-parts.h</h1><a href="sbuild-run-parts_8h.html">Go to the documentation of this file.</a><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="comment">/* Copyright © 2005-2006 Roger Leigh <rleigh@debian.org></span>
24
<a name="l00002"></a>00002 <span class="comment"> *</span>
25
<a name="l00003"></a>00003 <span class="comment"> * schroot is free software; you can redistribute it and/or modify it</span>
26
<a name="l00004"></a>00004 <span class="comment"> * under the terms of the GNU General Public License as published by</span>
27
<a name="l00005"></a>00005 <span class="comment"> * the Free Software Foundation; either version 2 of the License, or</span>
28
<a name="l00006"></a>00006 <span class="comment"> * (at your option) any later version.</span>
29
<a name="l00007"></a>00007 <span class="comment"> *</span>
30
<a name="l00008"></a>00008 <span class="comment"> * schroot is distributed in the hope that it will be useful, but</span>
31
<a name="l00009"></a>00009 <span class="comment"> * WITHOUT ANY WARRANTY; without even the implied warranty of</span>
32
<a name="l00010"></a>00010 <span class="comment"> * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU</span>
33
<a name="l00011"></a>00011 <span class="comment"> * General Public License for more details.</span>
34
<a name="l00012"></a>00012 <span class="comment"> *</span>
35
<a name="l00013"></a>00013 <span class="comment"> * You should have received a copy of the GNU General Public License</span>
36
<a name="l00014"></a>00014 <span class="comment"> * along with this program; if not, write to the Free Software</span>
37
<a name="l00015"></a>00015 <span class="comment"> * Foundation, Inc., 59 Temple Place, Suite 330, Boston,</span>
38
<a name="l00016"></a>00016 <span class="comment"> * MA 02111-1307 USA</span>
39
<a name="l00017"></a>00017 <span class="comment"> *</span>
40
<a name="l00018"></a>00018 <span class="comment"> *********************************************************************/</span>
41
<a name="l00019"></a>00019
42
<a name="l00020"></a>00020 <span class="preprocessor">#ifndef SBUILD_RUN_PARTS_H</span>
43
<a name="l00021"></a>00021 <span class="preprocessor"></span><span class="preprocessor">#define SBUILD_RUN_PARTS_H</span>
44
<a name="l00022"></a>00022 <span class="preprocessor"></span>
45
<a name="l00023"></a>00023 <span class="preprocessor">#include <<a class="code" href="sbuild-custom-error_8h.html">sbuild/sbuild-custom-error.h</a>></span>
46
<a name="l00024"></a>00024 <span class="preprocessor">#include <<a class="code" href="sbuild-environment_8h.html">sbuild/sbuild-environment.h</a>></span>
47
<a name="l00025"></a>00025 <span class="preprocessor">#include <<a class="code" href="sbuild-types_8h.html">sbuild/sbuild-types.h</a>></span>
48
<a name="l00026"></a>00026
49
<a name="l00027"></a>00027 <span class="preprocessor">#include <set></span>
50
<a name="l00028"></a>00028 <span class="preprocessor">#include <string></span>
51
<a name="l00029"></a>00029
52
<a name="l00030"></a>00030 <span class="preprocessor">#include <sys/types.h></span>
53
<a name="l00031"></a>00031 <span class="preprocessor">#include <sys/stat.h></span>
54
<a name="l00032"></a>00032
55
<a name="l00033"></a>00033 <span class="keyword">namespace </span>sbuild
56
<a name="l00034"></a>00034 {
57
<a name="l00035"></a>00035
58
<a name="l00039"></a><a class="code" href="classsbuild_1_1run__parts.html">00039</a> <span class="keyword">class </span><a class="code" href="classsbuild_1_1run__parts.html">run_parts</a>
59
<a name="l00040"></a>00040 {
60
<a name="l00041"></a>00041 <span class="keyword">public</span>:
61
<a name="l00043"></a><a class="code" href="classsbuild_1_1run__parts.html#4a9327c8eadc1936c9c06a4fd3698e04">00043</a> <span class="keyword">enum</span> <a class="code" href="classsbuild_1_1run__parts.html#4a9327c8eadc1936c9c06a4fd3698e04">error_code</a>
62
<a name="l00044"></a>00044 {
63
<a name="l00045"></a>00045 <a class="code" href="classsbuild_1_1run__parts.html#4a9327c8eadc1936c9c06a4fd3698e04af2ca23844af35838d41cbdae9569274">CHILD_FORK</a>,
64
<a name="l00046"></a>00046 <a class="code" href="classsbuild_1_1run__parts.html#4a9327c8eadc1936c9c06a4fd3698e049c84bb2e9024b5f18d2acbc868bc5ded">CHILD_WAIT</a>,
65
<a name="l00047"></a><a class="code" href="classsbuild_1_1run__parts.html#4a9327c8eadc1936c9c06a4fd3698e0495bda5782d115266dc4d85a36d008081">00047</a> <a class="code" href="classsbuild_1_1run__parts.html#4a9327c8eadc1936c9c06a4fd3698e0495bda5782d115266dc4d85a36d008081">EXEC</a>
66
<a name="l00048"></a>00048 };
67
<a name="l00049"></a>00049
68
<a name="l00051"></a><a class="code" href="classsbuild_1_1run__parts.html#0c5cadcd9dce5b26f1596efef06ff0ae">00051</a> <span class="keyword">typedef</span> <a class="code" href="classsbuild_1_1custom__error.html">custom_error<error_code></a> <a class="code" href="classsbuild_1_1custom__error.html">error</a>;
69
<a name="l00052"></a>00052
70
<a name="l00054"></a>00054 <a class="code" href="classsbuild_1_1run__parts.html#f42f73f70bb309c35cb71b50654c6e0d">run_parts</a> (std::string <span class="keyword">const</span>& <a class="code" href="classsbuild_1_1run__parts.html#a274a9c951462601b3008c685f633ffe">directory</a>,
71
<a name="l00055"></a>00055 <span class="keywordtype">bool</span> <a class="code" href="classsbuild_1_1run__parts.html#110590b6f2d494ced7ae3152f5e0482b">lsb_mode</a> = <span class="keyword">true</span>,
72
<a name="l00056"></a>00056 <span class="keywordtype">bool</span> <a class="code" href="classsbuild_1_1run__parts.html#0fb540198949669fa7f55fd2bff50c90">abort_on_error</a> = <span class="keyword">true</span>,
73
<a name="l00057"></a>00057 mode_t <a class="code" href="classsbuild_1_1run__parts.html#609f6f4a61a5d15851eb6f074ed74b3c">umask</a> = 022);
74
<a name="l00058"></a>00058
75
<a name="l00060"></a>00060 <a class="code" href="classsbuild_1_1run__parts.html#4492bf90d8680c598d3d1b7b80cc0df9">~run_parts</a> ();
76
<a name="l00061"></a>00061
77
<a name="l00067"></a>00067 <span class="keywordtype">bool</span>
78
<a name="l00068"></a>00068 <a class="code" href="classsbuild_1_1run__parts.html#5bb65ff153e452136f8435fe232a023b">get_verbose</a> () <span class="keyword">const</span>;
79
<a name="l00069"></a>00069
80
<a name="l00075"></a>00075 <span class="keywordtype">void</span>
81
<a name="l00076"></a>00076 <a class="code" href="classsbuild_1_1run__parts.html#b01aa9e4a6c62413c2af2876dd1f1beb">set_verbose</a> (<span class="keywordtype">bool</span> <a class="code" href="classsbuild_1_1run__parts.html#eab6414ec07281cb6c5b58f60c0d23e0">verbose</a>);
82
<a name="l00077"></a>00077
83
<a name="l00083"></a>00083 <span class="keywordtype">bool</span>
84
<a name="l00084"></a>00084 <a class="code" href="classsbuild_1_1run__parts.html#9d37e5d0c50f00a3206d3eb8b4869e8e">get_reverse</a> () <span class="keyword">const</span>;
85
<a name="l00085"></a>00085
86
<a name="l00091"></a>00091 <span class="keywordtype">void</span>
87
<a name="l00092"></a>00092 <a class="code" href="classsbuild_1_1run__parts.html#470f2cf23128071df0cf47b8907e4e0c">set_reverse</a> (<span class="keywordtype">bool</span> <a class="code" href="classsbuild_1_1run__parts.html#91e517dd8d186f8fafc8d28997b530ba">reverse</a>);
88
<a name="l00093"></a>00093
89
<a name="l00094"></a>00094 <span class="keywordtype">int</span>
90
<a name="l00095"></a>00095 <a class="code" href="classsbuild_1_1run__parts.html#b7f81115b974b0cc182e39455501b052">run</a>(<a class="code" href="namespacesbuild.html#4268c3202ab4b20cbebf347a6d69393f">string_list</a> <span class="keyword">const</span>& command,
91
<a name="l00096"></a>00096 <a class="code" href="classsbuild_1_1environment.html">environment</a> <span class="keyword">const</span>& env);
92
<a name="l00097"></a>00097
93
<a name="l00098"></a>00098
94
<a name="l00106"></a>00106 <span class="keyword">template</span> <<span class="keyword">class</span> <span class="keywordtype">char</span>T, <span class="keyword">class</span> traits>
95
<a name="l00107"></a>00107 <span class="keyword">friend</span>
96
<a name="l00108"></a>00108 std::basic_ostream<charT,traits>&
97
<a name="l00109"></a><a class="code" href="classsbuild_1_1run__parts.html#17cb0bf5d1a6738446c020320068150f">00109</a> operator << (std::basic_ostream<charT,traits>& stream,
98
<a name="l00110"></a>00110 <a class="code" href="classsbuild_1_1run__parts.html">run_parts</a> <span class="keyword">const</span>& rhs)
99
<a name="l00111"></a>00111 {
100
<a name="l00112"></a>00112 <span class="keywordflow">if</span> (!rhs.reverse)
101
<a name="l00113"></a>00113 {
102
<a name="l00114"></a>00114 <span class="keywordflow">for</span> (program_set::const_iterator pos = rhs.programs.begin();
103
<a name="l00115"></a>00115 pos != rhs.programs.end();
104
<a name="l00116"></a>00116 ++pos)
105
<a name="l00117"></a>00117 stream << *pos << <span class="charliteral">'\n'</span>;
106
<a name="l00118"></a>00118 }
107
<a name="l00119"></a>00119 <span class="keywordflow">else</span>
108
<a name="l00120"></a>00120 {
109
<a name="l00121"></a>00121 <span class="keywordflow">for</span> (program_set::const_reverse_iterator pos = rhs.programs.rbegin();
110
<a name="l00122"></a>00122 pos != rhs.programs.rend();
111
<a name="l00123"></a>00123 ++pos)
112
<a name="l00124"></a>00124 stream << *pos << <span class="charliteral">'\n'</span>;
113
<a name="l00125"></a>00125 }
114
<a name="l00126"></a>00126 <span class="keywordflow">return</span> stream;
115
<a name="l00127"></a>00127 }
116
<a name="l00128"></a>00128
117
<a name="l00129"></a>00129 <span class="keyword">private</span>:
118
<a name="l00130"></a>00130 <span class="keywordtype">int</span>
119
<a name="l00131"></a>00131 <a class="code" href="classsbuild_1_1run__parts.html#34e33e82b352ca2f7e6d8b42f20c9e62">run_child</a>(std::string <span class="keyword">const</span>& file,
120
<a name="l00132"></a>00132 <a class="code" href="namespacesbuild.html#4268c3202ab4b20cbebf347a6d69393f">string_list</a> <span class="keyword">const</span>& command,
121
<a name="l00133"></a>00133 <a class="code" href="classsbuild_1_1environment.html">environment</a> <span class="keyword">const</span>& env);
122
<a name="l00134"></a>00134
123
<a name="l00135"></a>00135 <span class="keywordtype">void</span>
124
<a name="l00136"></a>00136 <a class="code" href="classsbuild_1_1run__parts.html#3a82f0e167a3ead5a4d8b3d40c99aab9">wait_for_child</a> (pid_t pid,
125
<a name="l00137"></a>00137 <span class="keywordtype">int</span>& child_status);
126
<a name="l00138"></a>00138
127
<a name="l00139"></a>00139 <span class="keywordtype">bool</span>
128
<a name="l00140"></a>00140 <a class="code" href="classsbuild_1_1run__parts.html#c50a6f72fd4e90eb40fb7ca24df43194">check_filename</a> (std::string <span class="keyword">const</span>& name);
129
<a name="l00141"></a>00141
130
<a name="l00142"></a><a class="code" href="classsbuild_1_1run__parts.html#7090f8350fef2a974bd5b01872e19f65">00142</a> <span class="keyword">typedef</span> std::set<std::string> <a class="code" href="classsbuild_1_1run__parts.html#7090f8350fef2a974bd5b01872e19f65">program_set</a>;
131
<a name="l00143"></a>00143
132
<a name="l00144"></a><a class="code" href="classsbuild_1_1run__parts.html#110590b6f2d494ced7ae3152f5e0482b">00144</a> <span class="keywordtype">bool</span> <a class="code" href="classsbuild_1_1run__parts.html#110590b6f2d494ced7ae3152f5e0482b">lsb_mode</a>;
133
<a name="l00145"></a><a class="code" href="classsbuild_1_1run__parts.html#0fb540198949669fa7f55fd2bff50c90">00145</a> <span class="keywordtype">bool</span> <a class="code" href="classsbuild_1_1run__parts.html#0fb540198949669fa7f55fd2bff50c90">abort_on_error</a>;
134
<a name="l00146"></a><a class="code" href="classsbuild_1_1run__parts.html#609f6f4a61a5d15851eb6f074ed74b3c">00146</a> mode_t <a class="code" href="classsbuild_1_1run__parts.html#609f6f4a61a5d15851eb6f074ed74b3c">umask</a>;
135
<a name="l00147"></a><a class="code" href="classsbuild_1_1run__parts.html#eab6414ec07281cb6c5b58f60c0d23e0">00147</a> <span class="keywordtype">bool</span> <a class="code" href="classsbuild_1_1run__parts.html#eab6414ec07281cb6c5b58f60c0d23e0">verbose</a>;
136
<a name="l00148"></a><a class="code" href="classsbuild_1_1run__parts.html#91e517dd8d186f8fafc8d28997b530ba">00148</a> <span class="keywordtype">bool</span> <a class="code" href="classsbuild_1_1run__parts.html#91e517dd8d186f8fafc8d28997b530ba">reverse</a>;
137
<a name="l00149"></a>00149 <span class="comment">// bool restricted;</span>
138
<a name="l00150"></a><a class="code" href="classsbuild_1_1run__parts.html#a274a9c951462601b3008c685f633ffe">00150</a> std::string <a class="code" href="classsbuild_1_1run__parts.html#a274a9c951462601b3008c685f633ffe">directory</a>;
139
<a name="l00151"></a><a class="code" href="classsbuild_1_1run__parts.html#cfd014bae60c266e27fe459a7031be89">00151</a> <a class="code" href="classsbuild_1_1run__parts.html#7090f8350fef2a974bd5b01872e19f65">program_set</a> <a class="code" href="classsbuild_1_1run__parts.html#cfd014bae60c266e27fe459a7031be89">programs</a>;
140
<a name="l00152"></a>00152 };
141
<a name="l00153"></a>00153
142
<a name="l00154"></a>00154 }
143
<a name="l00155"></a>00155
144
<a name="l00156"></a>00156 <span class="preprocessor">#endif </span><span class="comment">/* SBUILD_RUN_PARTS_H */</span>
145
<a name="l00157"></a>00157
146
<a name="l00158"></a>00158 <span class="comment">/*</span>
147
<a name="l00159"></a>00159 <span class="comment"> * Local Variables:</span>
148
<a name="l00160"></a>00160 <span class="comment"> * mode:C++</span>
149
<a name="l00161"></a>00161 <span class="comment"> * End:</span>
150
<a name="l00162"></a>00162 <span class="comment"> */</span>
151
</pre></div><hr size="1"><address style="align: right;"><small>Generated on Thu Jul 6 19:21:41 2006 for schroot by
152
<a href="http://www.doxygen.org/index.html">
153
<img src="doxygen.png" alt="doxygen" align="middle" border="0"></a> 1.4.7 </small></address>