Complete TODO item, allow -c/--cmd option for oemake to specify the task to execute...
authorChris Larson <clarson@kergoth.com>
Wed, 30 Jul 2003 01:34:45 +0000 (01:34 +0000)
committerChris Larson <clarson@kergoth.com>
Wed, 30 Jul 2003 01:34:45 +0000 (01:34 +0000)
bin/oemake
doc/TODO

index 03474d0..a7278e2 100644 (file)
@@ -159,25 +159,42 @@ def get_oefile():
 
 import getopt
 try:
-       (opts, args) = getopt.getopt(sys.argv[1:], 'v', [ 'version' ])
+       (opts, args) = getopt.getopt(sys.argv[1:], 'vc:', [ 'version', 'cmd:' ])
 except getopt.GetoptError:
        usage()
 
 # handle opts
 optsonly = [ opt for (opt,val) in opts]
-if '--version' in optsonly or '-v' in optsonly:
+cmd = None
+
+def getopthash(l):
+       h = {}
+       for (opt, val) in l:
+               h[opt] = val
+       return h
+
+opthash = getopthash(opts)
+
+if opthash.has_key('--version') or opthash.has_key('-v'):
        version()
        sys.exit(0)
 
+if opthash.has_key('--cmd'):
+       cmd = opthash['--cmd']
+if opthash.has_key('-c'):
+       cmd = opthash['-c']
+
 _depcmds = { "do_clean": None,
-           "do_mrproper": None, }
+            "do_mrproper": None,
+            "do_build": "stage", }
 
-cmd="do_build"
+if not cmd:
+       cmd = "do_build"
 
 if _depcmds.has_key(cmd):
-       depcmd=depcmds[cmd]
+       depcmd=_depcmds[cmd]
 else:
-       depcmd="stage"
+       depcmd=cmd
 
 pkgdata = {}
 pkgs = {}
@@ -196,7 +213,7 @@ buildname = data.getVar("BUILDNAME", cfg)
 
 # grab oefiles
 files = string.split(data.getVar("OEFILES", cfg, 1) or "")
-files += sys.argv[1:]
+files += args
 data.setVar("OEFILES", string.join(files), cfg)
 
 if not len(files):
@@ -274,16 +291,17 @@ for pkg in pkgs.keys():
 
 for pkg in pkgs.keys():
        (deps, fn) = pkgs[pkg]
-       if deps is not None:
-               for d in deps:
-                       if not graph.hasnode(d):
-                               def killitem(graph, item):
-                                       global __tokill
-                                       __tokill.append(item)
-                               graph.walkup(pkg, killitem)
-                               __unsatisfied.append([pkg, d])
-                               break
-                       graph.addnode(pkg, d)
+       if _depcmds[cmd] is not None:
+               if deps is not None:
+                       for d in deps:
+                               if not graph.hasnode(d):
+                                       def killitem(graph, item):
+                                               global __tokill
+                                               __tokill.append(item)
+                                       graph.walkup(pkg, killitem)
+                                       __unsatisfied.append([pkg, d])
+                                       break
+                               graph.addnode(pkg, d)
 
 for u in __unsatisfied:
        event.fire(UnsatisfiedDep(u[0], pkgdata[pkgs[u[0]][1]], u[1]))
index c1c11a6..55fb768 100644 (file)
--- a/doc/TODO
+++ b/doc/TODO
@@ -42,7 +42,7 @@ TODO:
                        [x] Allow execution with a command, without .oe
                        [x] Allow execution with .oe, without command
                        [x] Default .oe argument for oemake
-                       [ ] Allow specifying a command on oemake execution
+                       [x] Allow specifying a command on oemake execution
                        [ ] Must be able to execute 'oemake' within a subpackage
                            of an upstream package, and yet retain access to the
                            toplevel TMPDIR.  Perhaps specify TMPDIR through