summaryrefslogtreecommitdiffstats
path: root/bin
diff options
context:
space:
mode:
Diffstat (limited to 'bin')
-rw-r--r--bin/oe/parse/ConfHandler.py24
-rw-r--r--bin/oe/parse/OEHandler.py37
-rw-r--r--bin/oe/parse/SRPMHandler.py19
-rw-r--r--bin/oe/parse/__init__.py4
4 files changed, 55 insertions, 29 deletions
diff --git a/bin/oe/parse/ConfHandler.py b/bin/oe/parse/ConfHandler.py
index e8bc080d8..3d94f85ff 100644
--- a/bin/oe/parse/ConfHandler.py
+++ b/bin/oe/parse/ConfHandler.py
@@ -3,7 +3,7 @@
Reads the file and obtains its metadata"""
import re, oe.data, os, sys
-from oe import debug
+from oe import debug, fatal
__config_regexp__ = re.compile( r"(?P<exp>export\s*)?(?P<var>[a-zA-Z0-9\-_.${}]+)\s*(?P<colon>:)?=\s*(?P<apo>['\"]?)(?P<value>.*)(?P=apo)$")
__include_regexp__ = re.compile( r"include\s+(.+)" )
@@ -155,6 +155,9 @@ def supports(fn):
return localpath(fn)[-5:] == ".conf"
def localpath(fn):
+ if os.path.exists(fn):
+ return fn
+
localfn = None
try:
localfn = oe.fetch.localpath(fn)
@@ -162,7 +165,6 @@ def localpath(fn):
pass
if not localfn:
- debug(2, "obtain: malformed url: %s" % fn)
localfn = fn
return localfn
@@ -207,14 +209,18 @@ def include(oldfn, fn, data = {}):
from oe.parse import handle
try:
- debug(1, "include: handle(%s, data)" % fn)
- ret = handle(fn, data)
+ ret = handle(fn, data, 1)
except IOError:
- debug(1, "include: %s not found" % fn)
+ debug(1, "CONF %s: file not found" % fn)
-def handle(fn, data = {}):
+def handle(fn, data = {}, include = 0):
+ if include == 0:
+ debug(1, "CONF %s: handle(data)" % fn);
+ else:
+ debug(1, "CONF %s: handle(data, include)" % fn);
init(data)
- oe.data.inheritFromOS(1, data)
+ if include == 0:
+ oe.data.inheritFromOS(1, data)
fn = obtain(fn, data)
oepath = ['.']
if not os.path.isabs(fn):
@@ -263,11 +269,13 @@ def feeder(lineno, s, fn, data = {}):
m = __include_regexp__.match(s)
if m:
s = oe.data.expand(m.group(1), data)
- debug(2, "%s:%d: including %s" % (fn, lineno, s))
+ debug(2, "CONF %s:%d: including %s" % (fn, lineno, s))
oe.data.inheritFromOS(2, data)
include(fn, s, data)
return
+ fatal("PARSER: %s:%d: unparsed line" % (fn, lineno));
+
# Add us to the handlers list
from oe.parse import handlers
handlers.append({'supports': supports, 'handle': handle, 'init': init})
diff --git a/bin/oe/parse/OEHandler.py b/bin/oe/parse/OEHandler.py
index 9d6b110da..a710816df 100644
--- a/bin/oe/parse/OEHandler.py
+++ b/bin/oe/parse/OEHandler.py
@@ -35,25 +35,31 @@ def inherit(files, d):
file = "classes/%s.oeclass" % file
if not file in __inherit_cache:
- debug(2, "%s:%d: inheriting %s" % (fn, lineno, file))
+ debug(2, "OE %s:%d: inheriting %s" % (fn, lineno, file))
__inherit_cache.append(file)
include(fn, file, d)
-def handle(fn, d = {}):
+def handle(fn, d = {}, include = 0):
global __func_start_regexp__, __inherit_regexp__, __export_func_regexp__, __addtask_regexp__, __addhandler_regexp__, __infunc__, __body__, __oepath_found__
__body__ = []
__oepath_found__ = 0
__infunc__ = ""
__classname__ = ""
+ if include == 0:
+ debug(2, "OE %s: handle(data)" % fn)
+ else:
+ debug(2, "OE %s: handle(data, include)" % fn)
+
(root, ext) = os.path.splitext(os.path.basename(fn))
if ext == ".oeclass":
__classname__ = root
classes.append(__classname__)
init(d)
- data.inheritFromOS(2, d)
+ if include == 0:
+ data.inheritFromOS(2, d)
fn = obtain(fn, d)
oepath = ['.']
if not os.path.isabs(fn):
@@ -94,10 +100,10 @@ def handle(fn, d = {}):
if ext == ".oeclass":
classes.remove(__classname__)
else:
- set_automatic_vars(fn, d)
+ set_automatic_vars(fn, d, include)
data.expandKeys(d)
data.update_data(d)
- set_additional_vars(fn, d)
+ set_additional_vars(fn, d, include)
return d
def feeder(lineno, s, fn, d):
@@ -237,6 +243,13 @@ def vars_from_fn(mypkg, d, store=2, silent=1):
splitmap = [ 'CATEGORY', 'PN', 'PV', 'PR' ]
heh = [ "PR", "PV", "PN" ]
try:
+ pkgsplit = __pkgsplit_cache__[mypkg]
+ splitloc=0;
+ for i in range(len(heh)-1, 0, -1):
+ if pkgsplit[splitloc] == None:
+ break
+ data.setVar(heh[i], pkgsplit[splitloc], d)
+ splitloc += 1
return __pkgsplit_cache__[mypkg]
except KeyError:
pass
@@ -276,10 +289,10 @@ def vars_from_fn(mypkg, d, store=2, silent=1):
__pkgsplit_cache__[mypkg] = pkgsplit
return pkgsplit
-def set_automatic_vars(file, d):
+def set_automatic_vars(file, d, include):
"""Deduce per-package environment variables"""
- debug(2, "setting automatic vars")
+ debug(2, "OE %s: setting automatic vars" % file)
# pkg = oe.catpkgsplit(file)
# pkg = vars_from_fn(file, d)
# if None in pkg:
@@ -329,14 +342,16 @@ def set_automatic_vars(file, d):
data.setVar('S', '${WORKDIR}/${P}', d)
if not data.getVar('SLOT', d):
data.setVar('SLOT', '0', d)
- data.inheritFromOS(3, d)
+ if include == 0:
+ data.inheritFromOS(3, d)
-def set_additional_vars(file, d):
+def set_additional_vars(file, d, include):
"""Deduce rest of variables, e.g. ${A} out of ${SRC_URI}"""
- debug(2,"set_additional_vars")
+ debug(2,"OE %s: set_additional_vars" % file)
- data.inheritFromOS(4, d)
+ if include == 0:
+ data.inheritFromOS(4, d)
src_uri = data.getVar('SRC_URI', d)
if not src_uri:
return
diff --git a/bin/oe/parse/SRPMHandler.py b/bin/oe/parse/SRPMHandler.py
index 0a3790594..d0ff3e827 100644
--- a/bin/oe/parse/SRPMHandler.py
+++ b/bin/oe/parse/SRPMHandler.py
@@ -17,9 +17,10 @@ _srpm_vartranslate = {
def supports(fn):
return fn[-8:] == ".src.rpm"
-def handle(fn, d = {}):
+def handle(fn, d = {}, include = 0):
init(d)
- data.inheritFromOS(2, d)
+ if include == 0:
+ data.inheritFromOS(2, d)
oepath = ['.']
if not os.path.isabs(fn):
f = None
@@ -62,12 +63,12 @@ def handle(fn, d = {}):
for c in i:
oe.parse.handle('classes/%s.oeclass' % c, d)
- set_automatic_vars(fn, d)
- set_additional_vars(fn, d)
+ set_automatic_vars(fn, d, include)
+ set_additional_vars(fn, d, include)
data.update_data(d)
return d
-def set_automatic_vars(file, d):
+def set_automatic_vars(file, d, include):
"""Deduce per-package environment variables"""
debug(2, "setting automatic vars")
@@ -91,14 +92,16 @@ def set_automatic_vars(file, d):
if not data.getVar('S', d):
data.setVar('S', '${WORKDIR}/${P}', d)
data.setVar('SLOT', '0', d)
- data.inheritFromOS(3, d)
+ if include == 0:
+ data.inheritFromOS(3, d)
-def set_additional_vars(file, d):
+def set_additional_vars(file, d, include):
"""Deduce rest of variables, e.g. ${A} out of ${SRC_URI}"""
debug(2,"set_additional_vars")
- data.inheritFromOS(4, d)
+ if include == 0:
+ data.inheritFromOS(4, d)
src_uri = data.getVar('SRC_URI', d)
if not src_uri:
return
diff --git a/bin/oe/parse/__init__.py b/bin/oe/parse/__init__.py
index ce48b543f..de5c0da79 100644
--- a/bin/oe/parse/__init__.py
+++ b/bin/oe/parse/__init__.py
@@ -24,11 +24,11 @@ def supports(fn):
return True
return False
-def handle(fn, data = {}):
+def handle(fn, data = {}, include = 0):
"""Call the handler that is appropriate for this file"""
for h in handlers:
if h['supports'](fn):
- return h['handle'](fn, data)
+ return h['handle'](fn, data, include)
return None
def init(fn, data = {}):