--- /dev/null
+#!/usr/bin/python
+
+import oefetch
+
+urls = ["cvs://anoncvs:anonymous@cvs.handhelds.org/cvs;module=familiar/dist/ipkg;tag=V-99-84"]
+
+oefetch.init(urls)
+oefetch.go()
--- /dev/null
+"""class for handling configuration data files
+
+ Reads the file and obtains its metadata"""
+
+import re, oedata, os, sys
+from oe import debug
+
+__config_regexp__ = re.compile( r"(?P<exp>export\s*)?(?P<var>\w+)\s*(?P<colon>:)?=\s*(?P<apo>['\"]?)(?P<value>.*)(?P=apo)$")
+__include_regexp__ = re.compile( r"include\s+(.+)" )
+
+def supports(fn):
+ return fn[-5:] == ".conf"
+
+def include(oldfn, fn, data = {}):
+ if oldfn == fn: # prevent infinate recursion
+ return 1
+
+ from oeparse import handle
+ return handle(fn, data)
+
+def handle(fn, data = {}):
+ oedata.setVar('TOPDIR', os.getcwd(), data)
+ oedata.setVar('OEDIR', os.path.join(sys.prefix, "share/oe"), data)
+ oedata.setVar('OEPATH', "${OEDIR}/bin:${OEDIR}:${TOPDIR}/bin:${TOPDIR}", data)
+ fn = os.path.abspath(fn)
+ f = open(fn,'r')
+ lineno = 0
+ while 1:
+ lineno = lineno + 1
+ s = f.readline()
+ if not s: break
+ s = s.strip()
+ if not s: continue # skip empty lines
+ if s[0] == '#': continue # skip comments
+ while s[-1] == '\\':
+ s2 = f.readline()[:-1].strip()
+ s = s[:-1] + s2
+ feeder(lineno, s, fn, data)
+ return data
+
+def feeder(lineno, s, fn, data = {}):
+ m = __config_regexp__.match(s)
+ if m:
+ groupd = m.groupdict()
+ key = groupd["var"]
+ if groupd.has_key("exp") and groupd["exp"] != None:
+ oedata.setVarFlag(key, "export", 1, data)
+ if groupd.has_key("colon") and groupd["colon"] != None:
+ val = oedata.expand(groupd["value"], data)
+ else:
+ val = groupd["value"]
+ oedata.setVar(key, val, data)
+ return
+
+ m = __include_regexp__.match(s)
+ if m:
+ s = oedata.expand(m.group(1), data)
+ if os.access(os.path.abspath(s), os.R_OK):
+ debug(2, "%s:%d: including %s" % (fn, lineno, s))
+# inherit_os_env(2, self.env)
+ include(fn, s, data)
+ else:
+ debug(1, "%s:%d: could not import %s" % (fn, lineno, s))
+ return
+
+# Add us to the handlers list
+from oeparse import handlers
+handlers.append({'supports': supports, 'handle': handle})
+del handlers
--- /dev/null
+"""class for handling .oe files
+
+ Reads the file and obtains its metadata"""
+
+import re, oedata, string, os, sys
+from oe import debug
+
+from oeparse.ConfHandler import include
+
+__func_start_regexp__ = re.compile( r"(\w+)\s*\(\s*\)\s*{$" )
+__inherit_regexp__ = re.compile( r"inherit\s+(.+)" )
+__export_func_regexp__ = re.compile( r"EXPORT_FUNCTIONS\s+(.+)" )
+__addtask_regexp__ = re.compile( r"addtask\s+(.+)" )
+
+__infunc__ = ""
+__body__ = []
+__oepath_found__ = 0
+
+def supports(fn):
+ return fn[-3:] == ".oe"
+
+def handle(fn, data = {}):
+ global __func_start_regexp__, __inherit_regexp__, __export_func_regexp__, __addtask_regexp__, __infunc__, __body__, __oepath_found__
+ oedata.setVar('TOPDIR', os.getcwd(), data)
+ oedata.setVar('OEDIR', os.path.join(sys.prefix, "share/oe"), data)
+ oedata.setVar('OEPATH', "${OEDIR}/bin:${OEDIR}:${TOPDIR}/bin:${TOPDIR}", data)
+ __body__ = []
+ __oepath_found__ = 0
+ __infunc__ = ""
+
+ fn = os.path.abspath(fn)
+ f = open(fn,'r')
+ lineno = 0
+ while 1:
+ lineno = lineno + 1
+ s = f.readline()
+ if not s: break
+ s = s.strip()
+ if not s: continue # skip empty lines
+ if s[0] == '#': continue # skip comments
+ while s[-1] == '\\':
+ s2 = f.readline()[:-1].strip()
+ s = s[:-1] + s2
+ feeder(lineno, s, fn, data)
+ return data
+
+def feeder(lineno, s, fn, data = {}):
+ global __func_start_regexp__, __inherit_regexp__, __export_func_regexp__, __addtask_regexp__, __infunc__, __body__, __oepath_found__
+ if __infunc__:
+ if s == '}':
+ __body__.append('')
+ oedata.setVar(__infunc__, string.join(__body__, '\n'), data)
+ oedata.setVarFlag(__infunc__, "func", 1, data)
+ __infunc__ = ""
+ __body__ = []
+ else:
+ __body__.append(s)
+ return
+
+ m = __func_start_regexp__.match(s)
+ if m:
+ __infunc__ = m.group(1)
+ return
+
+ __word__ = re.compile(r"\S+")
+
+ m = __export_func_regexp__.match(s)
+ if m:
+ fns = m.group(1)
+ n = __word__.findall(fns)
+ for f in n:
+ oedata.setVar(f, "\t%s_%s\n" % (fn, f), data)
+ return
+
+ m = __addtask_regexp__.match(s)
+ if m:
+ fns = m.group(1)
+ n = __word__.findall(fns)
+ if not envflags.has_key(n[0]):
+ envflags[n[0]] = {}
+ oedata.setVarFlag(n[0], "task", 1, data)
+ return
+
+ m = __inherit_regexp__.match(s)
+ if m:
+ files = m.group(1)
+ n = __word__.findall(files)
+ for f in n:
+ file = oedata.expand(f, data)
+ if file[0] != "/":
+ if data.has_key('OEPATH'):
+ __oepath_found__ = 0
+ for dir in oedata.expand(cfgenv['OEPATH'], data).split(":"):
+ if os.access(os.path.join(dir, "classes", file + ".oeclass"), os.R_OK):
+ file = os.path.join(dir, "classes",file + ".oeclass")
+ __oepath_found__ = 1
+ if __oepath_found__ == 0:
+ debug(1, "unable to locate %s in OEPATH" % file)
+
+ if os.access(os.path.abspath(file), os.R_OK):
+ debug(2, "%s:%d: inheriting %s" % (fn, lineno, file))
+# inherit_os_env(2, self.env)
+ include(fn, s, data)
+ else:
+ debug(1, "%s:%d: could not import %s" % (fn, lineno, file))
+ return
+
+ import oeparse.ConfHandler
+ return oeparse.ConfHandler.feeder(lineno, s, fn, data)
+
+# Add us to the handlers list
+from oeparse import handlers
+handlers.append({'supports': supports, 'handle': handle})
+del handlers
--- /dev/null
+"""
+OpenEmbedded Parsers
+
+File parsers for the OpenEmbedded
+(http://openembedded.org) build infrastructure.
+
+Copyright: (c) 2003 Chris Larson
+
+Based on functions from the base oe module, Copyright 2003 Holger Schurig
+"""
+__version__ = '1.0'
+
+__all__ = [ 'handlers', 'supports', 'handle' ]
+handlers = []
+
+import ConfHandler
+import OEHandler
+
+def supports(fn):
+ """Returns true if we have a handler for this file, false otherwise"""
+ for h in handlers:
+ if h['supports'](fn):
+ return True
+ return False
+
+def handle(fn, data = {}):
+ """Call the handler that is appropriate for this file"""
+ for h in handlers:
+ if h['supports'](fn):
+ return h['handle'](fn, data)
+ return None
#!/usr/bin/python
-import oeparser
-import sys
-from oe import *
-def usage(var):
- print "usage: parse <somebuildfile.oe>"
- sys.exit(1)
+import oeparse
-if len(sys.argv) < 2:
- usage(1)
+cfgdata = oeparse.handle("conf/oe.conf")
-__oepath_found_it__ = 0
+from copy import copy
+testdata = oeparse.handle("test.oe", copy(cfgdata))
-for s in getenv('OEPATH').split(":"):
- if os.access(os.path.join(s,'conf/oe.conf'), os.R_OK):
- __oepath_found_it__ = 1
- try:
- oeparser.oeconf.fn = os.path.join(s, "conf/oe.conf")
- oeparser.oeconf.reader()
- except IOError:
- pass
-
-if __oepath_found_it__ == 0:
- fatal("error locating conf/oe.conf")
-
-try:
- a = oeparser.PackageReader(sys.argv[1])
-# c.cfgenv = b.env # point the package reader to our config data
- a.reader()
-
- data = {}
- for env in [oeparser.oeconf.env,a.env]:
- for item in env.keys():
- data[item] = env[item]
-
-except IOError:
- fatal("error accessing build file")
-
-emit_env(sys.__stdout__, data)
-sys.exit(0)
+print "testdata: "
+print "\t%s" % testdata