1 | /* Copyright © 2005-2007 Roger Leigh <rleigh@debian.org> |
---|
2 | * |
---|
3 | * schroot is free software: you can redistribute it and/or modify it |
---|
4 | * under the terms of the GNU General Public License as published by |
---|
5 | * the Free Software Foundation, either version 3 of the License, or |
---|
6 | * (at your option) any later version. |
---|
7 | * |
---|
8 | * schroot is distributed in the hope that it will be useful, but |
---|
9 | * WITHOUT ANY WARRANTY; without even the implied warranty of |
---|
10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
---|
11 | * General Public License for more details. |
---|
12 | * |
---|
13 | * You should have received a copy of the GNU General Public License |
---|
14 | * along with this program. If not, see |
---|
15 | * <http://www.gnu.org/licenses/>. |
---|
16 | * |
---|
17 | *********************************************************************/ |
---|
18 | |
---|
19 | #ifndef CSBUILD_MAIN_H |
---|
20 | #define CSBUILD_MAIN_H |
---|
21 | |
---|
22 | #include <csbuild/csbuild-options.h> |
---|
23 | |
---|
24 | #include <schroot-base/schroot-base-main.h> |
---|
25 | |
---|
26 | #include <sbuild/sbuild-custom-error.h> |
---|
27 | |
---|
28 | namespace csbuild |
---|
29 | { |
---|
30 | |
---|
31 | /** |
---|
32 | * Frontend for schroot. This class is used to "run" schroot. |
---|
33 | */ |
---|
34 | class main : public schroot_base::main |
---|
35 | { |
---|
36 | public: |
---|
37 | /// Error codes. |
---|
38 | enum error_code |
---|
39 | { |
---|
40 | DEVICE_NOTBLOCK, ///< File is not a block device. |
---|
41 | DEVICE_OWNED, ///< Failed to release device lock (lock held by PID). |
---|
42 | DEVICE_RELEASE, ///< Failed to release device lock. |
---|
43 | DEVICE_STAT ///< Failed to stat device. |
---|
44 | }; |
---|
45 | |
---|
46 | /// Exception type. |
---|
47 | typedef sbuild::custom_error<error_code> error; |
---|
48 | |
---|
49 | /** |
---|
50 | * The constructor. |
---|
51 | * |
---|
52 | * @param options the command-line options to use. |
---|
53 | */ |
---|
54 | main (options::ptr& options); |
---|
55 | |
---|
56 | /// The destructor. |
---|
57 | virtual ~main (); |
---|
58 | |
---|
59 | /** |
---|
60 | * Build packages. |
---|
61 | */ |
---|
62 | virtual void |
---|
63 | action_build (); |
---|
64 | |
---|
65 | /** |
---|
66 | * Run the program. |
---|
67 | * |
---|
68 | * @returns 0 on success, 1 on failure or the exit status of the |
---|
69 | * chroot command. |
---|
70 | */ |
---|
71 | virtual int |
---|
72 | run_impl (); |
---|
73 | |
---|
74 | /// The program options. |
---|
75 | options::ptr opts; |
---|
76 | }; |
---|
77 | |
---|
78 | } |
---|
79 | |
---|
80 | #endif /* CSBUILD_MAIN_H */ |
---|
81 | |
---|
82 | /* |
---|
83 | * Local Variables: |
---|
84 | * mode:C++ |
---|
85 | * End: |
---|
86 | */ |
---|