"portdir":"/usr/portage","options":"",\
"snapshot_cache":"/var/tmp/catalyst/snapshot_cache",\
"hash_function":"crc32"}
-
+
# first, try the one passed (presumably from the cmdline)
if myconfig:
if os.path.exists(myconfig):
print "!!! catalyst: Could not use specified configuration file "+\
myconfig
sys.exit(1)
-
+
# next, try the default location
elif os.path.exists("/etc/catalyst/catalyst.conf"):
print "Using default Catalyst configuration file, /etc/catalyst/catalyst.conf"
config_file="/etc/catalyst/catalyst.conf"
-
+
# can't find a config file (we are screwed), so bail out
else:
print "!!! catalyst: Could not find a suitable configuration file"
# execfile(config_file, myconf, myconf)
myconfig = catalyst.config.ConfigParser(config_file)
myconf.update(myconfig.get_values())
-
+
except:
print "!!! catalyst: Unable to parse configuration file, "+myconfig
sys.exit(1)
-
+
# now, load up the values into conf_values so that we can use them
for x in confdefaults.keys():
if x in myconf:
try:
if not addlargs["target"] in targetmap:
raise CatalystError,"Target \""+addlargs["target"]+"\" not available."
-
+
mytarget=targetmap[addlargs["target"]](conf_values, addlargs)
-
+
mytarget.run()
except:
if __name__ == "__main__":
-
+
show_version()
if os.getuid() != 0:
try:
opts,args = getopt.getopt(sys.argv[1:], "apPhvdc:C:f:FVs:", ["purge", "purgeonly", "help", "version", "debug",\
"clear-autoresume", "config=", "cli=", "file=", "fetch", "verbose","snapshot="])
-
+
except getopt.GetoptError:
usage()
sys.exit(2)
-
+
# defaults for commandline opts
debug=False
verbose=False
if o in ("-h", "--help"):
usage()
sys.exit(1)
-
+
if o in ("-V", "--version"):
print "Catalyst version "+__version__
sys.exit(1)
while x < len(sys.argv):
mycmdline.append(sys.argv[x])
x=x+1
-
+
if o in ("-f", "--file"):
run = True
myspecfile=a
if o in ("-F", "--fetchonly"):
conf_values["FETCH"]="1"
-
+
if o in ("-v", "--verbose"):
conf_values["VERBOSE"]="1"
run = True
mycmdline.append("target=snapshot")
mycmdline.append("version_stamp="+a)
-
+
if o in ("-p", "--purge"):
conf_values["PURGE"] = "1"
sys.exit(2)
parse_config(myconfig)
-
+
verify_digest_and_hash_functions()
targetmap = catalyst.target.build_target_map()
addlargs={}
-
+
if myspecfile:
spec = catalyst.config.SpecParser(myspecfile)
addlargs.update(spec.get_values())
-
+
if mycmdline:
try:
cmdline = catalyst.config.ConfigParser()
# everything is setup, so the build is a go
try:
build_target(addlargs, targetmap)
-
+
except CatalystError:
print
print "Catalyst aborting...."