class TestOneEvent(Event):
"""event test one"""
+ type = "TestOneEvent"
class TestTwoEvent(Event):
"""event test two"""
+ type = "TestTwoEvent"
def testOneHandler(e):
- if e == TestOneEvent:
+ if e.type == "TestOneEvent":
print "test one caught! woot!"
return event.Handled
return event.NotHandled
-testTwoHandler = "\timport event\n\tif e.__name__ == \"TestTwoEvent\":\n\t\tprint 'handled test two event'\n\t\treturn event.Handled\n\treturn event.NotHandled\n"
+testTwoHandler = "\timport event\n\tif e.type == \"TestTwoEvent\":\n\t\tprint 'handled test two event'\n\t\treturn event.Handled\n\treturn event.NotHandled\n"
event.register(testOneHandler)
event.register(testTwoHandler)
# oemake events
-class PkgFailed(Event):
- """Package build failed"""
-
-class PkgSucceeded(Event):
- """Package build succeeded"""
-
-# oebuild events
-
-class TaskFailed(Event):
- """Task execution failed"""
-
-class TaskSucceeded(Event):
- """Task execution succeeded"""
#!/usr/bin/python
-import oe, string, sys, os
+import string, sys, os
+from oe import *
-import oe.data # data handling
-oe.data.init()
+class PkgFailed(event.Event):
+ """Package build failed"""
+ type = "PkgFailed"
-import oe.parse # file parsing
+class PkgSucceeded(event.Event):
+ """Package build succeeded"""
+ type = "PkgSucceeded"
def getBuildOrder(digraph):
refcount = 0
else:
depcmd="stage"
-files = []
-files.append("../packages/content/glibc-2.3.1.oe")
-
pkgdata = {}
-
-#cfgdata = oe.parse.handle("../conf/oe.conf")
-#from copy import copy
-#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")
+graph = digraph()
+
+parse.init(".conf", cfg)
+data.setVarFlag("OEFILES", "inherit", "1", cfg)
+data.setVarFlag("OEDIR", "inherit", "1", cfg)
+data.setVarFlag("OEPATH", "inherit", "1", cfg)
+data.setVarFlag("PATH", "inherit", "1", cfg)
+data.inheritFromOS(1, cfg)
+
+try:
+ cfg = parse.handle("conf/oe.conf", cfg) # Read configuration
+except IOError:
+ fatal("Unable to open oe.conf")
+
+oefiles = data.getVar("OEFILES", cfg)
+if oefiles is not None:
+ files = oefiles.split()
else:
- cfg = oe.parse.handle(__oepath_found_it__, cfg) # Read configuration
+ fatal("OEFILES not defined")
-#oe.set_automatic_vars(sys.argv[2], ) # Deduce per-package environment variables
+#set_automatic_vars(sys.argv[2], ) # Deduce per-package environment variables
for f in files:
# read a file's metadata
try:
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])
+ pkgdata[f] = parse.handle(f, copy(cfg))
+# if pkgdata[f] is not None:
+# data.emit_env(sys.__stdout__, pkgdata[f])
except IOError:
+ print "error opening %s" % f
pass
# use that metadata to yank the necessary bits for high
# level build process.. the depends fields and provides info
+ graph.addnode(f, None)
- # Then, start the build for that package. Note that because
- # we've already loaded the files, we may as well spawn the build
- # directly.. so lets abstract the task handling bits into a
- # module that both oebuild and oemake can utilize.
-
-
-#test = oe.digraph()
-#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)
+# Then, start the build for that package. Note that because
+# we've already loaded the files, we may as well spawn the build
+# directly.. so lets abstract the task handling bits into a
+# module that both oebuild and oemake can utilize.
+
+data = getBuildOrder(graph)
+for d in data:
+ (pkg, step) = d
+ note("oebuild %s %s" % (step, pkg))
+ os.system("oebuild %s %s" % (step, pkg))