1 |
Signed-off-by: Brian Dolbec <dolsen@g.o> |
2 |
--- |
3 |
catalyst | 81 +++++++++++++++++++++++++++++++++++++--------------------------- |
4 |
1 file changed, 47 insertions(+), 34 deletions(-) |
5 |
|
6 |
diff --git a/catalyst b/catalyst |
7 |
index 0878ce4..2a9b75c 100755 |
8 |
--- a/catalyst |
9 |
+++ b/catalyst |
10 |
@@ -24,31 +24,33 @@ __version__="2.0.12.2" |
11 |
conf_values={} |
12 |
|
13 |
def usage(): |
14 |
- print "Usage catalyst [options] [-C variable=value...] [ -s identifier]" |
15 |
- print " -a --clear-autoresume clear autoresume flags" |
16 |
- print " -c --config use specified configuration file" |
17 |
- print " -C --cli catalyst commandline (MUST BE LAST OPTION)" |
18 |
- print " -d --debug enable debugging" |
19 |
- print " -f --file read specfile" |
20 |
- print " -F --fetchonly fetch files only" |
21 |
- print " -h --help print this help message" |
22 |
- print " -p --purge clear tmp dirs,package cache and autoresume flags" |
23 |
- print " -P --purgeonly clear tmp dirs,package cache and autoresume flags and exit" |
24 |
- print " -T --purgetmponly clear tmp dirs and autoresume flags and exit" |
25 |
- print " -s --snapshot generate a release snapshot" |
26 |
- print " -V --version display version information" |
27 |
- print " -v --verbose verbose output" |
28 |
- print |
29 |
- print "Usage examples:" |
30 |
- print |
31 |
- print "Using the commandline option (-C, --cli) to build a Portage snapshot:" |
32 |
- print "catalyst -C target=snapshot version_stamp=my_date" |
33 |
- print |
34 |
- print "Using the snapshot option (-s, --snapshot) to build a release snapshot:" |
35 |
- print "catalyst -s 20071121" |
36 |
- print |
37 |
- print "Using the specfile option (-f, --file) to build a stage target:" |
38 |
- print "catalyst -f stage1-specfile.spec" |
39 |
+ print """Usage catalyst [options] [-C variable=value...] [ -s identifier] |
40 |
+ -a --clear-autoresume clear autoresume flags |
41 |
+ -c --config use specified configuration file |
42 |
+ -C --cli catalyst commandline (MUST BE LAST OPTION) |
43 |
+ -d --debug enable debugging |
44 |
+ -f --file read specfile |
45 |
+ -F --fetchonly fetch files only |
46 |
+ -h --help print this help message |
47 |
+ -p --purge clear tmp dirs,package cache, autoresume flags |
48 |
+ -P --purgeonly clear tmp dirs,package cache, autoresume flags and exit |
49 |
+ -T --purgetmponly clear tmp dirs and autoresume flags and exit |
50 |
+ -s --snapshot generate a release snapshot |
51 |
+ -V --version display version information |
52 |
+ -v --verbose verbose output |
53 |
+ |
54 |
+Usage examples: |
55 |
+ |
56 |
+Using the commandline option (-C, --cli) to build a Portage snapshot: |
57 |
+catalyst -C target=snapshot version_stamp=my_date |
58 |
+ |
59 |
+Using the snapshot option (-s, --snapshot) to build a release snapshot: |
60 |
+catalyst -s 20071121" |
61 |
+ |
62 |
+Using the specfile option (-f, --file) to build a stage target: |
63 |
+catalyst -f stage1-specfile.spec |
64 |
+""" |
65 |
+ |
66 |
|
67 |
def version(): |
68 |
print "Catalyst, version "+__version__ |
69 |
@@ -78,7 +80,8 @@ def parse_config(myconfig): |
70 |
# first, try the one passed (presumably from the cmdline) |
71 |
if myconfig: |
72 |
if os.path.exists(myconfig): |
73 |
- print "Using command line specified Catalyst configuration file, "+myconfig |
74 |
+ print "Using command line specified Catalyst configuration file, "+\ |
75 |
+ myconfig |
76 |
config_file=myconfig |
77 |
|
78 |
else: |
79 |
@@ -88,7 +91,8 @@ def parse_config(myconfig): |
80 |
|
81 |
# next, try the default location |
82 |
elif os.path.exists("/etc/catalyst/catalyst.conf"): |
83 |
- print "Using default Catalyst configuration file, /etc/catalyst/catalyst.conf" |
84 |
+ print "Using default Catalyst configuration file," + \ |
85 |
+ " /etc/catalyst/catalyst.conf" |
86 |
config_file="/etc/catalyst/catalyst.conf" |
87 |
|
88 |
# can't find a config file (we are screwed), so bail out |
89 |
@@ -188,14 +192,16 @@ def parse_config(myconfig): |
90 |
conf_values["port_logdir"]=myconf["port_logdir"]; |
91 |
|
92 |
def import_modules(): |
93 |
- # import catalyst's own modules (i.e. catalyst_support and the arch modules) |
94 |
+ # import catalyst's own modules |
95 |
+ # (i.e. catalyst_support and the arch modules) |
96 |
targetmap={} |
97 |
|
98 |
try: |
99 |
for x in required_build_targets: |
100 |
try: |
101 |
fh=open(conf_values["sharedir"]+"/modules/"+x+".py") |
102 |
- module=imp.load_module(x,fh,"modules/"+x+".py",(".py","r",imp.PY_SOURCE)) |
103 |
+ module=imp.load_module(x,fh,"modules/"+x+".py", |
104 |
+ (".py","r",imp.PY_SOURCE)) |
105 |
fh.close() |
106 |
|
107 |
except IOError: |
108 |
@@ -205,7 +211,8 @@ def import_modules(): |
109 |
for x in valid_build_targets: |
110 |
try: |
111 |
fh=open(conf_values["sharedir"]+"/modules/"+x+".py") |
112 |
- module=imp.load_module(x,fh,"modules/"+x+".py",(".py","r",imp.PY_SOURCE)) |
113 |
+ module=imp.load_module(x,fh,"modules/"+x+".py", |
114 |
+ (".py","r",imp.PY_SOURCE)) |
115 |
module.register(targetmap) |
116 |
fh.close() |
117 |
|
118 |
@@ -223,7 +230,8 @@ def import_modules(): |
119 |
def build_target(addlargs, targetmap): |
120 |
try: |
121 |
if addlargs["target"] not in targetmap: |
122 |
- raise CatalystError,"Target \""+addlargs["target"]+"\" not available." |
123 |
+ raise CatalystError, \ |
124 |
+ "Target \"%s\" not available." % addlargs["target"] |
125 |
|
126 |
mytarget=targetmap[addlargs["target"]](conf_values, addlargs) |
127 |
|
128 |
@@ -231,7 +239,8 @@ def build_target(addlargs, targetmap): |
129 |
|
130 |
except: |
131 |
catalyst.util.print_traceback() |
132 |
- print "!!! catalyst: Error encountered during run of target " + addlargs["target"] |
133 |
+ print "!!! catalyst: Error encountered during run of target " + \ |
134 |
+ addlargs["target"] |
135 |
sys.exit(1) |
136 |
|
137 |
if __name__ == "__main__": |
138 |
@@ -250,8 +259,12 @@ if __name__ == "__main__": |
139 |
|
140 |
# parse out the command line arguments |
141 |
try: |
142 |
- opts,args = getopt.getopt(sys.argv[1:], "apPThvdc:C:f:FVs:", ["purge", "purgeonly", "purgetmponly", "help", "version", "debug",\ |
143 |
- "clear-autoresume", "config=", "cli=", "file=", "fetch", "verbose","snapshot="]) |
144 |
+ opts,args = getopt.getopt(sys.argv[1:], "apPThvdc:C:f:FVs:", |
145 |
+ ["purge", "purgeonly", "purgetmponly", "help", "version", "debug", |
146 |
+ "clear-autoresume", "config=", "cli=", "file=", "fetch", |
147 |
+ "verbose","snapshot=" |
148 |
+ ] |
149 |
+ ) |
150 |
|
151 |
except getopt.GetoptError: |
152 |
usage() |
153 |
-- |
154 |
1.8.1.4 |