On Sun, 2013-01-06 at 17:41 -0800, Brian Dolbec wrote: > This is the first of some untested (but they compile without errors) > patches to catalyst for the pending default tree location changes. > > My current gentoo machine is somewhat limited in capability (memory > shortage, only moderate cpu horespower) for doing proper testing. But I > will try and get it setup better to do some test runs for changes. > > I can also push my catalyst git repo to my dev space for you to checkout > and do some tests on if you like. > >
As requested. Separated whitespace cleanup.
=====================
diff --git a/catalyst b/catalyst
index 3d31599..c77658a 100755
@@ -66,7 +66,7 @@ def parse_config(myconfig):
"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):
@@ -77,12 +77,12 @@ def parse_config(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"
@@ -93,11 +93,11 @@ def parse_config(myconfig):
# 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 myconf.has_key(x):
@@ -208,9 +208,9 @@ def build_target(addlargs, targetmap):
try:
if not targetmap.has_key(addlargs["target"]):
raise CatalystError,"Target \""+addlargs["target"]+"\"
not available."
-
+
mytarget=targetmap[addlargs["target"]](conf_values, addlargs)
-
+
mytarget.run()
except:
@@ -220,7 +220,7 @@ def build_target(addlargs, targetmap):
if __name__ == "__main__":
targetmap={}
-
+
version()
if os.getuid() != 0:
# catalyst cannot be run as a normal user due to chroots,
mounts, etc
@@ -236,11 +236,11 @@ if __name__ == "__main__":
try:
opts,args = getopt.getopt(sys.argv[1:], "apPThvdc:C:f:FVs:",
["purge", "purgeonly", "purgetmponly", "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
@@ -261,7 +261,7 @@ if __name__ == "__main__":
if o in ("-h", "--help"):
usage()
sys.exit(1)
-
+
if o in ("-V", "--version"):
print "Catalyst version "+__version__
sys.exit(1)
@@ -279,14 +279,14 @@ if __name__ == "__main__":
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"
@@ -299,7 +299,7 @@ if __name__ == "__main__":
run = True
mycmdline.append("target=snapshot")
mycmdline.append("version_stamp="+a)
-
+
if o in ("-p", "--purge"):
conf_values["PURGE"] = "1"
@@ -321,7 +321,7 @@ if __name__ == "__main__":
parse_config(myconfig)
sys.path.append(conf_values["sharedir"]+"/modules")
from catalyst_support import *
-
+
# Start checking that digests are valid now that the hash_map was
imported
# from catalyst_support
if conf_values.has_key("digests"):
@@ -365,11 +365,11 @@ if __name__ == "__main__":
targetmap=import_modules()
addlargs={}
-
+
if myspecfile:
spec = catalyst.config.SpecParser(myspecfile)
addlargs.update(spec.get_values())
-
+
if mycmdline:
try:
cmdline = catalyst.config.ConfigParser()
@@ -385,7 +385,7 @@ if __name__ == "__main__":
# everything is setup, so the build is a go
try:
build_target(addlargs, targetmap)
-
+
except CatalystError:
print
print "Catalyst aborting...."
=====================
--
Brian Dolbec <[email protected]>
signature.asc
Description: This is a digitally signed message part
