# ChangeLog for gentoo/src/catalyst
# Copyright 2002-2004 Gentoo Technologies, Inc.; Distributed under the GPL v2
-# $Header: /var/cvsroot/gentoo/src/catalyst/ChangeLog,v 1.67 2004/07/03 00:33:37 zhen Exp $
+# $Header: /var/cvsroot/gentoo/src/catalyst/ChangeLog,v 1.68 2004/07/11 21:22:07 zhen Exp $
+
+ 11 Jul 2004; <zhen@gentoo.org> +catalyst, -catalyst.new.py,
+ modules/catalyst_support.py:
+ completely rewrote the catalyst main script so that it can actually utilize
+ more than one command line flag. new functionality included, but not active
+ yet (--debug and --verbose). arguments can still be passed on the commandline
+ through the use of the -C (--cli) flag. updated the arg_parse function in
+ catalyst_support.py to accomodate my changes.
02 Jul 2004; John Davis <zhen@gentoo.org> modules/generic_stage_target.py,
modules/generic_target.py, modules/grp_target.py,
#!/usr/bin/python
# Copyright 1999-2004 Gentoo Technologies, Inc.
# Distributed under the terms of the GNU General Public License v2
-# $Header: /var/cvsroot/gentoo/src/catalyst/Attic/catalyst.new.py,v 1.1 2004/07/07 01:46:31 zhen Exp $
+# $Header: /var/cvsroot/gentoo/src/catalyst/catalyst,v 1.40 2004/07/11 21:22:07 zhen Exp $
# Maintained in full by John Davis <zhen@gentoo.org>
conf_values.settings["sharedir"]+"/modules/"
except ImportError:
- print "!!! catalyst: python modules not found in "+\
+ print "!!! catalyst: Python modules not found in "+\
conf_values["sharedir"]+"/modules; exiting."
sys.exit(1)
except:
sys.exit(1)
- return addlargs
-
+ return addlargs
+
+def do_cli(cmdline):
+ try:
+ return arg_parse(cmdline)
+
+ except CatalystError:
+ print "!!! catalyst: Could not parse commandline, exiting."
+ sys.exit(1)
+
def build_target(addlargs, targetmap):
try:
if not targetmap.has_key(addlargs["target"]):
# parse out the command line arguments
try:
opts,args = getopt.getopt(sys.argv[1:], "hvdc:C:f:V", ["help", "version", "debug",\
- "config=", "commandline=", "file=", "verbose"])
+ "config=", "cli=", "file=", "verbose"])
except getopt.GetoptError:
usage()
if o in ("-c", "--config"):
myconfig=a
- # needs some work
if o in ("-C", "--cli"):
- if type(a)==types.StringType:
- mycmdline=[a]
- else:
- mycmdline=a
-
+ x=sys.argv.index(o)+1
+ while x < len(sys.argv):
+ mycmdline.append(sys.argv[x])
+ x=x+1
+
if o in ("-f", "--file"):
myspecfile=a
if myspecfile:
addlargs=do_spec(myspecfile)
+
+ if mycmdline:
+ addlargs=do_cli(mycmdline)
# everything is setup, so the build is a go
try:
# Distributed under the GNU General Public License version 2
# Copyright 2003-2004 Gentoo Technologies, Inc.
-# $Header: /var/cvsroot/gentoo/src/catalyst/modules/catalyst_support.py,v 1.24 2004/06/18 18:06:21 zhen Exp $
+# $Header: /var/cvsroot/gentoo/src/catalyst/modules/catalyst_support.py,v 1.25 2004/07/11 21:22:07 zhen Exp $
import sys,string,os,types
return 1
return 0
-def arg_parse(mydict,remaining,argv):
- "grab settings from argv, storing 'target' in mydict, and everything in remaining for later parsing"
- global required_config_file_values
- for x in argv:
+def arg_parse(cmdline):
+ #global required_config_file_values
+ mydict={}
+ for x in cmdline:
foo=string.split(x,"=")
if len(foo)!=2:
raise CatalystError, "Invalid arg syntax: "+x
- remaining[foo[0]]=foo[1]
- if not remaining.has_key("target"):
- raise CatalystError, "Required value \"target\" not specified."
- mydict["target"]=remaining["target"]
- for x in required_config_file_values:
- if not mydict.has_key(x):
- raise CatalystError, "Required config file value \""+x+"\" not found."
+ else:
+ mydict[foo[0]]=foo[1]
+
+ if not mydict.has_key("target"):
+ raise CatalystError, "Required value \"target\" not specified."
+
+ # if all is well, we should return (we should have bailed before here if not)
+ return mydict
def addl_arg_parse(myspec,addlargs,requiredspec,validspec):
"helper function to help targets parse additional arguments"