Further proof of concept in oemake
authorChris Larson <clarson@kergoth.com>
Sat, 14 Jun 2003 17:29:02 +0000 (17:29 +0000)
committerChris Larson <clarson@kergoth.com>
Sat, 14 Jun 2003 17:29:02 +0000 (17:29 +0000)
bin/oemake

index 8a3b31e..4ea19bc 100644 (file)
@@ -1,11 +1,11 @@
 #!/usr/bin/python
 
-import oe, string, sys
+import oe, string, sys, os
 
-import oedata # data handling
-oedata.init()
+import oe.data # data handling
+oe.data.init()
 
-import oeparse # file parsing
+import oe.parse # file parsing
 
 def getBuildOrder(digraph):
        refcount = 0
@@ -53,24 +53,41 @@ else:
        depcmd="stage"
 
 files = []
-files.append("test.oe")
-files.append("conf/oe.conf")
+files.append("../packages/content/glibc-2.3.1.oe")
 
 pkgdata = {}
 
-#cfgdata = oeparse.handle("../conf/oe.conf")
+#cfgdata = oe.parse.handle("../conf/oe.conf")
 #from copy import copy
-#testdata = oeparse.handle("../test.oe", copy(cfgdata))
+#testdata = oe.parse.handle("../test.oe", copy(cfgdata))
+
+cfg = {}
+oe.parse.init(".conf", cfg)
+oe.data.inheritFromOS(1, cfg)
+
+__oepath_found_it__ = 0
+for s in oe.data.getVar('OEPATH', cfg).split(":"):
+       s = oe.data.expand(s, cfg)
+       if os.access(os.path.join(s,'conf/oe.conf'), os.R_OK):
+               __oepath_found_it__ = os.path.join(s, 'conf/oe.conf')
+
+if __oepath_found_it__ == 0:
+       oe.fatal("error locating conf/oe.conf")
+else:
+       cfg = oe.parse.handle(__oepath_found_it__, cfg) # Read configuration
+
+#oe.set_automatic_vars(sys.argv[2], )                  # Deduce per-package environment variables
 
 for f in files:
        # read a file's metadata
        try:
-               pkgdata[f] = oeparse.handle(f)
-               oedata.emit_env(sys.__stdout__, pkgdata[f])
-#              print "pkgdata[\"%s\"]:" % f
-#              print "\t %s" % pkgdata[f]
+               from copy import copy
+               pkgdata[f] = oe.parse.handle(f, copy(cfg))
+               if pkgdata[f] is not None:
+                       oe.data.emit_env(sys.__stdout__, pkgdata[f])
        except IOError:
                pass
+
        # use that metadata to yank the necessary bits for high
        # level build process.. the depends fields and provides info
        
@@ -84,7 +101,6 @@ for f in files:
 #test.addnode("glibc", None)
 #test.addnode("ipkg", "glibc")
 #data = getBuildOrder(test)
-
 #for d in data:
 #      (pkg, step) = d 
 #      print "oebuild %s %s-*.oe" % (step, pkg)