summaryrefslogtreecommitdiffstats
path: root/bin
diff options
context:
space:
mode:
authorChris Larson <clarson@kergoth.com>2004-05-09 05:26:34 +0000
committerChris Larson <clarson@kergoth.com>2004-05-09 05:26:34 +0000
commit9bc652e675c9f1d3e278bbcb9bf671bd50f4dac2 (patch)
tree4f4896faad757cfebf163b229f646863efda348f /bin
parent38cf5e2107120c31f87d788175b9af1b72de2fab (diff)
downloadbitbake-contrib-9bc652e675c9f1d3e278bbcb9bf671bd50f4dac2.tar.gz
Whitespace changes. Reformat things to better match the usual python indentation style, and add vim & emacs modelines to make it painless.
Diffstat (limited to 'bin')
-rw-r--r--bin/build/install82
-rw-r--r--bin/oe/__init__.py18
-rw-r--r--bin/oe/build.py4
-rw-r--r--bin/oe/data.py738
-rw-r--r--bin/oe/event.py212
-rw-r--r--bin/oe/fetch.py728
-rw-r--r--bin/oe/make.py84
-rw-r--r--bin/oe/manifest.py228
-rw-r--r--bin/oe/parse/ConfHandler.py291
-rw-r--r--bin/oe/parse/OEHandler.py603
-rw-r--r--bin/oe/parse/SRPMHandler.py193
-rw-r--r--bin/oe/parse/__init__.py55
-rw-r--r--bin/oebuild160
-rw-r--r--bin/oeimage96
-rw-r--r--bin/oeinstall264
-rw-r--r--bin/oemake542
-rw-r--r--bin/oemaked32
-rw-r--r--bin/oemakepkgs196
-rw-r--r--bin/oeread42
-rw-r--r--bin/parse_manifest14
20 files changed, 2304 insertions, 2278 deletions
diff --git a/bin/build/install b/bin/build/install
index 749c5a39e..947b4901b 100644
--- a/bin/build/install
+++ b/bin/build/install
@@ -8,53 +8,53 @@ group="0"
src="-"
dest="-"
while [ $# -ge 1 ]; do
- arg=`eval echo $1`
- case $1 in
- -m|--mode)
- installcmd="$installcmd $1"
- shift || break
- mode="$1"
- ;;
- -o|--owner)
- installcmd="$installcmd $1"
- shift || break
- owner="$1"
- ;;
- -g|--group)
- installcmd="$installcmd $1"
- shift || break
- group="$1"
- ;;
- -d)
- type="d"
- ;;
- -*)
- ;;
- *)
- if [ "$#" -eq "1" ]; then
- dest="$arg"
- else
- srcs="$srcs $arg"
- fi
- ;;
- esac
+ arg=`eval echo $1`
+ case $1 in
+ -m|--mode)
+ installcmd="$installcmd $1"
+ shift || break
+ mode="$1"
+ ;;
+ -o|--owner)
+ installcmd="$installcmd $1"
+ shift || break
+ owner="$1"
+ ;;
+ -g|--group)
+ installcmd="$installcmd $1"
+ shift || break
+ group="$1"
+ ;;
+ -d)
+ type="d"
+ ;;
+ -*)
+ ;;
+ *)
+ if [ "$#" -eq "1" ]; then
+ dest="$arg"
+ else
+ srcs="$srcs $arg"
+ fi
+ ;;
+ esac
- installcmd="$installcmd $1"
- shift || break
+ installcmd="$installcmd $1"
+ shift || break
done
(
if [ -n "$srcs" ]; then
- for s in $srcs; do
- if (echo $dest|grep -q "/$"); then
- srcdest="$dest/`basename $s`"
- else
- srcdest="$dest"
- fi
- echo "$pkg $s $srcdest $type $mode $owner $group"
- done
+ for s in $srcs; do
+ if (echo $dest|grep -q "/$"); then
+ srcdest="$dest/`basename $s`"
+ else
+ srcdest="$dest"
+ fi
+ echo "$pkg $s $srcdest $type $mode $owner $group"
+ done
else
- echo "$pkg $src $dest $type $mode $owner $group"
+ echo "$pkg $src $dest $type $mode $owner $group"
fi
) >> ${MANIFEST}
diff --git a/bin/oe/__init__.py b/bin/oe/__init__.py
index fc9bef642..88392eda4 100644
--- a/bin/oe/__init__.py
+++ b/bin/oe/__init__.py
@@ -1,4 +1,6 @@
-#!/usr/bin/python
+#!/usr/bin/env python
+# ex:ts=4:sw=4:tw=78:et
+# -*- tab-width: 4; c-basic-offset: 4; indent-tabs-mode: nil -*-
"""
OpenEmbedded Build System Python Library
@@ -1060,7 +1062,7 @@ class digraph:
self.dict={}
#okeys = keys, in order they were added (to optimize firstzero() ordering)
self.okeys=[]
- self.__callback_cache=[]
+ self.__callback_cache=[]
def __str__(self):
str = ""
@@ -1164,11 +1166,11 @@ class digraph:
def walkdown(self, item, callback, debug = None, usecache = False):
if not self.hasnode(item):
return 0
-
- if usecache:
+
+ if usecache:
if self.__callback_cache.count(item):
- if debug:
- print "hit cache for item: %s" % item
+ if debug:
+ print "hit cache for item: %s" % item
return 1
parents = self.getparents(item)
@@ -1176,7 +1178,7 @@ class digraph:
for p in parents:
if p in children:
# print "%s is both parent and child of %s" % (p, item)
- if usecache:
+ if usecache:
self.__callback_cache.append(p)
ret = callback(self, p)
if ret == 0:
@@ -1190,7 +1192,7 @@ class digraph:
ret = self.walkdown(p, callback, debug, usecache)
if ret == 0:
return 0
- if usecache:
+ if usecache:
self.__callback_cache.append(item)
return callback(self, item)
diff --git a/bin/oe/build.py b/bin/oe/build.py
index a04e0437d..c508b972d 100644
--- a/bin/oe/build.py
+++ b/bin/oe/build.py
@@ -1,4 +1,6 @@
-#!usr/bin/python
+#!/usr/bin/env python
+# ex:ts=4:sw=4:tw=78:et
+# -*- tab-width: 4; c-basic-offset: 4; indent-tabs-mode: nil -*-
"""
OpenEmbedded 'Build' implementation
diff --git a/bin/oe/data.py b/bin/oe/data.py
index 9497a4882..562cd4977 100644
--- a/bin/oe/data.py
+++ b/bin/oe/data.py
@@ -1,4 +1,6 @@
-#!/usr/bin/python
+#!/usr/bin/env python
+# ex:ts=4:sw=4:tw=78:et
+# -*- tab-width: 4; c-basic-offset: 4; indent-tabs-mode: nil -*-
"""
OpenEmbedded 'Data' implementations
@@ -12,25 +14,25 @@ Based on functions from the base oe module, Copyright 2003 Holger Schurig
import sys, os, re, time, types
if sys.argv[0][-5:] == "pydoc":
- path = os.path.dirname(os.path.dirname(sys.argv[1]))
+ path = os.path.dirname(os.path.dirname(sys.argv[1]))
else:
- path = os.path.dirname(os.path.dirname(sys.argv[0]))
+ path = os.path.dirname(os.path.dirname(sys.argv[0]))
sys.path.append(path)
from oe import note, debug
def init():
- return {}
+ return {}
_data = init()
def initVar(var, d = _data):
- """Non-destructive var init for data structure"""
- if not var in d:
- d[var] = {}
+ """Non-destructive var init for data structure"""
+ if not var in d:
+ d[var] = {}
- if not "flags" in d[var]:
- d[var]["flags"] = {}
+ if not "flags" in d[var]:
+ d[var]["flags"] = {}
__setvar_regexp__ = {}
__setvar_regexp__["_append"] = re.compile('(?P<base>.*?)%s(_(?P<add>.*))?' % "_append")
@@ -38,417 +40,417 @@ __setvar_regexp__["_prepend"] = re.compile('(?P<base>.*?)%s(_(?P<add>.*))?' % "_
__setvar_regexp__["_delete"] = re.compile('(?P<base>.*?)%s(_(?P<add>.*))?' % "_delete")
def setVar(var, value, d = _data):
- """Set a variable to a given value
-
- Example:
- >>> setVar('TEST', 'testcontents')
- >>> print getVar('TEST')
- testcontents
- """
- for v in ["_append", "_prepend", "_delete"]:
- match = __setvar_regexp__[v].match(var)
- if match:
- base = match.group('base')
- override = match.group('add')
- l = getVarFlag(base, v, d) or []
- if override == 'delete':
- if l.count([value, None]):
- del l[l.index([value, None])]
- l.append([value, override])
- setVarFlag(base, v, l, d)
- return
-
- if not var in d:
- initVar(var, d)
- if getVarFlag(var, 'matchesenv', d):
- delVarFlag(var, 'matchesenv', d)
- setVarFlag(var, 'export', 1, d)
- d[var]["content"] = value
+ """Set a variable to a given value
+
+ Example:
+ >>> setVar('TEST', 'testcontents')
+ >>> print getVar('TEST')
+ testcontents
+ """
+ for v in ["_append", "_prepend", "_delete"]:
+ match = __setvar_regexp__[v].match(var)
+ if match:
+ base = match.group('base')
+ override = match.group('add')
+ l = getVarFlag(base, v, d) or []
+ if override == 'delete':
+ if l.count([value, None]):
+ del l[l.index([value, None])]
+ l.append([value, override])
+ setVarFlag(base, v, l, d)
+ return
+
+ if not var in d:
+ initVar(var, d)
+ if getVarFlag(var, 'matchesenv', d):
+ delVarFlag(var, 'matchesenv', d)
+ setVarFlag(var, 'export', 1, d)
+ d[var]["content"] = value
def getVar(var, d = _data, exp = 0):
- """Gets the value of a variable
-
- Example:
- >>> setVar('TEST', 'testcontents')
- >>> print getVar('TEST')
- testcontents
- """
- if not var in d or not "content" in d[var]:
- return None
- if exp:
- return expand(d[var]["content"], d, var)
- return d[var]["content"]
+ """Gets the value of a variable
+
+ Example:
+ >>> setVar('TEST', 'testcontents')
+ >>> print getVar('TEST')
+ testcontents
+ """
+ if not var in d or not "content" in d[var]:
+ return None
+ if exp:
+ return expand(d[var]["content"], d, var)
+ return d[var]["content"]
def delVar(var, d = _data):
- """Removes a variable from the data set
-
- Example:
- >>> setVar('TEST', 'testcontents')
- >>> print getVar('TEST')
- testcontents
- >>> delVar('TEST')
- >>> print getVar('TEST')
- None
- """
- if var in d:
- del d[var]
+ """Removes a variable from the data set
+
+ Example:
+ >>> setVar('TEST', 'testcontents')
+ >>> print getVar('TEST')
+ testcontents
+ >>> delVar('TEST')
+ >>> print getVar('TEST')
+ None
+ """
+ if var in d:
+ del d[var]
def setVarFlag(var, flag, flagvalue, d = _data):
- """Set a flag for a given variable to a given value
-
- Example:
- >>> setVarFlag('TEST', 'python', 1)
- >>> print getVarFlag('TEST', 'python')
- 1
- """
-# print "d[%s][\"flags\"][%s] = %s" % (var, flag, flagvalue)
- if not var in d:
- initVar(var, d)
- d[var]["flags"][flag] = flagvalue
+ """Set a flag for a given variable to a given value
+
+ Example:
+ >>> setVarFlag('TEST', 'python', 1)
+ >>> print getVarFlag('TEST', 'python')
+ 1
+ """
+# print "d[%s][\"flags\"][%s] = %s" % (var, flag, flagvalue)
+ if not var in d:
+ initVar(var, d)
+ d[var]["flags"][flag] = flagvalue
def getVarFlag(var, flag, d = _data):
- """Gets given flag from given var
+ """Gets given flag from given var
- Example:
- >>> setVarFlag('TEST', 'python', 1)
- >>> print getVarFlag('TEST', 'python')
- 1
- """
- if var in d and "flags" in d[var] and flag in d[var]["flags"]:
- return d[var]["flags"][flag]
- return None
+ Example:
+ >>> setVarFlag('TEST', 'python', 1)
+ >>> print getVarFlag('TEST', 'python')
+ 1
+ """
+ if var in d and "flags" in d[var] and flag in d[var]["flags"]:
+ return d[var]["flags"][flag]
+ return None
def delVarFlag(var, flag, d = _data):
- """Removes a given flag from the variable's flags
+ """Removes a given flag from the variable's flags
- Example:
- >>> setVarFlag('TEST', 'testflag', 1)
- >>> print getVarFlag('TEST', 'testflag')
- 1
- >>> delVarFlag('TEST', 'testflag')
- >>> print getVarFlag('TEST', 'testflag')
- None
+ Example:
+ >>> setVarFlag('TEST', 'testflag', 1)
+ >>> print getVarFlag('TEST', 'testflag')
+ 1
+ >>> delVarFlag('TEST', 'testflag')
+ >>> print getVarFlag('TEST', 'testflag')
+ None
- """
- if var in d and "flags" in d[var] and flag in d[var]["flags"]:
- del d[var]["flags"][flag]
+ """
+ if var in d and "flags" in d[var] and flag in d[var]["flags"]:
+ del d[var]["flags"][flag]
def setVarFlags(var, flags, d = _data):
- """Set the flags for a given variable
-
- Example:
- >>> myflags = {}
- >>> myflags['test'] = 'blah'
- >>> setVarFlags('TEST', myflags)
- >>> print getVarFlag('TEST', 'test')
- blah
- """
- if not var in d:
- initVar(var, d)
- d[var]["flags"] = flags
+ """Set the flags for a given variable
+
+ Example:
+ >>> myflags = {}
+ >>> myflags['test'] = 'blah'
+ >>> setVarFlags('TEST', myflags)
+ >>> print getVarFlag('TEST', 'test')
+ blah
+ """
+ if not var in d:
+ initVar(var, d)
+ d[var]["flags"] = flags
def getVarFlags(var, d = _data):
- """Gets a variable's flags
+ """Gets a variable's flags
- Example:
- >>> setVarFlag('TEST', 'test', 'blah')
- >>> print getVarFlags('TEST')['test']
- blah
- """
- if var in d and "flags" in d[var]:
- return d[var]["flags"]
- return None
+ Example:
+ >>> setVarFlag('TEST', 'test', 'blah')
+ >>> print getVarFlags('TEST')['test']
+ blah
+ """
+ if var in d and "flags" in d[var]:
+ return d[var]["flags"]
+ return None
def delVarFlags(var, d = _data):
- """Removes a variable's flags
+ """Removes a variable's flags
- Example:
- >>> setVarFlag('TEST', 'testflag', 1)
- >>> print getVarFlag('TEST', 'testflag')
- 1
- >>> delVarFlags('TEST')
- >>> print getVarFlags('TEST')
- None
+ Example:
+ >>> setVarFlag('TEST', 'testflag', 1)
+ >>> print getVarFlag('TEST', 'testflag')
+ 1
+ >>> delVarFlags('TEST')
+ >>> print getVarFlags('TEST')
+ None
- """
- if var in d and "flags" in d[var]:
- del d[var]["flags"]
+ """
+ if var in d and "flags" in d[var]:
+ del d[var]["flags"]
def getData(d = _data):
- """Returns the data object used"""
- return d
+ """Returns the data object used"""
+ return d
def setData(newData, d = _data):
- """Sets the data object to the supplied value"""
- d = newData
+ """Sets the data object to the supplied value"""
+ d = newData
__expand_var_regexp__ = re.compile(r"\${[^{}]+}")
__expand_python_regexp__ = re.compile(r"\${@.+?}")
def expand(s, d = _data, varname = None):
- """Variable expansion using the data store.
-
- Example:
- Standard expansion:
- >>> setVar('A', 'sshd')
- >>> print expand('/usr/bin/${A}')
- /usr/bin/sshd
-
- Python expansion:
- >>> print expand('result: ${@37 * 72}')
- result: 2664
- """
- def var_sub(match):
- key = match.group()[2:-1]
- if varname and key:
- if varname == key:
- raise Exception("variable %s references itself!" % varname)
- var = getVar(key, d, 1)
- if var is not None:
- return var
- else:
- return match.group()
-
- def python_sub(match):
- code = match.group()[3:-1]
- import oe
- locals()['d'] = d
- try:
- s = eval(code)
- except:
- oe.note("%s:%s while evaluating:\n%s" % (sys.exc_info()[0], sys.exc_info()[1], code))
- raise
- if type(s) == types.IntType: s = str(s)
- return s
-
- if type(s) is not types.StringType: # sanity check
- return s
-
- while s.find('$') != -1:
- olds = s
- s = __expand_var_regexp__.sub(var_sub, s)
- s = __expand_python_regexp__.sub(python_sub, s)
- if len(s)>2048:
- debug(1, "expanded string too long")
- return s
- if s == olds: break
- return s
+ """Variable expansion using the data store.
+
+ Example:
+ Standard expansion:
+ >>> setVar('A', 'sshd')
+ >>> print expand('/usr/bin/${A}')
+ /usr/bin/sshd
+
+ Python expansion:
+ >>> print expand('result: ${@37 * 72}')
+ result: 2664
+ """
+ def var_sub(match):
+ key = match.group()[2:-1]
+ if varname and key:
+ if varname == key:
+ raise Exception("variable %s references itself!" % varname)
+ var = getVar(key, d, 1)
+ if var is not None:
+ return var
+ else:
+ return match.group()
+
+ def python_sub(match):
+ code = match.group()[3:-1]
+ import oe
+ locals()['d'] = d
+ try:
+ s = eval(code)
+ except:
+ oe.note("%s:%s while evaluating:\n%s" % (sys.exc_info()[0], sys.exc_info()[1], code))
+ raise
+ if type(s) == types.IntType: s = str(s)
+ return s
+
+ if type(s) is not types.StringType: # sanity check
+ return s
+
+ while s.find('$') != -1:
+ olds = s
+ s = __expand_var_regexp__.sub(var_sub, s)
+ s = __expand_python_regexp__.sub(python_sub, s)
+ if len(s)>2048:
+ debug(1, "expanded string too long")
+ return s
+ if s == olds: break
+ return s
def expandKeys(alterdata = _data, readdata = None):
- if readdata == None:
- readdata = alterdata
-
- for key in alterdata.keys():
- ekey = expand(key, readdata)
- if key == ekey:
- continue
- val = getVar(key, alterdata)
- if val is None:
- continue
- setVar(ekey, val, alterdata)
+ if readdata == None:
+ readdata = alterdata
+
+ for key in alterdata.keys():
+ ekey = expand(key, readdata)
+ if key == ekey:
+ continue
+ val = getVar(key, alterdata)
+ if val is None:
+ continue
+ setVar(ekey, val, alterdata)
def expandData(alterdata = _data, readdata = None):
- """For each variable in alterdata, expand it, and update the var contents.
- Replacements use data from readdata.
-
- Example:
- >>> a=init()
- >>> b=init()
- >>> setVar("dlmsg", "dl_dir is ${DL_DIR}", a)
- >>> setVar("DL_DIR", "/path/to/whatever", b)
- >>> expandData(a, b)
- >>> print getVar("dlmsg", a)
- dl_dir is /path/to/whatever
- """
- if readdata == None:
- readdata = alterdata
-
- for key in alterdata.keys():
- val = getVar(key, alterdata)
- if type(val) is not types.StringType:
- continue
- expanded = expand(val, readdata)
-# print "key is %s, val is %s, expanded is %s" % (key, val, expanded)
- if val != expanded:
- setVar(key, expanded, alterdata)
+ """For each variable in alterdata, expand it, and update the var contents.
+ Replacements use data from readdata.
+
+ Example:
+ >>> a=init()
+ >>> b=init()
+ >>> setVar("dlmsg", "dl_dir is ${DL_DIR}", a)
+ >>> setVar("DL_DIR", "/path/to/whatever", b)
+ >>> expandData(a, b)
+ >>> print getVar("dlmsg", a)
+ dl_dir is /path/to/whatever
+ """
+ if readdata == None:
+ readdata = alterdata
+
+ for key in alterdata.keys():
+ val = getVar(key, alterdata)
+ if type(val) is not types.StringType:
+ continue
+ expanded = expand(val, readdata)
+# print "key is %s, val is %s, expanded is %s" % (key, val, expanded)
+ if val != expanded:
+ setVar(key, expanded, alterdata)
import os
def inheritFromOS(d = _data):
- """Inherit variables from the environment."""
- # fakeroot needs to be able to set these
- non_inherit_vars = [ "LD_LIBRARY_PATH", "LD_PRELOAD" ]
- for s in os.environ.keys():
- if not s in non_inherit_vars:
- try:
- setVar(s, os.environ[s], d)
- setVarFlag(s, 'matchesenv', '1', d)
- except TypeError:
- pass
+ """Inherit variables from the environment."""
+# fakeroot needs to be able to set these
+ non_inherit_vars = [ "LD_LIBRARY_PATH", "LD_PRELOAD" ]
+ for s in os.environ.keys():
+ if not s in non_inherit_vars:
+ try:
+ setVar(s, os.environ[s], d)
+ setVarFlag(s, 'matchesenv', '1', d)
+ except TypeError:
+ pass
import sys
def emit_var(var, o=sys.__stdout__, d = _data, all=False):
- """Emit a variable to be sourced by a shell."""
- if getVarFlag(var, "python", d):
- return 0
-
- try:
- if all:
- oval = getVar(var, d, 0)
- val = getVar(var, d, 1)
- except KeyboardInterrupt:
- raise
- except:
- o.write('# expansion of %s threw %s\n' % (var, sys.exc_info()[0]))
- return 0
-
- if all:
- o.write('# %s=%s\n' % (var, oval))
-
- if type(val) is not types.StringType:
- return 0
-
- if getVarFlag(var, 'matchesenv', d):
- return 0
-
- if var.find("-") != -1 or var.find(".") != -1 or var.find('{') != -1 or var.find('}') != -1 or var.find('+') != -1:
- return 0
-
- val.rstrip()
- if not val:
- return 0
-
- if getVarFlag(var, "func", d):
- # NOTE: should probably check for unbalanced {} within the var
- o.write("%s() {\n%s\n}\n" % (var, val))
- else:
- if getVarFlag(var, "export", d):
- o.write('export ')
- else:
- if not all:
- return 0
- # if we're going to output this within doublequotes,
- # to a shell, we need to escape the quotes in the var
- alter = re.sub('"', '\\"', val.strip())
- o.write('%s="%s"\n' % (var, alter))
- return 1
+ """Emit a variable to be sourced by a shell."""
+ if getVarFlag(var, "python", d):
+ return 0
+
+ try:
+ if all:
+ oval = getVar(var, d, 0)
+ val = getVar(var, d, 1)
+ except KeyboardInterrupt:
+ raise
+ except:
+ o.write('# expansion of %s threw %s\n' % (var, sys.exc_info()[0]))
+ return 0
+
+ if all:
+ o.write('# %s=%s\n' % (var, oval))
+
+ if type(val) is not types.StringType:
+ return 0
+
+ if getVarFlag(var, 'matchesenv', d):
+ return 0
+
+ if var.find("-") != -1 or var.find(".") != -1 or var.find('{') != -1 or var.find('}') != -1 or var.find('+') != -1:
+ return 0
+
+ val.rstrip()
+ if not val:
+ return 0
+
+ if getVarFlag(var, "func", d):
+# NOTE: should probably check for unbalanced {} within the var
+ o.write("%s() {\n%s\n}\n" % (var, val))
+ else:
+ if getVarFlag(var, "export", d):
+ o.write('export ')
+ else:
+ if not all:
+ return 0
+# if we're going to output this within doublequotes,
+# to a shell, we need to escape the quotes in the var
+ alter = re.sub('"', '\\"', val.strip())
+ o.write('%s="%s"\n' % (var, alter))
+ return 1
def emit_env(o=sys.__stdout__, d = _data, all=False):
- """Emits all items in the data store in a format such that it can be sourced by a shell."""
+ """Emits all items in the data store in a format such that it can be sourced by a shell."""
- env = d.keys()
+ env = d.keys()
- for e in env:
- if getVarFlag(e, "func", d):
- continue
- emit_var(e, o, d, all) and o.write('\n')
+ for e in env:
+ if getVarFlag(e, "func", d):
+ continue
+ emit_var(e, o, d, all) and o.write('\n')
- for e in env:
- if not getVarFlag(e, "func", d):
- continue
- emit_var(e, o, d) and o.write('\n')
+ for e in env:
+ if not getVarFlag(e, "func", d):
+ continue
+ emit_var(e, o, d) and o.write('\n')
def update_data(d = _data):
- """Modifies the environment vars according to local overrides and commands.
- Examples:
- Appending to a variable:
- >>> setVar('TEST', 'this is a')
- >>> setVar('TEST_append', ' test')
- >>> setVar('TEST_append', ' of the emergency broadcast system.')
- >>> update_data()
- >>> print getVar('TEST')
- this is a test of the emergency broadcast system.
-
- Prepending to a variable:
- >>> setVar('TEST', 'virtual/libc')
- >>> setVar('TEST_prepend', 'virtual/tmake ')
- >>> setVar('TEST_prepend', 'virtual/patcher ')
- >>> update_data()
- >>> print getVar('TEST')
- virtual/patcher virtual/tmake virtual/libc
-
- Overrides:
- >>> setVar('TEST_arm', 'target')
- >>> setVar('TEST_ramses', 'machine')
- >>> setVar('TEST_local', 'local')
- >>> setVar('OVERRIDES', 'arm')
-
- >>> setVar('TEST', 'original')
- >>> update_data()
- >>> print getVar('TEST')
- target
-
- >>> setVar('OVERRIDES', 'arm:ramses:local')
- >>> setVar('TEST', 'original')
- >>> update_data()
- >>> print getVar('TEST')
- local
- """
-
- debug(2, "update_data()")
-
- # can't do delete env[...] while iterating over the dictionary, so remember them
- dodel = []
- overrides = (getVar('OVERRIDES', d, 1) or "").split(':') or []
-
- def applyOverrides(var, d = _data):
- if not overrides:
- debug(1, "OVERRIDES not defined, nothing to do")
- return
- val = getVar(var, d)
- for o in overrides:
- if var.endswith("_" + o):
- l = len(o)+1
- name = var[:-l]
- d[name] = d[var]
-
- for s in d.keys():
- applyOverrides(s, d)
- sval = getVar(s, d) or ""
-
- # Handle line appends:
- for (a, o) in getVarFlag(s, '_append', d) or []:
- delVarFlag(s, '_append', d)
- if o:
- if not o in overrides:
- break
- sval+=a
- setVar(s, sval, d)
-
- # Handle line prepends
- for (a, o) in getVarFlag(s, '_prepend', d) or []:
- delVarFlag(s, '_prepend', d)
- if o:
- if not o in overrides:
- break
- sval=a+sval
- setVar(s, sval, d)
-
- # Handle line deletions
- name = s + "_delete"
- nameval = getVar(name, d)
- if nameval:
- sval = getVar(s, d)
- if sval:
- new = ''
- pattern = nameval.replace('\n','').strip()
- for line in sval.split('\n'):
- if line.find(pattern) == -1:
- new = new + '\n' + line
- setVar(s, new, d)
- dodel.append(name)
-
- # delete all environment vars no longer needed
- for s in dodel:
- delVar(s, d)
+ """Modifies the environment vars according to local overrides and commands.
+ Examples:
+ Appending to a variable:
+ >>> setVar('TEST', 'this is a')
+ >>> setVar('TEST_append', ' test')
+ >>> setVar('TEST_append', ' of the emergency broadcast system.')
+ >>> update_data()
+ >>> print getVar('TEST')
+ this is a test of the emergency broadcast system.
+
+ Prepending to a variable:
+ >>> setVar('TEST', 'virtual/libc')
+ >>> setVar('TEST_prepend', 'virtual/tmake ')
+ >>> setVar('TEST_prepend', 'virtual/patcher ')
+ >>> update_data()
+ >>> print getVar('TEST')
+ virtual/patcher virtual/tmake virtual/libc
+
+ Overrides:
+ >>> setVar('TEST_arm', 'target')
+ >>> setVar('TEST_ramses', 'machine')
+ >>> setVar('TEST_local', 'local')
+ >>> setVar('OVERRIDES', 'arm')
+
+ >>> setVar('TEST', 'original')
+ >>> update_data()
+ >>> print getVar('TEST')
+ target
+
+ >>> setVar('OVERRIDES', 'arm:ramses:local')
+ >>> setVar('TEST', 'original')
+ >>> update_data()
+ >>> print getVar('TEST')
+ local
+ """
+
+ debug(2, "update_data()")
+
+# can't do delete env[...] while iterating over the dictionary, so remember them
+ dodel = []
+ overrides = (getVar('OVERRIDES', d, 1) or "").split(':') or []
+
+ def applyOverrides(var, d = _data):
+ if not overrides:
+ debug(1, "OVERRIDES not defined, nothing to do")
+ return
+ val = getVar(var, d)
+ for o in overrides:
+ if var.endswith("_" + o):
+ l = len(o)+1
+ name = var[:-l]
+ d[name] = d[var]
+
+ for s in d.keys():
+ applyOverrides(s, d)
+ sval = getVar(s, d) or ""
+
+# Handle line appends:
+ for (a, o) in getVarFlag(s, '_append', d) or []:
+ delVarFlag(s, '_append', d)
+ if o:
+ if not o in overrides:
+ break
+ sval+=a
+ setVar(s, sval, d)
+
+# Handle line prepends
+ for (a, o) in getVarFlag(s, '_prepend', d) or []:
+ delVarFlag(s, '_prepend', d)
+ if o:
+ if not o in overrides:
+ break
+ sval=a+sval
+ setVar(s, sval, d)
+
+# Handle line deletions
+ name = s + "_delete"
+ nameval = getVar(name, d)
+ if nameval:
+ sval = getVar(s, d)
+ if sval:
+ new = ''
+ pattern = nameval.replace('\n','').strip()
+ for line in sval.split('\n'):
+ if line.find(pattern) == -1:
+ new = new + '\n' + line
+ setVar(s, new, d)
+ dodel.append(name)
+
+# delete all environment vars no longer needed
+ for s in dodel:
+ delVar(s, d)
def _test():
- """Start a doctest run on this module"""
- import doctest
- from oe import data
- doctest.testmod(data)
+ """Start a doctest run on this module"""
+ import doctest
+ from oe import data
+ doctest.testmod(data)
if __name__ == "__main__":
- _test()
+ _test()
diff --git a/bin/oe/event.py b/bin/oe/event.py
index f86693727..d963d4405 100644
--- a/bin/oe/event.py
+++ b/bin/oe/event.py
@@ -1,4 +1,6 @@
-#!/usr/bin/python
+#!/usr/bin/env python
+# ex:ts=4:sw=4:tw=78:et
+# -*- tab-width: 4; c-basic-offset: 4; indent-tabs-mode: nil -*-
"""
OpenEmbedded 'Event' implementation
@@ -10,180 +12,180 @@ Copyright: (c) 2003-2004 Chris Larson
import os, re
class Event:
- """Base class for events"""
- type = "Event"
+ """Base class for events"""
+ type = "Event"
NotHandled = 0
Handled = 1
handlers = []
def tmpHandler(event):
- """Default handler for code events"""
- return NotHandled
+ """Default handler for code events"""
+ return NotHandled
def defaultTmpHandler():
- tmp = "def tmpHandler(e):\n\t\"\"\"heh\"\"\"\n\treturn 0"
- comp = compile(tmp, "tmpHandler(e)", "exec")
- return comp
+ tmp = "def tmpHandler(e):\n\t\"\"\"heh\"\"\"\n\treturn 0"
+ comp = compile(tmp, "tmpHandler(e)", "exec")
+ return comp
def fire(event):
- """Fire off an Event"""
- for h in handlers:
- if type(h).__name__ == "code":
- exec(h)
- if tmpHandler(event) == Handled:
- return Handled
- else:
- if h(event) == Handled:
- return Handled
- return NotHandled
+ """Fire off an Event"""
+ for h in handlers:
+ if type(h).__name__ == "code":
+ exec(h)
+ if tmpHandler(event) == Handled:
+ return Handled
+ else:
+ if h(event) == Handled:
+ return Handled
+ return NotHandled
def register(handler):
- """Register an Event handler"""
- if handler is not None:
- # handle string containing python code
- if type(handler).__name__ == "str":
- return registerCode(handler)
- # prevent duplicate registration
- if not handler in handlers:
- handlers.append(handler)
+ """Register an Event handler"""
+ if handler is not None:
+# handle string containing python code
+ if type(handler).__name__ == "str":
+ return registerCode(handler)
+# prevent duplicate registration
+ if not handler in handlers:
+ handlers.append(handler)
def registerCode(handlerStr):
- """Register a 'code' Event.
- Deprecated interface; call register instead.
-
- Expects to be passed python code as a string, which will
- be passed in turn to compile() and then exec(). Note that
- the code will be within a function, so should have had
- appropriate tabbing put in place."""
- tmp = "def tmpHandler(e):\n%s" % handlerStr
- comp = compile(tmp, "tmpHandler(e)", "exec")
- # prevent duplicate registration
- if not comp in handlers:
- handlers.append(comp)
+ """Register a 'code' Event.
+ Deprecated interface; call register instead.
+
+ Expects to be passed python code as a string, which will
+ be passed in turn to compile() and then exec(). Note that
+ the code will be within a function, so should have had
+ appropriate tabbing put in place."""
+ tmp = "def tmpHandler(e):\n%s" % handlerStr
+ comp = compile(tmp, "tmpHandler(e)", "exec")
+# prevent duplicate registration
+ if not comp in handlers:
+ handlers.append(comp)
def remove(handler):
- """Remove an Event handler"""
- for h in handlers:
- if type(handler).__name__ == "str":
- return removeCode(handler)
+ """Remove an Event handler"""
+ for h in handlers:
+ if type(handler).__name__ == "str":
+ return removeCode(handler)
- if handler is h:
- handlers.remove(handler)
+ if handler is h:
+ handlers.remove(handler)
def removeCode(handlerStr):
- """Remove a 'code' Event handler
- Deprecated interface; call remove instead."""
- tmp = "def tmpHandler(e):\n%s" % handlerStr
- comp = compile(tmp, "tmpHandler(e)", "exec")
- handlers.remove(comp)
+ """Remove a 'code' Event handler
+ Deprecated interface; call remove instead."""
+ tmp = "def tmpHandler(e):\n%s" % handlerStr
+ comp = compile(tmp, "tmpHandler(e)", "exec")
+ handlers.remove(comp)
def getName(e):
- """Returns the name of a class or class instance"""
- if getattr(e, "__name__", None) == None:
- return e.__class__.__name__
- else:
- return e.__name__
+ """Returns the name of a class or class instance"""
+ if getattr(e, "__name__", None) == None:
+ return e.__class__.__name__
+ else:
+ return e.__name__
class PkgBase(Event):
- """Base class for package events"""
+ """Base class for package events"""
- def __init__(self, t, d = {}):
- self.pkg = t
- self.data = d
+ def __init__(self, t, d = {}):
+ self.pkg = t
+ self.data = d
- def getPkg(self):
- return self._pkg
+ def getPkg(self):
+ return self._pkg
- def setPkg(self, pkg):
- self._pkg = pkg
+ def setPkg(self, pkg):
+ self._pkg = pkg
- def getData(self):
- return self._data
+ def getData(self):
+ return self._data
- def setData(self, data):
- self._data = data
+ def setData(self, data):
+ self._data = data
- pkg = property(getPkg, setPkg, None, "pkg property")
- data = property(getData, setData, None, "data property")
+ pkg = property(getPkg, setPkg, None, "pkg property")
+ data = property(getData, setData, None, "data property")
class BuildBase(Event):
- """Base class for oemake run events"""
+ """Base class for oemake run events"""
- def __init__(self, n, p, c):
- self.name = n
- self.pkgs = p
- self.cfg = c
+ def __init__(self, n, p, c):
+ self.name = n
+ self.pkgs = p
+ self.cfg = c
- def getPkgs(self):
- return self._pkgs
+ def getPkgs(self):
+ return self._pkgs
- def setPkgs(self, pkgs):
- self._pkgs = pkgs
+ def setPkgs(self, pkgs):
+ self._pkgs = pkgs
- def getName(self):
- return self._name
+ def getName(self):
+ return self._name
- def setName(self, name):
- self._name = name
+ def setName(self, name):
+ self._name = name
- def getCfg(self):
- return self._cfg
+ def getCfg(self):
+ return self._cfg
- def setCfg(self, cfg):
- self._cfg = cfg
+ def setCfg(self, cfg):
+ self._cfg = cfg
- pkgs = property(getPkgs, setPkgs, None, "pkgs property")
- name = property(getName, setName, None, "name property")
- cfg = property(getCfg, setCfg, None, "cfg property")
+ pkgs = property(getPkgs, setPkgs, None, "pkgs property")
+ name = property(getName, setName, None, "name property")
+ cfg = property(getCfg, setCfg, None, "cfg property")
class DepBase(PkgBase):
- """Base class for dependency events"""
+ """Base class for dependency events"""
- def __init__(self, t, data, d):
- self.dep = d
- PkgBase.__init__(self, t, data)
+ def __init__(self, t, data, d):
+ self.dep = d
+ PkgBase.__init__(self, t, data)
- def getDep(self):
- return self._dep
+ def getDep(self):
+ return self._dep
- def setDep(self, dep):
- self._dep = dep
+ def setDep(self, dep):
+ self._dep = dep
- dep = property(getDep, setDep, None, "dep property")
+ dep = property(getDep, setDep, None, "dep property")
class PkgStarted(PkgBase):
- """Package build started"""
+ """Package build started"""
class PkgFailed(PkgBase):
- """Package build failed"""
+ """Package build failed"""
class PkgSucceeded(PkgBase):
- """Package build completed"""
+ """Package build completed"""
class BuildStarted(BuildBase):
- """oemake build run started"""
+ """oemake build run started"""
class BuildCompleted(BuildBase):
- """oemake build run completed"""
+ """oemake build run completed"""
class UnsatisfiedDep(DepBase):
- """Unsatisfied Dependency"""
+ """Unsatisfied Dependency"""
class RecursiveDep(DepBase):
- """Recursive Dependency"""
+ """Recursive Dependency"""
class MultipleProviders(PkgBase):
- """Multiple Providers"""
+ """Multiple Providers"""
diff --git a/bin/oe/fetch.py b/bin/oe/fetch.py
index 6dfb66df1..ecc69be13 100644
--- a/bin/oe/fetch.py
+++ b/bin/oe/fetch.py
@@ -1,4 +1,6 @@
-#!/usr/bin/python
+#!/usr/bin/env python
+# ex:ts=4:sw=4:tw=78:et
+# -*- tab-width: 4; c-basic-offset: 4; indent-tabs-mode: nil -*-
"""
OpenEmbedded 'Fetch' implementations
@@ -17,414 +19,414 @@ import oe
import oe.data
class FetchError(Exception):
- """Exception raised when a download fails"""
+ """Exception raised when a download fails"""
class NoMethodError(Exception):
- """Exception raised when there is no method to obtain a supplied url or set of urls"""
+ """Exception raised when there is no method to obtain a supplied url or set of urls"""
class MissingParameterError(Exception):
- """Exception raised when a fetch method is missing a critical parameter in the url"""
+ """Exception raised when a fetch method is missing a critical parameter in the url"""
#decodeurl("cvs://anoncvs:anonymous@cvs.handhelds.org/cvs;module=familiar/dist/ipkg;tag=V0-99-81")
#('cvs', 'cvs.handhelds.org', '/cvs', 'anoncvs', 'anonymous', {'tag': 'V0-99-81', 'module': 'familiar/dist/ipkg'})
def uri_replace(uri, uri_find, uri_replace, d = oe.data.init()):
-# oe.note("uri_replace: operating on %s" % uri)
- if not uri or not uri_find or not uri_replace:
- oe.debug(1, "uri_replace: passed an undefined value, not replacing")
- uri_decoded = list(oe.decodeurl(uri))
- uri_find_decoded = list(oe.decodeurl(uri_find))
- uri_replace_decoded = list(oe.decodeurl(uri_replace))
- result_decoded = ['','','','','',{}]
- for i in uri_find_decoded:
- loc = uri_find_decoded.index(i)
- result_decoded[loc] = uri_decoded[loc]
- import types
- if type(i) == types.StringType:
- import re
- if (re.match(i, uri_decoded[loc])):
- result_decoded[loc] = re.sub(i, uri_replace_decoded[loc], uri_decoded[loc])
- if uri_find_decoded.index(i) == 2:
- if d:
- localfn = oe.fetch.localpath(uri, d)
- if localfn:
- result_decoded[loc] = os.path.dirname(result_decoded[loc]) + "/" + os.path.basename(oe.fetch.localpath(uri, d))
-# oe.note("uri_replace: matching %s against %s and replacing with %s" % (i, uri_decoded[loc], uri_replace_decoded[loc]))
- else:
-# oe.note("uri_replace: no match")
- return uri
-# else:
-# for j in i.keys():
-# FIXME: apply replacements against options
- return oe.encodeurl(result_decoded)
+# oe.note("uri_replace: operating on %s" % uri)
+ if not uri or not uri_find or not uri_replace:
+ oe.debug(1, "uri_replace: passed an undefined value, not replacing")
+ uri_decoded = list(oe.decodeurl(uri))
+ uri_find_decoded = list(oe.decodeurl(uri_find))
+ uri_replace_decoded = list(oe.decodeurl(uri_replace))
+ result_decoded = ['','','','','',{}]
+ for i in uri_find_decoded:
+ loc = uri_find_decoded.index(i)
+ result_decoded[loc] = uri_decoded[loc]
+ import types
+ if type(i) == types.StringType:
+ import re
+ if (re.match(i, uri_decoded[loc])):
+ result_decoded[loc] = re.sub(i, uri_replace_decoded[loc], uri_decoded[loc])
+ if uri_find_decoded.index(i) == 2:
+ if d:
+ localfn = oe.fetch.localpath(uri, d)
+ if localfn:
+ result_decoded[loc] = os.path.dirname(result_decoded[loc]) + "/" + os.path.basename(oe.fetch.localpath(uri, d))
+# oe.note("uri_replace: matching %s against %s and replacing with %s" % (i, uri_decoded[loc], uri_replace_decoded[loc]))
+ else:
+# oe.note("uri_replace: no match")
+ return uri
+# else:
+# for j in i.keys():
+# FIXME: apply replacements against options
+ return oe.encodeurl(result_decoded)
methods = []
def init(urls = [], d = oe.data.init()):
- for m in methods:
- m.urls = []
+ for m in methods:
+ m.urls = []
- for u in urls:
- for m in methods:
- m.data = d
- if m.supports(u, d):
- m.urls.append(u)
+ for u in urls:
+ for m in methods:
+ m.data = d
+ if m.supports(u, d):
+ m.urls.append(u)
def go(d = oe.data.init()):
- """Fetch all urls"""
- for m in methods:
- if m.urls:
- m.go(d)
+ """Fetch all urls"""
+ for m in methods:
+ if m.urls:
+ m.go(d)
def localpaths(d):
- """Return a list of the local filenames, assuming successful fetch"""
- local = []
- for m in methods:
- for u in m.urls:
- local.append(m.localpath(u, d))
- return local
+ """Return a list of the local filenames, assuming successful fetch"""
+ local = []
+ for m in methods:
+ for u in m.urls:
+ local.append(m.localpath(u, d))
+ return local
def localpath(url, d = oe.data.init()):
- for m in methods:
- if m.supports(url, d):
- return m.localpath(url, d)
- return url
+ for m in methods:
+ if m.supports(url, d):
+ return m.localpath(url, d)
+ return url
class Fetch(object):
- """Base class for 'fetch'ing data"""
+ """Base class for 'fetch'ing data"""
- def __init__(self, urls = []):
- self.urls = []
- for url in urls:
- if self.supports(oe.decodeurl(url), d) is 1:
- self.urls.append(url)
+ def __init__(self, urls = []):
+ self.urls = []
+ for url in urls:
+ if self.supports(oe.decodeurl(url), d) is 1:
+ self.urls.append(url)
- def supports(url, d):
- """Check to see if this fetch class supports a given url.
- Expects supplied url in list form, as outputted by oe.decodeurl().
- """
- return 0
- supports = staticmethod(supports)
+ def supports(url, d):
+ """Check to see if this fetch class supports a given url.
+ Expects supplied url in list form, as outputted by oe.decodeurl().
+ """
+ return 0
+ supports = staticmethod(supports)
- def localpath(url, d = oe.data.init()):
- """Return the local filename of a given url assuming a successful fetch.
- """
- return url
- localpath = staticmethod(localpath)
+ def localpath(url, d = oe.data.init()):
+ """Return the local filename of a given url assuming a successful fetch.
+ """
+ return url
+ localpath = staticmethod(localpath)
- def setUrls(self, urls):
- self.__urls = urls
+ def setUrls(self, urls):
+ self.__urls = urls
- def getUrls(self):
- return self.__urls
+ def getUrls(self):
+ return self.__urls
- urls = property(getUrls, setUrls, None, "Urls property")
+ urls = property(getUrls, setUrls, None, "Urls property")
- def setData(self, data):
- self.__data = data
+ def setData(self, data):
+ self.__data = data
- def getData(self):
- return self.__data
+ def getData(self):
+ return self.__data
- data = property(getData, setData, None, "Data property")
+ data = property(getData, setData, None, "Data property")
- def go(self, urls = []):
- """Fetch urls"""
- raise NoMethodError("Missing implementation for url")
+ def go(self, urls = []):
+ """Fetch urls"""
+ raise NoMethodError("Missing implementation for url")
class Wget(Fetch):
- """Class to fetch urls via 'wget'"""
- def supports(url, d):
- """Check to see if a given url can be fetched using wget.
- Expects supplied url in list form, as outputted by oe.decodeurl().
- """
- (type, host, path, user, pswd, parm) = oe.decodeurl(oe.data.expand(url, d))
- return type in ['http','https','ftp']
- supports = staticmethod(supports)
-
- def localpath(url, d):
- # strip off parameters
- (type, host, path, user, pswd, parm) = oe.decodeurl(oe.data.expand(url, d))
- if "localpath" in parm:
- # if user overrides local path, use it.
- return parm["localpath"]
- url = oe.encodeurl([type, host, path, user, pswd, {}])
- return os.path.join(oe.data.getVar("DL_DIR", d), os.path.basename(url))
- localpath = staticmethod(localpath)
-
- def go(self, d = oe.data.init(), urls = []):
- """Fetch urls"""
- def fetch_uri(uri, basename, dl, md5, d):
- if os.path.exists(dl):
- # file exists, but we didnt complete it.. trying again..
- fetchcmd = oe.data.getVar("RESUMECOMMAND", d, 1)
- else:
- fetchcmd = oe.data.getVar("FETCHCOMMAND", d, 1)
-
- oe.note("fetch " + uri)
- fetchcmd = fetchcmd.replace("${URI}", uri)
- fetchcmd = fetchcmd.replace("${FILE}", basename)
- oe.debug(2, "executing " + fetchcmd)
- ret = os.system(fetchcmd)
- if ret != 0:
- return False
-
- # supposedly complete.. write out md5sum
- if oe.which(oe.data.getVar('PATH', d), 'md5sum'):
- try:
- md5pipe = os.popen('md5sum ' + dl)
- md5data = (md5pipe.readline().split() or [ "" ])[0]
- md5pipe.close()
- except OSError:
- md5data = ""
- md5out = file(md5, 'w')
- md5out.write(md5data)
- md5out.close()
- else:
- md5out = file(md5, 'w')
- md5out.write("")
- md5out.close()
- return True
-
- if not urls:
- urls = self.urls
-
- from copy import deepcopy
- localdata = deepcopy(d)
- oe.data.setVar('OVERRIDES', "wget:" + oe.data.getVar('OVERRIDES', localdata), localdata)
- oe.data.update_data(localdata)
-
- for uri in urls:
- completed = 0
- (type, host, path, user, pswd, parm) = oe.decodeurl(oe.data.expand(uri, localdata))
- basename = os.path.basename(path)
- dl = self.localpath(uri, d)
- dl = oe.data.expand(dl, localdata)
- md5 = dl + '.md5'
-
- if os.path.exists(md5):
- # complete, nothing to see here..
- continue
-
- premirrors = [ i.split() for i in (oe.data.getVar('PREMIRRORS', localdata, 1) or "").split('\n') if i ]
- for (find, replace) in premirrors:
- newuri = uri_replace(uri, find, replace)
- if newuri != uri:
- if fetch_uri(newuri, basename, dl, md5, localdata):
- completed = 1
- break
-
- if completed:
- continue
-
- if fetch_uri(uri, basename, dl, md5, localdata):
- continue
-
- # try mirrors
- mirrors = [ i.split() for i in (oe.data.getVar('MIRRORS', localdata, 1) or "").split('\n') if i ]
- for (find, replace) in mirrors:
- newuri = uri_replace(uri, find, replace)
- if newuri != uri:
- if fetch_uri(newuri, basename, dl, md5, localdata):
- completed = 1
- break
-
- if not completed:
- raise FetchError(uri)
-
- del localdata
+ """Class to fetch urls via 'wget'"""
+ def supports(url, d):
+ """Check to see if a given url can be fetched using wget.
+ Expects supplied url in list form, as outputted by oe.decodeurl().
+ """
+ (type, host, path, user, pswd, parm) = oe.decodeurl(oe.data.expand(url, d))
+ return type in ['http','https','ftp']
+ supports = staticmethod(supports)
+
+ def localpath(url, d):
+# strip off parameters
+ (type, host, path, user, pswd, parm) = oe.decodeurl(oe.data.expand(url, d))
+ if "localpath" in parm:
+# if user overrides local path, use it.
+ return parm["localpath"]
+ url = oe.encodeurl([type, host, path, user, pswd, {}])
+ return os.path.join(oe.data.getVar("DL_DIR", d), os.path.basename(url))
+ localpath = staticmethod(localpath)
+
+ def go(self, d = oe.data.init(), urls = []):
+ """Fetch urls"""
+ def fetch_uri(uri, basename, dl, md5, d):
+ if os.path.exists(dl):
+# file exists, but we didnt complete it.. trying again..
+ fetchcmd = oe.data.getVar("RESUMECOMMAND", d, 1)
+ else:
+ fetchcmd = oe.data.getVar("FETCHCOMMAND", d, 1)
+
+ oe.note("fetch " + uri)
+ fetchcmd = fetchcmd.replace("${URI}", uri)
+ fetchcmd = fetchcmd.replace("${FILE}", basename)
+ oe.debug(2, "executing " + fetchcmd)
+ ret = os.system(fetchcmd)
+ if ret != 0:
+ return False
+
+# supposedly complete.. write out md5sum
+ if oe.which(oe.data.getVar('PATH', d), 'md5sum'):
+ try:
+ md5pipe = os.popen('md5sum ' + dl)
+ md5data = (md5pipe.readline().split() or [ "" ])[0]
+ md5pipe.close()
+ except OSError:
+ md5data = ""
+ md5out = file(md5, 'w')
+ md5out.write(md5data)
+ md5out.close()
+ else:
+ md5out = file(md5, 'w')
+ md5out.write("")
+ md5out.close()
+ return True
+
+ if not urls:
+ urls = self.urls
+
+ from copy import deepcopy
+ localdata = deepcopy(d)
+ oe.data.setVar('OVERRIDES', "wget:" + oe.data.getVar('OVERRIDES', localdata), localdata)
+ oe.data.update_data(localdata)
+
+ for uri in urls:
+ completed = 0
+ (type, host, path, user, pswd, parm) = oe.decodeurl(oe.data.expand(uri, localdata))
+ basename = os.path.basename(path)
+ dl = self.localpath(uri, d)
+ dl = oe.data.expand(dl, localdata)
+ md5 = dl + '.md5'
+
+ if os.path.exists(md5):
+# complete, nothing to see here..
+ continue
+
+ premirrors = [ i.split() for i in (oe.data.getVar('PREMIRRORS', localdata, 1) or "").split('\n') if i ]
+ for (find, replace) in premirrors:
+ newuri = uri_replace(uri, find, replace)
+ if newuri != uri:
+ if fetch_uri(newuri, basename, dl, md5, localdata):
+ completed = 1
+ break
+
+ if completed:
+ continue
+
+ if fetch_uri(uri, basename, dl, md5, localdata):
+ continue
+
+# try mirrors
+ mirrors = [ i.split() for i in (oe.data.getVar('MIRRORS', localdata, 1) or "").split('\n') if i ]
+ for (find, replace) in mirrors:
+ newuri = uri_replace(uri, find, replace)
+ if newuri != uri:
+ if fetch_uri(newuri, basename, dl, md5, localdata):
+ completed = 1
+ break
+
+ if not completed:
+ raise FetchError(uri)
+
+ del localdata
methods.append(Wget())
class Cvs(Fetch):
- """Class to fetch a module or modules from cvs repositories"""
- def supports(url, d):
- """Check to see if a given url can be fetched with cvs.
- Expects supplied url in list form, as outputted by oe.decodeurl().
- """
- (type, host, path, user, pswd, parm) = oe.decodeurl(oe.data.expand(url, d))
- return type in ['cvs', 'pserver']
- supports = staticmethod(supports)
-
- def localpath(url, d):
- (type, host, path, user, pswd, parm) = oe.decodeurl(oe.data.expand(url, d))
- if "localpath" in parm:
- # if user overrides local path, use it.
- return parm["localpath"]
-
- if not "module" in parm:
- raise MissingParameterError("cvs method needs a 'module' parameter")
- else:
- module = parm["module"]
- if 'tag' in parm:
- tag = parm['tag']
- else:
- tag = ""
- if 'date' in parm:
- date = parm['date']
- else:
- if not tag or tag == "HEAD":
- date = oe.data.getVar("CVSDATE", d, 1) or oe.data.getVar("DATE", d, 1)
- else:
- date = ""
-
- return os.path.join(oe.data.getVar("DL_DIR", d, 1),oe.data.expand('%s_%s_%s_%s.tar.gz' % ( module.replace('/', '.'), host, tag, date), d))
- localpath = staticmethod(localpath)
-
- def go(self, d = oe.data.init(), urls = []):
- """Fetch urls"""
- if not urls:
- urls = self.urls
-
- from copy import deepcopy
- localdata = deepcopy(d)
- oe.data.setVar('OVERRIDES', "cvs:%s" % oe.data.getVar('OVERRIDES', localdata), localdata)
- oe.data.update_data(localdata)
-
- for loc in urls:
- (type, host, path, user, pswd, parm) = oe.decodeurl(oe.data.expand(loc, localdata))
- if not "module" in parm:
- raise MissingParameterError("cvs method needs a 'module' parameter")
- else:
- module = parm["module"]
-
- dlfile = self.localpath(loc, localdata)
- dldir = oe.data.getVar('DL_DIR', localdata, 1)
- # if local path contains the cvs
- # module, consider the dir above it to be the
- # download directory
-# pos = dlfile.find(module)
-# if pos:
-# dldir = dlfile[:pos]
-# else:
-# dldir = os.path.dirname(dlfile)
-
- # setup cvs options
- options = []
- if 'tag' in parm:
- tag = parm['tag']
- else:
- tag = ""
-
- if 'date' in parm:
- date = parm['date']
- else:
- if not tag or tag == "HEAD":
- date = oe.data.getVar("CVSDATE", d, 1) or oe.data.getVar("DATE", d, 1)
- else:
- date = ""
-
- if "method" in parm:
- method = parm["method"]
- else:
- method = "pserver"
-
- tarfn = oe.data.expand('%s_%s_%s_%s.tar.gz' % (module.replace('/', '.'), host, tag, date), localdata)
- oe.data.setVar('TARFILES', dlfile, localdata)
- oe.data.setVar('TARFN', tarfn, localdata)
-
- dl = os.path.join(dldir, tarfn)
- if os.access(dl, os.R_OK):
- oe.debug(1, "%s already exists, skipping cvs checkout." % tarfn)
- continue
-
- cvs_tarball_stash = oe.data.getVar('CVS_TARBALL_STASH', d, 1)
- if cvs_tarball_stash:
- fetchcmd = oe.data.getVar("FETCHCOMMAND_wget", d, 1)
- uri = cvs_tarball_stash + tarfn
- oe.note("fetch " + uri)
- fetchcmd = fetchcmd.replace("${URI}", uri)
- ret = os.system(fetchcmd)
- if ret == 0:
- oe.note("Fetched %s from tarball stash, skipping checkout" % tarfn)
- continue
-
- if date:
- options.append("-D %s" % date)
- if tag:
- options.append("-r %s" % tag)
-
- olddir = os.path.abspath(os.getcwd())
- os.chdir(oe.data.expand(dldir, localdata))
-
- # setup cvsroot
- cvsroot = ":" + method + ":" + user
- if pswd:
- cvsroot += ":" + pswd
- cvsroot += "@" + host + ":" + path
-
- oe.data.setVar('CVSROOT', cvsroot, localdata)
- oe.data.setVar('CVSCOOPTS', " ".join(options), localdata)
- oe.data.setVar('CVSMODULE', module, localdata)
- cvscmd = oe.data.getVar('FETCHCOMMAND', localdata, 1)
-
- # create temp directory
- oe.debug(2, "Fetch: creating temporary directory")
- oe.mkdirhier(oe.data.expand('${WORKDIR}', localdata))
- oe.data.setVar('TMPBASE', oe.data.expand('${WORKDIR}/oecvs.XXXXXX', localdata), localdata)
- tmppipe = os.popen(oe.data.getVar('MKTEMPDIRCMD', localdata, 1) or "false")
- tmpfile = tmppipe.readline().strip()
- if not tmpfile:
- oe.error("Fetch: unable to create temporary directory.. make sure 'mktemp' is in the PATH.")
- raise FetchError(module)
-
- # check out sources there
- os.chdir(tmpfile)
- oe.note("Fetch " + loc)
- oe.debug(1, "Running %s" % cvscmd)
- myret = os.system(cvscmd)
- if myret != 0:
- try:
- os.rmdir(tmpfile)
- except OSError:
- pass
- raise FetchError(module)
-
- os.chdir(os.path.join(tmpfile, os.path.dirname(module)))
- # tar them up to a defined filename
- myret = os.system("tar -czvf %s %s" % (os.path.join(dldir,tarfn), os.path.basename(module)))
- if myret != 0:
- try:
- os.unlink(tarfn)
- except OSError:
- pass
- # cleanup
- os.system('rm -rf %s' % tmpfile)
- os.chdir(olddir)
- del localdata
+ """Class to fetch a module or modules from cvs repositories"""
+ def supports(url, d):
+ """Check to see if a given url can be fetched with cvs.
+ Expects supplied url in list form, as outputted by oe.decodeurl().
+ """
+ (type, host, path, user, pswd, parm) = oe.decodeurl(oe.data.expand(url, d))
+ return type in ['cvs', 'pserver']
+ supports = staticmethod(supports)
+
+ def localpath(url, d):
+ (type, host, path, user, pswd, parm) = oe.decodeurl(oe.data.expand(url, d))
+ if "localpath" in parm:
+# if user overrides local path, use it.
+ return parm["localpath"]
+
+ if not "module" in parm:
+ raise MissingParameterError("cvs method needs a 'module' parameter")
+ else:
+ module = parm["module"]
+ if 'tag' in parm:
+ tag = parm['tag']
+ else:
+ tag = ""
+ if 'date' in parm:
+ date = parm['date']
+ else:
+ if not tag or tag == "HEAD":
+ date = oe.data.getVar("CVSDATE", d, 1) or oe.data.getVar("DATE", d, 1)
+ else:
+ date = ""
+
+ return os.path.join(oe.data.getVar("DL_DIR", d, 1),oe.data.expand('%s_%s_%s_%s.tar.gz' % ( module.replace('/', '.'), host, tag, date), d))
+ localpath = staticmethod(localpath)
+
+ def go(self, d = oe.data.init(), urls = []):
+ """Fetch urls"""
+ if not urls:
+ urls = self.urls
+
+ from copy import deepcopy
+ localdata = deepcopy(d)
+ oe.data.setVar('OVERRIDES', "cvs:%s" % oe.data.getVar('OVERRIDES', localdata), localdata)
+ oe.data.update_data(localdata)
+
+ for loc in urls:
+ (type, host, path, user, pswd, parm) = oe.decodeurl(oe.data.expand(loc, localdata))
+ if not "module" in parm:
+ raise MissingParameterError("cvs method needs a 'module' parameter")
+ else:
+ module = parm["module"]
+
+ dlfile = self.localpath(loc, localdata)
+ dldir = oe.data.getVar('DL_DIR', localdata, 1)
+# if local path contains the cvs
+# module, consider the dir above it to be the
+# download directory
+# pos = dlfile.find(module)
+# if pos:
+# dldir = dlfile[:pos]
+# else:
+# dldir = os.path.dirname(dlfile)
+
+# setup cvs options
+ options = []
+ if 'tag' in parm:
+ tag = parm['tag']
+ else:
+ tag = ""
+
+ if 'date' in parm:
+ date = parm['date']
+ else:
+ if not tag or tag == "HEAD":
+ date = oe.data.getVar("CVSDATE", d, 1) or oe.data.getVar("DATE", d, 1)
+ else:
+ date = ""
+
+ if "method" in parm:
+ method = parm["method"]
+ else:
+ method = "pserver"
+
+ tarfn = oe.data.expand('%s_%s_%s_%s.tar.gz' % (module.replace('/', '.'), host, tag, date), localdata)
+ oe.data.setVar('TARFILES', dlfile, localdata)
+ oe.data.setVar('TARFN', tarfn, localdata)
+
+ dl = os.path.join(dldir, tarfn)
+ if os.access(dl, os.R_OK):
+ oe.debug(1, "%s already exists, skipping cvs checkout." % tarfn)
+ continue
+
+ cvs_tarball_stash = oe.data.getVar('CVS_TARBALL_STASH', d, 1)
+ if cvs_tarball_stash:
+ fetchcmd = oe.data.getVar("FETCHCOMMAND_wget", d, 1)
+ uri = cvs_tarball_stash + tarfn
+ oe.note("fetch " + uri)
+ fetchcmd = fetchcmd.replace("${URI}", uri)
+ ret = os.system(fetchcmd)
+ if ret == 0:
+ oe.note("Fetched %s from tarball stash, skipping checkout" % tarfn)
+ continue
+
+ if date:
+ options.append("-D %s" % date)
+ if tag:
+ options.append("-r %s" % tag)
+
+ olddir = os.path.abspath(os.getcwd())
+ os.chdir(oe.data.expand(dldir, localdata))
+
+# setup cvsroot
+ cvsroot = ":" + method + ":" + user
+ if pswd:
+ cvsroot += ":" + pswd
+ cvsroot += "@" + host + ":" + path
+
+ oe.data.setVar('CVSROOT', cvsroot, localdata)
+ oe.data.setVar('CVSCOOPTS', " ".join(options), localdata)
+ oe.data.setVar('CVSMODULE', module, localdata)
+ cvscmd = oe.data.getVar('FETCHCOMMAND', localdata, 1)
+
+# create temp directory
+ oe.debug(2, "Fetch: creating temporary directory")
+ oe.mkdirhier(oe.data.expand('${WORKDIR}', localdata))
+ oe.data.setVar('TMPBASE', oe.data.expand('${WORKDIR}/oecvs.XXXXXX', localdata), localdata)
+ tmppipe = os.popen(oe.data.getVar('MKTEMPDIRCMD', localdata, 1) or "false")
+ tmpfile = tmppipe.readline().strip()
+ if not tmpfile:
+ oe.error("Fetch: unable to create temporary directory.. make sure 'mktemp' is in the PATH.")
+ raise FetchError(module)
+
+# check out sources there
+ os.chdir(tmpfile)
+ oe.note("Fetch " + loc)
+ oe.debug(1, "Running %s" % cvscmd)
+ myret = os.system(cvscmd)
+ if myret != 0:
+ try:
+ os.rmdir(tmpfile)
+ except OSError:
+ pass
+ raise FetchError(module)
+
+ os.chdir(os.path.join(tmpfile, os.path.dirname(module)))
+# tar them up to a defined filename
+ myret = os.system("tar -czvf %s %s" % (os.path.join(dldir,tarfn), os.path.basename(module)))
+ if myret != 0:
+ try:
+ os.unlink(tarfn)
+ except OSError:
+ pass
+# cleanup
+ os.system('rm -rf %s' % tmpfile)
+ os.chdir(olddir)
+ del localdata
methods.append(Cvs())
class Bk(Fetch):
- def supports(url, d):
- """Check to see if a given url can be fetched via bitkeeper.
- Expects supplied url in list form, as outputted by oe.decodeurl().
- """
- (type, host, path, user, pswd, parm) = oe.decodeurl(oe.data.expand(url, d))
- return type in ['bk']
- supports = staticmethod(supports)
+ def supports(url, d):
+ """Check to see if a given url can be fetched via bitkeeper.
+ Expects supplied url in list form, as outputted by oe.decodeurl().
+ """
+ (type, host, path, user, pswd, parm) = oe.decodeurl(oe.data.expand(url, d))
+ return type in ['bk']
+ supports = staticmethod(supports)
methods.append(Bk())
class Local(Fetch):
- def supports(url, d):
- """Check to see if a given url can be fetched in the local filesystem.
- Expects supplied url in list form, as outputted by oe.decodeurl().
- """
- (type, host, path, user, pswd, parm) = oe.decodeurl(oe.data.expand(url, d))
- return type in ['file','patch']
- supports = staticmethod(supports)
-
- def localpath(url, d):
- """Return the local filename of a given url assuming a successful fetch.
- """
- return url.split("://")[1]
- localpath = staticmethod(localpath)
-
- def go(self, urls = []):
- """Fetch urls (no-op for Local method)"""
- # no need to fetch local files, we'll deal with them in place.
- return 1
+ def supports(url, d):
+ """Check to see if a given url can be fetched in the local filesystem.
+ Expects supplied url in list form, as outputted by oe.decodeurl().
+ """
+ (type, host, path, user, pswd, parm) = oe.decodeurl(oe.data.expand(url, d))
+ return type in ['file','patch']
+ supports = staticmethod(supports)
+
+ def localpath(url, d):
+ """Return the local filename of a given url assuming a successful fetch.
+ """
+ return url.split("://")[1]
+ localpath = staticmethod(localpath)
+
+ def go(self, urls = []):
+ """Fetch urls (no-op for Local method)"""
+# no need to fetch local files, we'll deal with them in place.
+ return 1
methods.append(Local())
diff --git a/bin/oe/make.py b/bin/oe/make.py
index 0b9df5a4f..3f4e0f010 100644
--- a/bin/oe/make.py
+++ b/bin/oe/make.py
@@ -1,4 +1,6 @@
-#!/usr/bin/python
+#!/usr/bin/env python
+# ex:ts=4:sw=4:tw=78:et
+# -*- tab-width: 4; c-basic-offset: 4; indent-tabs-mode: nil -*-
"""
OpenEmbedded 'Make' implementations
@@ -178,48 +180,48 @@ def collect_oefiles( progressCallback ):
pass
def explode_version(s):
- import string
- r = []
- alpha_regexp = re.compile('^([a-zA-Z]+)(.*)$')
- numeric_regexp = re.compile('^(\d+)(.*)$')
- while (s != ''):
- if s[0] in digits:
- m = numeric_regexp.match(s)
- r.append(int(m.group(1)))
- s = m.group(2)
- continue
- if s[0] in ascii_letters:
- m = alpha_regexp.match(s)
- r.append(m.group(1))
- s = m.group(2)
- continue
- s = s[1:]
- return r
+ import string
+ r = []
+ alpha_regexp = re.compile('^([a-zA-Z]+)(.*)$')
+ numeric_regexp = re.compile('^(\d+)(.*)$')
+ while (s != ''):
+ if s[0] in digits:
+ m = numeric_regexp.match(s)
+ r.append(int(m.group(1)))
+ s = m.group(2)
+ continue
+ if s[0] in ascii_letters:
+ m = alpha_regexp.match(s)
+ r.append(m.group(1))
+ s = m.group(2)
+ continue
+ s = s[1:]
+ return r
def vercmp_part(a, b):
- va = explode_version(a)
- vb = explode_version(b)
- while True:
- if va == []:
- ca = None
- else:
- ca = va.pop(0)
- if vb == []:
- cb = None
- else:
- cb = vb.pop(0)
- if ca == None and cb == None:
- return 0
- if ca > cb:
- return 1
- if ca < cb:
- return -1
+ va = explode_version(a)
+ vb = explode_version(b)
+ while True:
+ if va == []:
+ ca = None
+ else:
+ ca = va.pop(0)
+ if vb == []:
+ cb = None
+ else:
+ cb = vb.pop(0)
+ if ca == None and cb == None:
+ return 0
+ if ca > cb:
+ return 1
+ if ca < cb:
+ return -1
def vercmp(ta, tb):
- (va, ra) = ta
- (vb, rb) = tb
+ (va, ra) = ta
+ (vb, rb) = tb
- r = vercmp_part(va, vb)
- if (r == 0):
- r = vercmp_part(ra, rb)
- return r
+ r = vercmp_part(va, vb)
+ if (r == 0):
+ r = vercmp_part(ra, rb)
+ return r
diff --git a/bin/oe/manifest.py b/bin/oe/manifest.py
index d60eb38ba..b59a4c2f3 100644
--- a/bin/oe/manifest.py
+++ b/bin/oe/manifest.py
@@ -1,128 +1,130 @@
#!/usr/bin/env python
+# ex:ts=4:sw=4:tw=78:et
+# -*- tab-width: 4; c-basic-offset: 4; indent-tabs-mode: nil -*-
import os, sys
import oe, oe.data
def getfields(line):
- fields = {}
- fieldmap = ( "pkg", "src", "dest", "type", "mode", "uid", "gid", "major", "minor", "start", "inc", "count" )
- for f in xrange(len(fieldmap)):
- fields[fieldmap[f]] = None
-
- if not line:
- return None
-
- splitline = line.split()
- if not len(splitline):
- return None
-
- try:
- for f in xrange(len(fieldmap)):
- if splitline[f] == '-':
- continue
- fields[fieldmap[f]] = splitline[f]
- except IndexError:
- pass
- return fields
+ fields = {}
+ fieldmap = ( "pkg", "src", "dest", "type", "mode", "uid", "gid", "major", "minor", "start", "inc", "count" )
+ for f in xrange(len(fieldmap)):
+ fields[fieldmap[f]] = None
+
+ if not line:
+ return None
+
+ splitline = line.split()
+ if not len(splitline):
+ return None
+
+ try:
+ for f in xrange(len(fieldmap)):
+ if splitline[f] == '-':
+ continue
+ fields[fieldmap[f]] = splitline[f]
+ except IndexError:
+ pass
+ return fields
def parse (mfile, d):
- manifest = []
- while 1:
- line = mfile.readline()
- if not line:
- break
- if line.startswith("#"):
- continue
- fields = getfields(line)
- if not fields:
- continue
- manifest.append(fields)
- return manifest
+ manifest = []
+ while 1:
+ line = mfile.readline()
+ if not line:
+ break
+ if line.startswith("#"):
+ continue
+ fields = getfields(line)
+ if not fields:
+ continue
+ manifest.append(fields)
+ return manifest
def emit (func, manifest, d):
#str = "%s () {\n" % func
- str = ""
- for line in manifest:
- emittedline = emit_line(func, line, d)
- if not emittedline:
- continue
- str += emittedline + "\n"
-# str += "}\n"
- return str
+ str = ""
+ for line in manifest:
+ emittedline = emit_line(func, line, d)
+ if not emittedline:
+ continue
+ str += emittedline + "\n"
+# str += "}\n"
+ return str
def mangle (func, line, d):
- import copy
- newline = copy.copy(line)
- src = oe.data.expand(newline["src"], d)
-
- if src:
- if not os.path.isabs(src):
- src = "${WORKDIR}/" + src
-
- dest = newline["dest"]
- if not dest:
- return
-
- if dest.startswith("/"):
- dest = dest[1:]
-
- if func is "do_install":
- dest = "${D}/" + dest
-
- elif func is "do_populate":
- dest = "${WORKDIR}/install/" + newline["pkg"] + "/" + dest
-
- elif func is "do_stage":
- varmap = {}
- varmap["${bindir}"] = "${STAGING_DIR}/${HOST_SYS}/bin"
- varmap["${libdir}"] = "${STAGING_DIR}/${HOST_SYS}/lib"
- varmap["${includedir}"] = "${STAGING_DIR}/${HOST_SYS}/include"
- varmap["${datadir}"] = "${STAGING_DATADIR}"
-
- matched = 0
- for key in varmap.keys():
- if dest.startswith(key):
- dest = varmap[key] + "/" + dest[len(key):]
- matched = 1
- if not matched:
- newline = None
- return
- else:
- newline = None
- return
-
- newline["src"] = src
- newline["dest"] = dest
- return newline
+ import copy
+ newline = copy.copy(line)
+ src = oe.data.expand(newline["src"], d)
+
+ if src:
+ if not os.path.isabs(src):
+ src = "${WORKDIR}/" + src
+
+ dest = newline["dest"]
+ if not dest:
+ return
+
+ if dest.startswith("/"):
+ dest = dest[1:]
+
+ if func is "do_install":
+ dest = "${D}/" + dest
+
+ elif func is "do_populate":
+ dest = "${WORKDIR}/install/" + newline["pkg"] + "/" + dest
+
+ elif func is "do_stage":
+ varmap = {}
+ varmap["${bindir}"] = "${STAGING_DIR}/${HOST_SYS}/bin"
+ varmap["${libdir}"] = "${STAGING_DIR}/${HOST_SYS}/lib"
+ varmap["${includedir}"] = "${STAGING_DIR}/${HOST_SYS}/include"
+ varmap["${datadir}"] = "${STAGING_DATADIR}"
+
+ matched = 0
+ for key in varmap.keys():
+ if dest.startswith(key):
+ dest = varmap[key] + "/" + dest[len(key):]
+ matched = 1
+ if not matched:
+ newline = None
+ return
+ else:
+ newline = None
+ return
+
+ newline["src"] = src
+ newline["dest"] = dest
+ return newline
def emit_line (func, line, d):
- import copy
- newline = copy.deepcopy(line)
- newline = mangle(func, newline, d)
- if not newline:
- return None
-
- str = ""
- type = newline["type"]
- mode = newline["mode"]
- src = newline["src"]
- dest = newline["dest"]
- if type is "d":
- str = "install -d "
- if mode:
- str += "-m %s " % mode
- str += dest
- elif type is "f":
- if not src:
- return None
- if dest.endswith("/"):
- str = "install -d "
- str += dest + "\n"
- str += "install "
- else:
- str = "install -D "
- if mode:
- str += "-m %s " % mode
- str += src + " " + dest
- del newline
- return str
+ import copy
+ newline = copy.deepcopy(line)
+ newline = mangle(func, newline, d)
+ if not newline:
+ return None
+
+ str = ""
+ type = newline["type"]
+ mode = newline["mode"]
+ src = newline["src"]
+ dest = newline["dest"]
+ if type is "d":
+ str = "install -d "
+ if mode:
+ str += "-m %s " % mode
+ str += dest
+ elif type is "f":
+ if not src:
+ return None
+ if dest.endswith("/"):
+ str = "install -d "
+ str += dest + "\n"
+ str += "install "
+ else:
+ str = "install -D "
+ if mode:
+ str += "-m %s " % mode
+ str += src + " " + dest
+ del newline
+ return str
diff --git a/bin/oe/parse/ConfHandler.py b/bin/oe/parse/ConfHandler.py
index bed599470..0637d14df 100644
--- a/bin/oe/parse/ConfHandler.py
+++ b/bin/oe/parse/ConfHandler.py
@@ -1,3 +1,6 @@
+#!/usr/bin/env python
+# ex:ts=4:sw=4:tw=78:et
+# -*- tab-width: 4; c-basic-offset: 4; indent-tabs-mode: nil -*-
"""class for handling configuration data files
Reads the file and obtains its metadata"""
@@ -10,167 +13,167 @@ __config_regexp__ = re.compile( r"(?P<exp>export\s*)?(?P<var>[a-zA-Z0-9\-_+.${}
__include_regexp__ = re.compile( r"include\s+(.+)" )
def init(data):
- if not oe.data.getVar('TOPDIR', data):
- oe.data.setVar('TOPDIR', os.getcwd(), data)
- if not oe.data.getVar('OEPATH', data):
- oebuild = os.path.abspath(sys.argv[0])
- oebin = os.path.dirname(oebuild)
- oedir = os.path.dirname(oebin)
- oe.data.setVar('OEPATH', "${TOPDIR}:%s:%s:${HOME}/.oe:${OEDIR}/bin:${OEDIR}:%s/share/oe" % (oebin, oedir, sys.prefix), data)
+ if not oe.data.getVar('TOPDIR', data):
+ oe.data.setVar('TOPDIR', os.getcwd(), data)
+ if not oe.data.getVar('OEPATH', data):
+ oebuild = os.path.abspath(sys.argv[0])
+ oebin = os.path.dirname(oebuild)
+ oedir = os.path.dirname(oebin)
+ oe.data.setVar('OEPATH', "${TOPDIR}:%s:%s:${HOME}/.oe:${OEDIR}/bin:${OEDIR}:%s/share/oe" % (oebin, oedir, sys.prefix), data)
def supports(fn, d):
- return localpath(fn, d)[-5:] == ".conf"
+ return localpath(fn, d)[-5:] == ".conf"
def localpath(fn, d):
- if os.path.exists(fn):
- return fn
+ if os.path.exists(fn):
+ return fn
- localfn = None
- try:
- localfn = oe.fetch.localpath(fn, d)
- except oe.MalformedUrl:
- pass
+ localfn = None
+ try:
+ localfn = oe.fetch.localpath(fn, d)
+ except oe.MalformedUrl:
+ pass
- if not localfn:
- localfn = fn
- return localfn
+ if not localfn:
+ localfn = fn
+ return localfn
def obtain(fn, data = {}):
- import sys, oe
- fn = oe.data.expand(fn, data)
- localfn = oe.data.expand(localpath(fn, data), data)
-
- if localfn != fn:
- dldir = oe.data.getVar('DL_DIR', data, 1)
- if not dldir:
- debug(1, "obtain: DL_DIR not defined")
- return localfn
- oe.mkdirhier(dldir)
- try:
- oe.fetch.init([fn])
- except oe.fetch.NoMethodError:
- (type, value, traceback) = sys.exc_info()
- debug(1, "obtain: no method: %s" % value)
- return localfn
-
- try:
- oe.fetch.go(data)
- except oe.fetch.MissingParameterError:
- (type, value, traceback) = sys.exc_info()
- debug(1, "obtain: missing parameters: %s" % value)
- return localfn
- except oe.fetch.FetchError:
- (type, value, traceback) = sys.exc_info()
- debug(1, "obtain: failed: %s" % value)
- return localfn
- return localfn
+ import sys, oe
+ fn = oe.data.expand(fn, data)
+ localfn = oe.data.expand(localpath(fn, data), data)
+
+ if localfn != fn:
+ dldir = oe.data.getVar('DL_DIR', data, 1)
+ if not dldir:
+ debug(1, "obtain: DL_DIR not defined")
+ return localfn
+ oe.mkdirhier(dldir)
+ try:
+ oe.fetch.init([fn])
+ except oe.fetch.NoMethodError:
+ (type, value, traceback) = sys.exc_info()
+ debug(1, "obtain: no method: %s" % value)
+ return localfn
+
+ try:
+ oe.fetch.go(data)
+ except oe.fetch.MissingParameterError:
+ (type, value, traceback) = sys.exc_info()
+ debug(1, "obtain: missing parameters: %s" % value)
+ return localfn
+ except oe.fetch.FetchError:
+ (type, value, traceback) = sys.exc_info()
+ debug(1, "obtain: failed: %s" % value)
+ return localfn
+ return localfn
def include(oldfn, fn, data = {}):
- if oldfn == fn: # prevent infinate recursion
- return None
+ if oldfn == fn: # prevent infinate recursion
+ return None
- import oe
- fn = oe.data.expand(fn, data)
- oldfn = oe.data.expand(oldfn, data)
+ import oe
+ fn = oe.data.expand(fn, data)
+ oldfn = oe.data.expand(oldfn, data)
- from oe.parse import handle
- try:
- ret = handle(fn, data, 1)
- except IOError:
- debug(2, "CONF file '%s' not found" % fn)
+ from oe.parse import handle
+ try:
+ ret = handle(fn, data, 1)
+ except IOError:
+ debug(2, "CONF file '%s' not found" % fn)
def handle(fn, data = {}, include = 0):
- if include:
- inc_string = "including"
- else:
- inc_string = "reading"
- init(data)
-
- if include == 0:
- oe.data.inheritFromOS(data)
- oldfile = None
- else:
- oldfile = oe.data.getVar('FILE', data)
-
- fn = obtain(fn, data)
- oepath = ['.']
- if not os.path.isabs(fn):
- f = None
- voepath = oe.data.getVar("OEPATH", data)
- if voepath:
- oepath += voepath.split(":")
- for p in oepath:
- currname = os.path.join(oe.data.expand(p, data), fn)
- if os.access(currname, os.R_OK):
- f = open(currname, 'r')
- abs_fn = currname
- debug(1, "CONF %s %s" % (inc_string, currname))
- break
- if f is None:
- raise IOError("file not found")
- else:
- f = open(fn,'r')
- debug(1, "CONF %s %s" % (inc_string,fn))
- abs_fn = fn
-
- if include:
- oe.parse.mark_dependency(data, abs_fn)
-
- lineno = 0
- oe.data.setVar('FILE', fn, data)
- while 1:
- lineno = lineno + 1
- s = f.readline()
- if not s: break
- w = s.strip()
- if not w: continue # skip empty lines
- s = s.rstrip()
- if s[0] == '#': continue # skip comments
- while s[-1] == '\\':
- s2 = f.readline()[:-1].strip()
- lineno = lineno + 1
- s = s[:-1] + s2
- feeder(lineno, s, fn, data)
-
- if oldfile:
- oe.data.setVar('FILE', oldfile, data)
- return data
+ if include:
+ inc_string = "including"
+ else:
+ inc_string = "reading"
+ init(data)
+
+ if include == 0:
+ oe.data.inheritFromOS(data)
+ oldfile = None
+ else:
+ oldfile = oe.data.getVar('FILE', data)
+
+ fn = obtain(fn, data)
+ oepath = ['.']
+ if not os.path.isabs(fn):
+ f = None
+ voepath = oe.data.getVar("OEPATH", data)
+ if voepath:
+ oepath += voepath.split(":")
+ for p in oepath:
+ currname = os.path.join(oe.data.expand(p, data), fn)
+ if os.access(currname, os.R_OK):
+ f = open(currname, 'r')
+ abs_fn = currname
+ debug(1, "CONF %s %s" % (inc_string, currname))
+ break
+ if f is None:
+ raise IOError("file not found")
+ else:
+ f = open(fn,'r')
+ debug(1, "CONF %s %s" % (inc_string,fn))
+ abs_fn = fn
+
+ if include:
+ oe.parse.mark_dependency(data, abs_fn)
+
+ lineno = 0
+ oe.data.setVar('FILE', fn, data)
+ while 1:
+ lineno = lineno + 1
+ s = f.readline()
+ if not s: break
+ w = s.strip()
+ if not w: continue # skip empty lines
+ s = s.rstrip()
+ if s[0] == '#': continue # skip comments
+ while s[-1] == '\\':
+ s2 = f.readline()[:-1].strip()
+ lineno = lineno + 1
+ s = s[:-1] + s2
+ feeder(lineno, s, fn, data)
+
+ if oldfile:
+ oe.data.setVar('FILE', oldfile, data)
+ return data
def feeder(lineno, s, fn, data = {}):
- m = __config_regexp__.match(s)
- if m:
- groupd = m.groupdict()
- key = groupd["var"]
- if "exp" in groupd and groupd["exp"] != None:
- oe.data.setVarFlag(key, "export", 1, data)
- if "ques" in groupd and groupd["ques"] != None:
- val = oe.data.getVar(key, data)
- if not val:
- val = groupd["value"]
- elif "colon" in groupd and groupd["colon"] != None:
- val = oe.data.expand(groupd["value"], data)
- elif "append" in groupd and groupd["append"] != None:
- val = (oe.data.getVar(key, data) or "") + groupd["value"]
- elif "prepend" in groupd and groupd["prepend"] != None:
- val = groupd["value"] + (oe.data.getVar(key, data) or "")
- else:
- val = groupd["value"]
- if 'flag' in groupd and groupd['flag'] != None:
- #oe.note("setVarFlag(%s, %s, %s, data)" % (key, groupd['flag'], val))
- oe.data.setVarFlag(key, groupd['flag'], val, data)
- else:
- oe.data.setVar(key, val, data)
- return
-
- m = __include_regexp__.match(s)
- if m:
- s = oe.data.expand(m.group(1), data)
- #debug(2, "CONF %s:%d: including %s" % (fn, lineno, s))
- include(fn, s, data)
- return
-
- raise ParseError("%s:%d: unparsed line" % (fn, lineno));
+ m = __config_regexp__.match(s)
+ if m:
+ groupd = m.groupdict()
+ key = groupd["var"]
+ if "exp" in groupd and groupd["exp"] != None:
+ oe.data.setVarFlag(key, "export", 1, data)
+ if "ques" in groupd and groupd["ques"] != None:
+ val = oe.data.getVar(key, data)
+ if not val:
+ val = groupd["value"]
+ elif "colon" in groupd and groupd["colon"] != None:
+ val = oe.data.expand(groupd["value"], data)
+ elif "append" in groupd and groupd["append"] != None:
+ val = (oe.data.getVar(key, data) or "") + groupd["value"]
+ elif "prepend" in groupd and groupd["prepend"] != None:
+ val = groupd["value"] + (oe.data.getVar(key, data) or "")
+ else:
+ val = groupd["value"]
+ if 'flag' in groupd and groupd['flag'] != None:
+# oe.note("setVarFlag(%s, %s, %s, data)" % (key, groupd['flag'], val))
+ oe.data.setVarFlag(key, groupd['flag'], val, data)
+ else:
+ oe.data.setVar(key, val, data)
+ return
+
+ m = __include_regexp__.match(s)
+ if m:
+ s = oe.data.expand(m.group(1), data)
+# debug(2, "CONF %s:%d: including %s" % (fn, lineno, s))
+ include(fn, s, data)
+ return
+
+ raise ParseError("%s:%d: unparsed line" % (fn, lineno));
# Add us to the handlers list
from oe.parse import handlers
diff --git a/bin/oe/parse/OEHandler.py b/bin/oe/parse/OEHandler.py
index 9eb181e3c..63075e8a2 100644
--- a/bin/oe/parse/OEHandler.py
+++ b/bin/oe/parse/OEHandler.py
@@ -1,3 +1,6 @@
+#!/usr/bin/env python
+# ex:ts=4:sw=4:tw=78:et
+# -*- tab-width: 4; c-basic-offset: 4; indent-tabs-mode: nil -*-
"""class for handling .oe files
Reads the file and obtains its metadata"""
@@ -13,7 +16,7 @@ __inherit_regexp__ = re.compile( r"inherit\s+(.+)" )
__export_func_regexp__ = re.compile( r"EXPORT_FUNCTIONS\s+(.+)" )
__addtask_regexp__ = re.compile("addtask\s+(?P<func>\w+)\s*((before\s*(?P<before>((.*(?=after))|(.*))))|(after\s*(?P<after>((.*(?=before))|(.*)))))*")
__addhandler_regexp__ = re.compile( r"addhandler\s+(.+)" )
-__def_regexp__ = re.compile( r"def\s+.*:" )
+__def_regexp__ = re.compile( r"def\s+.*:" )
__python_func_regexp__ = re.compile( r"\s+.*" )
__word__ = re.compile(r"\S+")
@@ -25,318 +28,318 @@ __classname__ = ""
classes = [ None, ]
def supports(fn, d):
- localfn = localpath(fn, d)
- return localfn[-3:] == ".oe" or localfn[-8:] == ".oeclass"
+ localfn = localpath(fn, d)
+ return localfn[-3:] == ".oe" or localfn[-8:] == ".oeclass"
def inherit(files, d):
- __inherit_cache = data.getVar('__inherit_cache', d) or ""
- fn = ""
- lineno = 0
- for f in files:
- file = data.expand(f, d)
- if file[0] != "/" and file[-8:] != ".oeclass":
- file = "classes/%s.oeclass" % file
+ __inherit_cache = data.getVar('__inherit_cache', d) or ""
+ fn = ""
+ lineno = 0
+ for f in files:
+ file = data.expand(f, d)
+ if file[0] != "/" and file[-8:] != ".oeclass":
+ file = "classes/%s.oeclass" % file
- if not file in __inherit_cache.split():
- debug(2, "OE %s:%d: inheriting %s" % (fn, lineno, file))
- __inherit_cache += " %s" % file
- include(fn, file, d)
- data.setVar('__inherit_cache', __inherit_cache, d)
+ if not file in __inherit_cache.split():
+ debug(2, "OE %s:%d: inheriting %s" % (fn, lineno, file))
+ __inherit_cache += " %s" % file
+ include(fn, file, d)
+ data.setVar('__inherit_cache', __inherit_cache, 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 " + fn + ": handle(data)")
- else:
- debug(2, "OE " + fn + ": handle(data, include)")
-
- (root, ext) = os.path.splitext(os.path.basename(fn))
- init(d)
-
- if ext == ".oeclass":
- __classname__ = root
- classes.append(__classname__)
-
- if include != 0:
- oldfile = data.getVar('FILE', d)
- else:
- oldfile = None
-
- fn = obtain(fn, d)
- oepath = ['.']
- if not os.path.isabs(fn):
- f = None
- voepath = data.getVar("OEPATH", d)
- if voepath:
- oepath += voepath.split(":")
- for p in oepath:
- p = data.expand(p, d)
- j = os.path.join(p, fn)
- if os.access(j, os.R_OK):
- abs_fn = j
- f = open(j, 'r')
- break
- if f is None:
- raise IOError("file not found")
- else:
- f = open(fn,'r')
- abs_fn = fn
-
- if include:
- oe.parse.mark_dependency(d, abs_fn)
-
- if ext != ".oeclass":
- data.setVar('FILE', fn, d)
- i = (data.getVar("INHERIT", d, 1) or "").split()
- if not "base" in i and __classname__ != "base":
- i[0:0] = ["base"]
- inherit(i, d)
-
- lineno = 0
- while 1:
- lineno = lineno + 1
- s = f.readline()
- if not s: break
- w = s.strip()
- if not w: continue # skip empty lines
- s = s.rstrip()
- while s[-1] == '\\':
- s2 = f.readline()[:-1].strip()
- s = s[:-1] + s2
- feeder(lineno, s, fn, d)
- if ext == ".oeclass":
- classes.remove(__classname__)
- else:
- if include == 0:
- data.expandKeys(d)
- data.update_data(d)
- set_additional_vars(fn, d, include)
- anonqueue = data.getVar("__anonqueue", d, 1) or []
- for anon in anonqueue:
- data.setVar("__anonfunc", anon["content"], d)
- data.setVarFlags("__anonfunc", anon["flags"], d)
- from oe import build
- try:
- t = data.getVar('T', d)
- data.setVar('T', '${TMPDIR}/', d)
- build.exec_func("__anonfunc", d)
- data.delVar('T', d)
- if t:
- data.setVar('T', t, d)
- except Exception, e:
- oe.debug(1, "executing anonymous function: %s" % e)
- raise
- data.delVar("__anonqueue", d)
- data.delVar("__anonfunc", d)
-
- for var in d.keys():
- if data.getVarFlag(var, 'handler', d):
- oe.event.register(data.getVar(var, d))
- continue
-
- if not data.getVarFlag(var, 'task', d):
- continue
-
- deps = data.getVarFlag(var, 'deps', d) or []
- postdeps = data.getVarFlag(var, 'postdeps', d) or []
- oe.build.add_task(var, deps, d)
- for p in postdeps:
- pdeps = data.getVarFlag(p, 'deps', d) or []
- pdeps.append(var)
- data.setVarFlag(p, 'deps', pdeps, d)
- oe.build.add_task(p, pdeps, d)
- if oldfile:
- oe.data.setVar("FILE", oldfile, d)
- return d
+ 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 " + fn + ": handle(data)")
+ else:
+ debug(2, "OE " + fn + ": handle(data, include)")
+
+ (root, ext) = os.path.splitext(os.path.basename(fn))
+ init(d)
+
+ if ext == ".oeclass":
+ __classname__ = root
+ classes.append(__classname__)
+
+ if include != 0:
+ oldfile = data.getVar('FILE', d)
+ else:
+ oldfile = None
+
+ fn = obtain(fn, d)
+ oepath = ['.']
+ if not os.path.isabs(fn):
+ f = None
+ voepath = data.getVar("OEPATH", d)
+ if voepath:
+ oepath += voepath.split(":")
+ for p in oepath:
+ p = data.expand(p, d)
+ j = os.path.join(p, fn)
+ if os.access(j, os.R_OK):
+ abs_fn = j
+ f = open(j, 'r')
+ break
+ if f is None:
+ raise IOError("file not found")
+ else:
+ f = open(fn,'r')
+ abs_fn = fn
+
+ if include:
+ oe.parse.mark_dependency(d, abs_fn)
+
+ if ext != ".oeclass":
+ data.setVar('FILE', fn, d)
+ i = (data.getVar("INHERIT", d, 1) or "").split()
+ if not "base" in i and __classname__ != "base":
+ i[0:0] = ["base"]
+ inherit(i, d)
+
+ lineno = 0
+ while 1:
+ lineno = lineno + 1
+ s = f.readline()
+ if not s: break
+ w = s.strip()
+ if not w: continue # skip empty lines
+ s = s.rstrip()
+ while s[-1] == '\\':
+ s2 = f.readline()[:-1].strip()
+ s = s[:-1] + s2
+ feeder(lineno, s, fn, d)
+ if ext == ".oeclass":
+ classes.remove(__classname__)
+ else:
+ if include == 0:
+ data.expandKeys(d)
+ data.update_data(d)
+ set_additional_vars(fn, d, include)
+ anonqueue = data.getVar("__anonqueue", d, 1) or []
+ for anon in anonqueue:
+ data.setVar("__anonfunc", anon["content"], d)
+ data.setVarFlags("__anonfunc", anon["flags"], d)
+ from oe import build
+ try:
+ t = data.getVar('T', d)
+ data.setVar('T', '${TMPDIR}/', d)
+ build.exec_func("__anonfunc", d)
+ data.delVar('T', d)
+ if t:
+ data.setVar('T', t, d)
+ except Exception, e:
+ oe.debug(1, "executing anonymous function: %s" % e)
+ raise
+ data.delVar("__anonqueue", d)
+ data.delVar("__anonfunc", d)
+
+ for var in d.keys():
+ if data.getVarFlag(var, 'handler', d):
+ oe.event.register(data.getVar(var, d))
+ continue
+
+ if not data.getVarFlag(var, 'task', d):
+ continue
+
+ deps = data.getVarFlag(var, 'deps', d) or []
+ postdeps = data.getVarFlag(var, 'postdeps', d) or []
+ oe.build.add_task(var, deps, d)
+ for p in postdeps:
+ pdeps = data.getVarFlag(p, 'deps', d) or []
+ pdeps.append(var)
+ data.setVarFlag(p, 'deps', pdeps, d)
+ oe.build.add_task(p, pdeps, d)
+ if oldfile:
+ oe.data.setVar("FILE", oldfile, d)
+ return d
def feeder(lineno, s, fn, d):
- global __func_start_regexp__, __inherit_regexp__, __export_func_regexp__, __addtask_regexp__, __addhandler_regexp__, __def_regexp__, __python_func_regexp__, __inpython__,__infunc__, __body__, __oepath_found__, classes, oe
- if __infunc__:
- if s == '}':
- __body__.append('')
- data.setVar(__infunc__, '\n'.join(__body__), d)
- data.setVarFlag(__infunc__, "func", 1, d)
- if __infunc__ == "__anonymous":
- anonqueue = oe.data.getVar("__anonqueue", d) or []
- anonitem = {}
- anonitem["content"] = oe.data.getVar("__anonymous", d)
- anonitem["flags"] = oe.data.getVarFlags("__anonymous", d)
- anonqueue.append(anonitem)
- oe.data.setVar("__anonqueue", anonqueue, d)
- oe.data.delVarFlags("__anonymous", d)
- oe.data.delVar("__anonymous", d)
- __infunc__ = ""
- __body__ = []
- else:
- __body__.append(s)
- return
-
- if __inpython__:
- m = __python_func_regexp__.match(s)
- if m:
- __body__.append(s)
- return
- else:
- text = '\n'.join(__body__)
- comp = compile(text, "<oe>", "exec")
- exec comp in __builtins__
- __body__ = []
- __inpython__ = False
- # fall through
-
- if s[0] == '#': return # skip comments
-
- m = __func_start_regexp__.match(s)
- if m:
- __infunc__ = m.group("func") or "__anonymous"
- key = __infunc__
- if data.getVar(key, d):
- # clean up old version of this piece of metadata, as its
- # flags could cause problems
- data.setVarFlag(key, 'python', None, d)
- data.setVarFlag(key, 'fakeroot', None, d)
- if m.group("py") is not None:
- data.setVarFlag(key, "python", "1", d)
- else:
- data.delVarFlag(key, "python", d)
- if m.group("fr") is not None:
- data.setVarFlag(key, "fakeroot", "1", d)
- else:
- data.delVarFlag(key, "fakeroot", d)
- return
-
- m = __def_regexp__.match(s)
- if m:
- __body__.append(s)
- __inpython__ = True
- return
-
- m = __export_func_regexp__.match(s)
- if m:
- fns = m.group(1)
- n = __word__.findall(fns)
- for f in n:
- allvars = []
- allvars.append(f)
- allvars.append(classes[-1] + "_" + f)
-
- vars = [[ allvars[0], allvars[1] ]]
- if len(classes) > 1 and classes[-2] is not None:
- allvars.append(classes[-2] + "_" + f)
- vars = []
- vars.append([allvars[2], allvars[1]])
- vars.append([allvars[0], allvars[2]])
-
- for (var, calledvar) in vars:
- if data.getVar(var, d) and not data.getVarFlag(var, 'export_func', d):
- continue
-
- if data.getVar(var, d):
- data.setVarFlag(var, 'python', None, d)
- data.setVarFlag(var, 'func', None, d)
-
- for flag in [ "func", "python" ]:
- if data.getVarFlag(calledvar, flag, d):
- data.setVarFlag(var, flag, data.getVarFlag(calledvar, flag, d), d)
- for flag in [ "dirs" ]:
- if data.getVarFlag(var, flag, d):
- data.setVarFlag(calledvar, flag, data.getVarFlag(var, flag, d), d)
-
- if data.getVarFlag(calledvar, "python", d):
- data.setVar(var, "\treturn oe.build.exec_func('" + calledvar + "', d)\n", d)
- else:
- data.setVar(var, "\t" + calledvar + "\n", d)
- data.setVarFlag(var, 'export_func', '1', d)
-
- return
-
- m = __addtask_regexp__.match(s)
- if m:
- func = m.group("func")
- before = m.group("before")
- after = m.group("after")
- if func is None:
- return
- var = "do_" + func
-
- data.setVarFlag(var, "task", 1, d)
-
- if after is not None:
- # set up deps for function
- data.setVarFlag(var, "deps", after.split(), d)
- if before is not None:
- # set up things that depend on this func
- data.setVarFlag(var, "postdeps", before.split(), d)
- return
-
- m = __addhandler_regexp__.match(s)
- if m:
- fns = m.group(1)
- hs = __word__.findall(fns)
- for h in hs:
- data.setVarFlag(h, "handler", 1, d)
- return
-
- m = __inherit_regexp__.match(s)
- if m:
-
- files = m.group(1)
- n = __word__.findall(files)
- inherit(n, d)
- return
-
- from oe.parse import ConfHandler
- return ConfHandler.feeder(lineno, s, fn, d)
+ global __func_start_regexp__, __inherit_regexp__, __export_func_regexp__, __addtask_regexp__, __addhandler_regexp__, __def_regexp__, __python_func_regexp__, __inpython__,__infunc__, __body__, __oepath_found__, classes, oe
+ if __infunc__:
+ if s == '}':
+ __body__.append('')
+ data.setVar(__infunc__, '\n'.join(__body__), d)
+ data.setVarFlag(__infunc__, "func", 1, d)
+ if __infunc__ == "__anonymous":
+ anonqueue = oe.data.getVar("__anonqueue", d) or []
+ anonitem = {}
+ anonitem["content"] = oe.data.getVar("__anonymous", d)
+ anonitem["flags"] = oe.data.getVarFlags("__anonymous", d)
+ anonqueue.append(anonitem)
+ oe.data.setVar("__anonqueue", anonqueue, d)
+ oe.data.delVarFlags("__anonymous", d)
+ oe.data.delVar("__anonymous", d)
+ __infunc__ = ""
+ __body__ = []
+ else:
+ __body__.append(s)
+ return
+
+ if __inpython__:
+ m = __python_func_regexp__.match(s)
+ if m:
+ __body__.append(s)
+ return
+ else:
+ text = '\n'.join(__body__)
+ comp = compile(text, "<oe>", "exec")
+ exec comp in __builtins__
+ __body__ = []
+ __inpython__ = False
+# fall through
+
+ if s[0] == '#': return # skip comments
+
+ m = __func_start_regexp__.match(s)
+ if m:
+ __infunc__ = m.group("func") or "__anonymous"
+ key = __infunc__
+ if data.getVar(key, d):
+# clean up old version of this piece of metadata, as its
+# flags could cause problems
+ data.setVarFlag(key, 'python', None, d)
+ data.setVarFlag(key, 'fakeroot', None, d)
+ if m.group("py") is not None:
+ data.setVarFlag(key, "python", "1", d)
+ else:
+ data.delVarFlag(key, "python", d)
+ if m.group("fr") is not None:
+ data.setVarFlag(key, "fakeroot", "1", d)
+ else:
+ data.delVarFlag(key, "fakeroot", d)
+ return
+
+ m = __def_regexp__.match(s)
+ if m:
+ __body__.append(s)
+ __inpython__ = True
+ return
+
+ m = __export_func_regexp__.match(s)
+ if m:
+ fns = m.group(1)
+ n = __word__.findall(fns)
+ for f in n:
+ allvars = []
+ allvars.append(f)
+ allvars.append(classes[-1] + "_" + f)
+
+ vars = [[ allvars[0], allvars[1] ]]
+ if len(classes) > 1 and classes[-2] is not None:
+ allvars.append(classes[-2] + "_" + f)
+ vars = []
+ vars.append([allvars[2], allvars[1]])
+ vars.append([allvars[0], allvars[2]])
+
+ for (var, calledvar) in vars:
+ if data.getVar(var, d) and not data.getVarFlag(var, 'export_func', d):
+ continue
+
+ if data.getVar(var, d):
+ data.setVarFlag(var, 'python', None, d)
+ data.setVarFlag(var, 'func', None, d)
+
+ for flag in [ "func", "python" ]:
+ if data.getVarFlag(calledvar, flag, d):
+ data.setVarFlag(var, flag, data.getVarFlag(calledvar, flag, d), d)
+ for flag in [ "dirs" ]:
+ if data.getVarFlag(var, flag, d):
+ data.setVarFlag(calledvar, flag, data.getVarFlag(var, flag, d), d)
+
+ if data.getVarFlag(calledvar, "python", d):
+ data.setVar(var, "\treturn oe.build.exec_func('" + calledvar + "', d)\n", d)
+ else:
+ data.setVar(var, "\t" + calledvar + "\n", d)
+ data.setVarFlag(var, 'export_func', '1', d)
+
+ return
+
+ m = __addtask_regexp__.match(s)
+ if m:
+ func = m.group("func")
+ before = m.group("before")
+ after = m.group("after")
+ if func is None:
+ return
+ var = "do_" + func
+
+ data.setVarFlag(var, "task", 1, d)
+
+ if after is not None:
+# set up deps for function
+ data.setVarFlag(var, "deps", after.split(), d)
+ if before is not None:
+# set up things that depend on this func
+ data.setVarFlag(var, "postdeps", before.split(), d)
+ return
+
+ m = __addhandler_regexp__.match(s)
+ if m:
+ fns = m.group(1)
+ hs = __word__.findall(fns)
+ for h in hs:
+ data.setVarFlag(h, "handler", 1, d)
+ return
+
+ m = __inherit_regexp__.match(s)
+ if m:
+
+ files = m.group(1)
+ n = __word__.findall(files)
+ inherit(n, d)
+ return
+
+ from oe.parse import ConfHandler
+ return ConfHandler.feeder(lineno, s, fn, d)
__pkgsplit_cache__={}
def vars_from_file(mypkg, d):
- if not mypkg:
- return (None, None, None)
- if mypkg in __pkgsplit_cache__:
- return __pkgsplit_cache__[mypkg]
-
- myfile = os.path.splitext(os.path.basename(mypkg))
- parts = myfile[0].split('_')
- __pkgsplit_cache__[mypkg] = parts
- exp = 3 - len(parts)
- tmplist = []
- while exp != 0:
- exp -= 1
- tmplist.append(None)
- parts.extend(tmplist)
- return parts
+ if not mypkg:
+ return (None, None, None)
+ if mypkg in __pkgsplit_cache__:
+ return __pkgsplit_cache__[mypkg]
+
+ myfile = os.path.splitext(os.path.basename(mypkg))
+ parts = myfile[0].split('_')
+ __pkgsplit_cache__[mypkg] = parts
+ exp = 3 - len(parts)
+ tmplist = []
+ while exp != 0:
+ exp -= 1
+ tmplist.append(None)
+ parts.extend(tmplist)
+ return parts
def set_additional_vars(file, d, include):
- """Deduce rest of variables, e.g. ${A} out of ${SRC_URI}"""
-
- debug(2,"OE %s: set_additional_vars" % file)
-
- src_uri = data.getVar('SRC_URI', d)
- if not src_uri:
- return
- src_uri = data.expand(src_uri, d)
-
- a = data.getVar('A', d)
- if a:
- a = data.expand(a, d).split()
- else:
- a = []
-
- from oe import fetch
- try:
- fetch.init(src_uri.split())
- except fetch.NoMethodError:
- pass
-
- a += fetch.localpaths(d)
- del fetch
- data.setVar('A', "".join(a), d)
+ """Deduce rest of variables, e.g. ${A} out of ${SRC_URI}"""
+
+ debug(2,"OE %s: set_additional_vars" % file)
+
+ src_uri = data.getVar('SRC_URI', d)
+ if not src_uri:
+ return
+ src_uri = data.expand(src_uri, d)
+
+ a = data.getVar('A', d)
+ if a:
+ a = data.expand(a, d).split()
+ else:
+ a = []
+
+ from oe import fetch
+ try:
+ fetch.init(src_uri.split())
+ except fetch.NoMethodError:
+ pass
+
+ a += fetch.localpaths(d)
+ del fetch
+ data.setVar('A', "".join(a), d)
# Add us to the handlers list
diff --git a/bin/oe/parse/SRPMHandler.py b/bin/oe/parse/SRPMHandler.py
index 596ad727f..2864f673f 100644
--- a/bin/oe/parse/SRPMHandler.py
+++ b/bin/oe/parse/SRPMHandler.py
@@ -1,3 +1,6 @@
+#!/usr/bin/env python
+# ex:ts=4:sw=4:tw=78:et
+# -*- tab-width: 4; c-basic-offset: 4; indent-tabs-mode: nil -*-
"""class for handling .src.rpm files
Accesses the file and obtains its metadata"""
@@ -14,107 +17,107 @@ _srpm_vartranslate = {
}
def supports(fn, d):
- return fn[-8:] == ".src.rpm"
+ return fn[-8:] == ".src.rpm"
def handle(fn, d = {}, include = 0):
- init(d)
- oepath = ['.']
- if not os.path.isabs(fn):
- f = None
- voepath = data.getVar("OEPATH", d)
- if voepath:
- oepath += voepath.split(":")
- for p in oepath:
- p = data.expand(p, d)
- if os.access(os.path.join(p, fn), os.R_OK):
- f = open(os.path.join(p, fn), 'r')
- if f is None:
- raise IOError("file not found")
- else:
- f = open(fn,'r')
-
- srpm_vars = os.popen('rpm --querytags').read().split('\n')
- for v in srpm_vars:
- if v in _srpm_vartranslate:
- var = _srpm_vartranslate[v]
- else:
- var = v
- querycmd = 'rpm -qp --qf \'%%{%s}\' %s 2>/dev/null' % (v, fn)
- value = os.popen(querycmd).read().strip()
- if value == "(none)":
- value = None
- if value:
- data.setVar(var, value, d)
-
- data.setVar("SRPMFILE", fn, d)
-
- inheritclasses = data.getVar("INHERIT", d)
- if inheritclasses:
- i = inheritclasses.split()
- else:
- i = []
-
- if not "base_srpm" in i:
- i[0:0] = ["base_srpm"]
-
- for c in i:
- oe.parse.handle('classes/%s.oeclass' % c, d)
-
- set_automatic_vars(fn, d, include)
- set_additional_vars(fn, d, include)
- data.update_data(d)
- return d
+ init(d)
+ oepath = ['.']
+ if not os.path.isabs(fn):
+ f = None
+ voepath = data.getVar("OEPATH", d)
+ if voepath:
+ oepath += voepath.split(":")
+ for p in oepath:
+ p = data.expand(p, d)
+ if os.access(os.path.join(p, fn), os.R_OK):
+ f = open(os.path.join(p, fn), 'r')
+ if f is None:
+ raise IOError("file not found")
+ else:
+ f = open(fn,'r')
+
+ srpm_vars = os.popen('rpm --querytags').read().split('\n')
+ for v in srpm_vars:
+ if v in _srpm_vartranslate:
+ var = _srpm_vartranslate[v]
+ else:
+ var = v
+ querycmd = 'rpm -qp --qf \'%%{%s}\' %s 2>/dev/null' % (v, fn)
+ value = os.popen(querycmd).read().strip()
+ if value == "(none)":
+ value = None
+ if value:
+ data.setVar(var, value, d)
+
+ data.setVar("SRPMFILE", fn, d)
+
+ inheritclasses = data.getVar("INHERIT", d)
+ if inheritclasses:
+ i = inheritclasses.split()
+ else:
+ i = []
+
+ if not "base_srpm" in i:
+ i[0:0] = ["base_srpm"]
+
+ for c in i:
+ oe.parse.handle('classes/%s.oeclass' % c, 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, include):
- """Deduce per-package environment variables"""
-
- debug(2, "setting automatic vars")
-
- data.setVar('CATEGORY', 'srpm', d)
- data.setVar('P', '${PN}-${PV}', d)
- data.setVar('PF', '${P}-${PR}', d)
-
- for s in ['${TOPDIR}/${CATEGORY}/${PF}',
- '${TOPDIR}/${CATEGORY}/${PN}-${PV}',
- '${TOPDIR}/${CATEGORY}/files',
- '${TOPDIR}/${CATEGORY}']:
- s = data.expand(s, d)
- if os.access(s, os.R_OK):
- data.setVar('FILESDIR', s, d)
- break
-
- data.setVar('WORKDIR', '${TMPDIR}/${CATEGORY}/${PF}', d)
- data.setVar('T', '${WORKDIR}/temp', d)
- data.setVar('D', '${WORKDIR}/image', d)
- if not data.getVar('S', d):
- data.setVar('S', '${WORKDIR}/${P}', d)
- data.setVar('SLOT', '0', d)
+ """Deduce per-package environment variables"""
+
+ debug(2, "setting automatic vars")
+
+ data.setVar('CATEGORY', 'srpm', d)
+ data.setVar('P', '${PN}-${PV}', d)
+ data.setVar('PF', '${P}-${PR}', d)
+
+ for s in ['${TOPDIR}/${CATEGORY}/${PF}',
+ '${TOPDIR}/${CATEGORY}/${PN}-${PV}',
+ '${TOPDIR}/${CATEGORY}/files',
+ '${TOPDIR}/${CATEGORY}']:
+ s = data.expand(s, d)
+ if os.access(s, os.R_OK):
+ data.setVar('FILESDIR', s, d)
+ break
+
+ data.setVar('WORKDIR', '${TMPDIR}/${CATEGORY}/${PF}', d)
+ data.setVar('T', '${WORKDIR}/temp', d)
+ data.setVar('D', '${WORKDIR}/image', d)
+ if not data.getVar('S', d):
+ data.setVar('S', '${WORKDIR}/${P}', d)
+ data.setVar('SLOT', '0', d)
def set_additional_vars(file, d, include):
- """Deduce rest of variables, e.g. ${A} out of ${SRC_URI}"""
-
- debug(2,"set_additional_vars")
-
- src_uri = data.getVar('SRC_URI', d)
- if not src_uri:
- return
- src_uri = data.expand(src_uri, d)
-
- a = data.getVar('A', d)
- if a:
- a = data.expand(a, d).split()
- else:
- a = []
-
- from oe import fetch
- try:
- fetch.init(src_uri.split())
- except fetch.NoMethodError:
- pass
-
- a += fetch.localpaths(d)
- del fetch
- data.setVar('A', ''.join(a), d)
+ """Deduce rest of variables, e.g. ${A} out of ${SRC_URI}"""
+
+ debug(2,"set_additional_vars")
+
+ src_uri = data.getVar('SRC_URI', d)
+ if not src_uri:
+ return
+ src_uri = data.expand(src_uri, d)
+
+ a = data.getVar('A', d)
+ if a:
+ a = data.expand(a, d).split()
+ else:
+ a = []
+
+ from oe import fetch
+ try:
+ fetch.init(src_uri.split())
+ except fetch.NoMethodError:
+ pass
+
+ a += fetch.localpaths(d)
+ del fetch
+ data.setVar('A', ''.join(a), d)
# Add us to the handlers list
diff --git a/bin/oe/parse/__init__.py b/bin/oe/parse/__init__.py
index e147b8ffd..c4f0cb02e 100644
--- a/bin/oe/parse/__init__.py
+++ b/bin/oe/parse/__init__.py
@@ -1,7 +1,10 @@
+#!/usr/bin/env python
+# ex:ts=4:sw=4:tw=78:et
+# -*- tab-width: 4; c-basic-offset: 4; indent-tabs-mode: nil -*-
"""
OpenEmbedded Parsers
-File parsers for the OpenEmbedded
+File parsers for the OpenEmbedded
(http://openembedded.org) build infrastructure.
Copyright: (c) 2003 Chris Larson
@@ -14,10 +17,10 @@ __all__ = [ 'handlers', 'supports', 'handle', 'init', 'ConfHandler', 'OEHandler'
handlers = []
class ParseError(Exception):
- """Exception raised when parsing fails"""
+ """Exception raised when parsing fails"""
class SkipPackage(Exception):
- """Exception raised to skip this package"""
+ """Exception raised to skip this package"""
import ConfHandler
ConfHandler.ParseError = ParseError
@@ -29,34 +32,34 @@ SRPMHandler.ParseError = ParseError
__mtime_cache = {}
def cached_mtime(f):
- import os
- if not __mtime_cache.has_key(f):
- __mtime_cache[f] = os.stat(f)[8]
- return __mtime_cache[f]
+ import os
+ if not __mtime_cache.has_key(f):
+ __mtime_cache[f] = os.stat(f)[8]
+ return __mtime_cache[f]
def mark_dependency(d, f):
- import oe, os
- if f.startswith('./'):
- f = "%s/%s" % (os.getcwd(), f[2:])
- deps = (oe.data.getVar('__depends', d) or "").split()
- deps.append("%s@%s" % (f, cached_mtime(f)))
- oe.data.setVar('__depends', " ".join(deps), d)
+ import oe, os
+ if f.startswith('./'):
+ f = "%s/%s" % (os.getcwd(), f[2:])
+ deps = (oe.data.getVar('__depends', d) or "").split()
+ deps.append("%s@%s" % (f, cached_mtime(f)))
+ oe.data.setVar('__depends', " ".join(deps), d)
def supports(fn, data):
- """Returns true if we have a handler for this file, false otherwise"""
- for h in handlers:
- if h['supports'](fn, data):
- return 1
- return 0
+ """Returns true if we have a handler for this file, false otherwise"""
+ for h in handlers:
+ if h['supports'](fn, data):
+ return 1
+ return 0
def handle(fn, data, include = 0):
- """Call the handler that is appropriate for this file"""
- for h in handlers:
- if h['supports'](fn, data):
- return h['handle'](fn, data, include)
- return None
+ """Call the handler that is appropriate for this file"""
+ for h in handlers:
+ if h['supports'](fn, data):
+ return h['handle'](fn, data, include)
+ return None
def init(fn, data):
- for h in handlers:
- if h['supports'](fn):
- return h['init'](data)
+ for h in handlers:
+ if h['supports'](fn):
+ return h['init'](data)
diff --git a/bin/oebuild b/bin/oebuild
index fa7a941ed..94240cacc 100644
--- a/bin/oebuild
+++ b/bin/oebuild
@@ -6,56 +6,56 @@ from oe import *
import oe
def usage(errorlevel=0, txt=''):
- print
- if txt:
- print txt
-
- print "Usage: oebuild [options]... [task] [oefile]"
- print
- print "Run task (defaults to 'build') on oefile (defaults to first"
- print "*.oe file found in current dir)"
- print
- print "Options:"
- print " %s\t\t%s" % ("-V, --version", "output version information and exit")
- print " %s\t\t%s" % ("-f, --force", "forces execution of specified task")
- print
- print "Example: oebuild build content/glibc-2.3.1.oe"
- print
- sys.exit(0)
+ print
+ if txt:
+ print txt
+
+ print "Usage: oebuild [options]... [task] [oefile]"
+ print
+ print "Run task (defaults to 'build') on oefile (defaults to first"
+ print "*.oe file found in current dir)"
+ print
+ print "Options:"
+ print " %s\t\t%s" % ("-V, --version", "output version information and exit")
+ print " %s\t\t%s" % ("-f, --force", "forces execution of specified task")
+ print
+ print "Example: oebuild build content/glibc-2.3.1.oe"
+ print
+ sys.exit(0)
__version__ = 1.0
def version():
- print "OpenEmbedded Build Infrastructure Core version %s" % oe.__version__
- print "OEBuild version %s" % __version__
+ print "OpenEmbedded Build Infrastructure Core version %s" % oe.__version__
+ print "OEBuild version %s" % __version__
def get_oefile():
- """Returns the first *.oe file found in current directory"""
- dirs = os.listdir(os.getcwd())
- dirs.sort()
- for f in dirs:
- if os.path.splitext(f)[1] == ".oe":
- return os.path.abspath(os.path.join(os.getcwd(),f))
- return None
+ """Returns the first *.oe file found in current directory"""
+ dirs = os.listdir(os.getcwd())
+ dirs.sort()
+ for f in dirs:
+ if os.path.splitext(f)[1] == ".oe":
+ return os.path.abspath(os.path.join(os.getcwd(),f))
+ return None
def get_cmd():
- """Get default command, currently always 'build'"""
- return "build"
+ """Get default command, currently always 'build'"""
+ return "build"
#
# Handle options:
#
try:
- (opts, args) = getopt.getopt(sys.argv[1:], 'Vhf', [ 'version', 'help', 'force' ])
+ (opts, args) = getopt.getopt(sys.argv[1:], 'Vhf', [ 'version', 'help', 'force' ])
except getopt.GetoptError:
- usage(1)
+ usage(1)
optsonly = [ opt for (opt,val) in opts]
if '--version' in optsonly or '-V' in optsonly:
- version()
- sys.exit(0)
+ version()
+ sys.exit(0)
if '--help' in optsonly or '-h' in optsonly:
- usage(1)
+ usage(1)
@@ -68,74 +68,74 @@ cmd = None
oedata = None
try:
- make.cfg = parse.handle("conf/oe.conf", make.cfg)
+ make.cfg = parse.handle("conf/oe.conf", make.cfg)
except IOError:
- (type, value, traceback) = sys.exc_info()
- fatal("Unable to open oe.conf: %s" % value)
+ (type, value, traceback) = sys.exc_info()
+ fatal("Unable to open oe.conf: %s" % value)
if len(args) == 0:
- # user didnt specify command or .oe
- # see if we can find a .oe file in the current dir
- oefile = get_oefile()
- cmd = get_cmd()
+ # user didnt specify command or .oe
+ # see if we can find a .oe file in the current dir
+ oefile = get_oefile()
+ cmd = get_cmd()
elif len(args) == 1:
- # one of two cases:
- # 1) oebuild COMMAND
- # 2) oebuild OEFILE
- # First, see if this is a valid task.
- try:
- oedata = oe.make.load_oefile(args[0])
- except Exception, e:
- fatal("unable to read %s: %s" % (args[0], e))
- if not oedata:
- # If so, assume its a command.
- # If its a command, but we cant get a .oe file
- # in the current dir, usage()
- cmd = args[0]
- else:
- # If not, assume a .oe file.
- oefile = args[0]
-
- if not cmd:
- cmd = get_cmd()
-
- if not oefile:
- oefile = get_oefile()
+ # one of two cases:
+ # 1) oebuild COMMAND
+ # 2) oebuild OEFILE
+ # First, see if this is a valid task.
+ try:
+ oedata = oe.make.load_oefile(args[0])
+ except Exception, e:
+ fatal("unable to read %s: %s" % (args[0], e))
+ if not oedata:
+ # If so, assume its a command.
+ # If its a command, but we cant get a .oe file
+ # in the current dir, usage()
+ cmd = args[0]
+ else:
+ # If not, assume a .oe file.
+ oefile = args[0]
+
+ if not cmd:
+ cmd = get_cmd()
+
+ if not oefile:
+ oefile = get_oefile()
elif len(args) == 2:
- # user specified both
- cmd = args[0]
- oefile = args[1]
+ # user specified both
+ cmd = args[0]
+ oefile = args[1]
else:
- # invalid
- usage(1)
+ # invalid
+ usage(1)
if not cmd:
- usage(1)
+ usage(1)
if not oefile:
- usage(1)
+ usage(1)
try:
- if not oedata:
- oedata = make.load_oefile(oefile)
+ if not oedata:
+ oedata = make.load_oefile(oefile)
- if not oedata:
- fatal("Unable to open %s" % oefile)
+ if not oedata:
+ fatal("Unable to open %s" % oefile)
- if '--force' in optsonly or '-f' in optsonly:
- data.setVarFlag('do_%s' % cmd, 'force', 1, oedata)
+ if '--force' in optsonly or '-f' in optsonly:
+ data.setVarFlag('do_%s' % cmd, 'force', 1, oedata)
#
# Finally exec the requested task
#
- build.exec_task('do_%s' % cmd, oedata)
+ build.exec_task('do_%s' % cmd, oedata)
except build.FuncFailed:
- fatal("task stack execution failed")
+ fatal("task stack execution failed")
except build.EventException:
- (type, value, traceback) = sys.exc_info()
- e = value.event
- fatal("%s event exception, aborting" % event.getName(e))
+ (type, value, traceback) = sys.exc_info()
+ e = value.event
+ fatal("%s event exception, aborting" % event.getName(e))
except Exception, e:
- fatal("%s" % e)
+ fatal("%s" % e)
diff --git a/bin/oeimage b/bin/oeimage
index ddfdd682f..2d7a5f866 100644
--- a/bin/oeimage
+++ b/bin/oeimage
@@ -10,83 +10,83 @@ cfg_oespawn = data.init()
def usage():
- print "Usage: oeimage [options ...]"
- print "Creates an image for a target device from a root filesystem,"
- print "obeying configuration parameters from the OpenEmbedded"
- print "configuration files, thereby easing handling of deviceisms."
- print ""
- print " %s\t\t%s" % ("-r [arg], --root [arg]", "root directory (default=${IMAGE_ROOTFS})")
- print " %s\t\t%s" % ("-t [arg], --type [arg]", "image type (jffs2[default], cramfs)")
- print " %s\t\t%s" % ("-v, --version", "output version information and exit")
- sys.exit(0)
+ print "Usage: oeimage [options ...]"
+ print "Creates an image for a target device from a root filesystem,"
+ print "obeying configuration parameters from the OpenEmbedded"
+ print "configuration files, thereby easing handling of deviceisms."
+ print ""
+ print " %s\t\t%s" % ("-r [arg], --root [arg]", "root directory (default=${IMAGE_ROOTFS})")
+ print " %s\t\t%s" % ("-t [arg], --type [arg]", "image type (jffs2[default], cramfs)")
+ print " %s\t\t%s" % ("-v, --version", "output version information and exit")
+ sys.exit(0)
def version():
- print "OpenEmbedded Build Infrastructure Core version %s" % oe.__version__
- print "OEImage version %s" % __version__
+ print "OpenEmbedded Build Infrastructure Core version %s" % oe.__version__
+ print "OEImage version %s" % __version__
def emit_oe(d, base_d = {}):
- for v in d.keys():
- if d[v] != base_d[v]:
- data.emit_var(v, d)
+ for v in d.keys():
+ if d[v] != base_d[v]:
+ data.emit_var(v, d)
def getopthash(l):
- h = {}
- for (opt, val) in l:
- h[opt] = val
- return h
+ h = {}
+ for (opt, val) in l:
+ h[opt] = val
+ return h
import getopt
try:
- (opts, args) = getopt.getopt(sys.argv[1:], 'vr:t:e:', [ 'version', 'root=', 'type=', 'oefile=' ])
+ (opts, args) = getopt.getopt(sys.argv[1:], 'vr:t:e:', [ 'version', 'root=', 'type=', 'oefile=' ])
except getopt.GetoptError:
- usage()
+ usage()
# handle opts
opthash = getopthash(opts)
if '--version' in opthash or '-v' in opthash:
- version()
- sys.exit(0)
+ version()
+ sys.exit(0)
try:
- cfg_oe = parse.handle("conf/oe.conf", cfg_oe)
+ cfg_oe = parse.handle("conf/oe.conf", cfg_oe)
except IOError:
- fatal("Unable to open oe.conf")
+ fatal("Unable to open oe.conf")
# sanity check
if cfg_oe is None:
- fatal("Unable to open/parse conf/oe.conf")
- usage(1)
+ fatal("Unable to open/parse conf/oe.conf")
+ usage(1)
rootfs = None
extra_files = []
if '--root' in opthash:
- rootfs = opthash['--root']
+ rootfs = opthash['--root']
if '-r' in opthash:
- rootfs = opthash['-r']
+ rootfs = opthash['-r']
if '--type' in opthash:
- type = opthash['--type']
+ type = opthash['--type']
if '-t' in opthash:
- type = opthash['-t']
+ type = opthash['-t']
if '--oefile' in opthash:
- extra_files.append(opthash['--oefile'])
+ extra_files.append(opthash['--oefile'])
if '-e' in opthash:
- extra_files.append(opthash['-e'])
+ extra_files.append(opthash['-e'])
for f in extra_files:
- try:
- cfg_oe = parse.handle(f, cfg_oe)
- except IOError:
- print "unable to open %s" % f
-
+ try:
+ cfg_oe = parse.handle(f, cfg_oe)
+ except IOError:
+ print "unable to open %s" % f
+
if not rootfs:
- rootfs = data.getVar('IMAGE_ROOTFS', cfg_oe, 1)
+ rootfs = data.getVar('IMAGE_ROOTFS', cfg_oe, 1)
if not rootfs:
- oe.fatal("IMAGE_ROOTFS not defined")
+ oe.fatal("IMAGE_ROOTFS not defined")
data.setVar('IMAGE_ROOTFS', rootfs, cfg_oe)
@@ -95,7 +95,7 @@ localdata = deepcopy(cfg_oe)
overrides = data.getVar('OVERRIDES', localdata)
if not overrides:
- oe.fatal("OVERRIDES not defined.")
+ oe.fatal("OVERRIDES not defined.")
data.setVar('OVERRIDES', '%s:%s' % (overrides, type), localdata)
data.update_data(localdata)
data.setVar('OVERRIDES', overrides, localdata)
@@ -104,27 +104,27 @@ topdir = data.getVar('TOPDIR', localdata, 1) or os.getcwd()
cmd = data.getVar('IMAGE_CMD', localdata, 1)
if not cmd:
- oe.fatal("IMAGE_CMD not defined")
+ oe.fatal("IMAGE_CMD not defined")
outdir = data.getVar('DEPLOY_DIR_IMAGE', localdata, 1)
if not outdir:
- oe.fatal('DEPLOY_DIR_IMAGE not defined')
+ oe.fatal('DEPLOY_DIR_IMAGE not defined')
mkdirhier(outdir)
#depends = data.getVar('IMAGE_DEPENDS', localdata, 1) or ""
#if depends:
-# oe.note("Spawning oemake to satisfy dependencies: %s" % depends)
-# ret = os.system('oemake %s' % depends)
-# if ret != 0:
-# oe.error("executing oemake to satisfy dependencies")
+# oe.note("Spawning oemake to satisfy dependencies: %s" % depends)
+# ret = os.system('oemake %s' % depends)
+# if ret != 0:
+# oe.error("executing oemake to satisfy dependencies")
oe.note("Executing %s" % cmd)
data.setVar('T', '${TMPDIR}', localdata)
data.setVar('image_cmd', cmd, localdata)
data.setVarFlag('image_cmd', 'func', 1, localdata)
try:
- oe.build.exec_func('image_cmd', localdata)
+ oe.build.exec_func('image_cmd', localdata)
except oe.build.FuncFailed:
- sys.exit(1)
+ sys.exit(1)
#ret = os.system(cmd)
#sys.exit(ret)
diff --git a/bin/oeinstall b/bin/oeinstall
index 616eba6cb..99c6708e7 100644
--- a/bin/oeinstall
+++ b/bin/oeinstall
@@ -7,63 +7,63 @@ __version__ = 1.0
cfg_oe = data.init()
def usage():
- print
- print "Usage: oeinstall [options ...]"
- print
- print "Installs specified files of supported types into a root filesystem."
- print "Currently only supports installing OEFILES into the rootfs directly"
- print "using their do_install target."
- print
- print "Options:"
- print " %s\t\t%s" % ("-r [arg], --root [arg]", "root directory (default=${IMAGE_ROOTFS})")
- print " %s\t\t%s" % ("-f [arg], --files [arg]", ".oe files available (default=${OEFILES})")
- print " %s\t\t%s" % ("-t [arg], --type [arg]", "installation type (direct, and any for which package_[type].oeclass exists)")
- print " %s\t\t%s" % ("-V, --version", "output version information and exit")
- print
- sys.exit(0)
+ print
+ print "Usage: oeinstall [options ...]"
+ print
+ print "Installs specified files of supported types into a root filesystem."
+ print "Currently only supports installing OEFILES into the rootfs directly"
+ print "using their do_install target."
+ print
+ print "Options:"
+ print " %s\t\t%s" % ("-r [arg], --root [arg]", "root directory (default=${IMAGE_ROOTFS})")
+ print " %s\t\t%s" % ("-f [arg], --files [arg]", ".oe files available (default=${OEFILES})")
+ print " %s\t\t%s" % ("-t [arg], --type [arg]", "installation type (direct, and any for which package_[type].oeclass exists)")
+ print " %s\t\t%s" % ("-V, --version", "output version information and exit")
+ print
+ sys.exit(0)
def version():
- print "OpenEmbedded Build Infrastructure Core version %s" % oe.__version__
- print "OEInstall version %s" % __version__
+ print "OpenEmbedded Build Infrastructure Core version %s" % oe.__version__
+ print "OEInstall version %s" % __version__
def getopthash(l):
- h = {}
- for (opt, val) in l:
- h[opt] = val
- return h
+ h = {}
+ for (opt, val) in l:
+ h[opt] = val
+ return h
import getopt
try:
- (opts, args) = getopt.getopt(sys.argv[1:], 'Vr:f:t:', [ 'version', 'root=', 'files=', 'type=' ])
+ (opts, args) = getopt.getopt(sys.argv[1:], 'Vr:f:t:', [ 'version', 'root=', 'files=', 'type=' ])
except getopt.GetoptError:
- usage()
+ usage()
# handle opts
opthash = getopthash(opts)
if '--version' in opthash or '-V' in opthash:
- version()
- sys.exit(0)
+ version()
+ sys.exit(0)
try:
- cfg_oe = parse.handle("conf/oe.conf", cfg_oe)
+ cfg_oe = parse.handle("conf/oe.conf", cfg_oe)
except Exception, e:
- fatal("Unable to open oe.conf: %s" % e)
+ fatal("Unable to open oe.conf: %s" % e)
# sanity check
if cfg_oe is None:
- fatal("Unable to open/parse conf/oe.conf")
- usage(1)
+ fatal("Unable to open/parse conf/oe.conf")
+ usage(1)
rootfs = data.getVar('IMAGE_ROOTFS', cfg_oe, 1)
if '--root' in opthash:
- rootfs = opthash['--root']
+ rootfs = opthash['--root']
if '-r' in opthash:
- rootfs = opthash['-r']
+ rootfs = opthash['-r']
if not rootfs:
- oe.fatal("root filesystem not specified")
+ oe.fatal("root filesystem not specified")
data.setVar('IMAGE_ROOTFS', rootfs, cfg_oe)
@@ -71,133 +71,133 @@ data.setVar('IMAGE_ROOTFS', rootfs, cfg_oe)
type = 'tar'
if '--type' in opthash:
- type = opthash['--type']
+ type = opthash['--type']
if '-t' in opthash:
- type = opthash['-t']
+ type = opthash['-t']
topdir = data.getVar('TOPDIR', cfg_oe, 1) or os.getcwd()
# Iterate through .oe files
files = (data.getVar("OEFILES", cfg_oe, 1) or "").split()
if '-f' in opthash:
- files.extend(opthash['-f'])
+ files.extend(opthash['-f'])
if '--files' in opthash:
- files.extend(opthash['--files'])
+ files.extend(opthash['--files'])
data.setVar("OEFILES", ''.join(files), cfg_oe)
def get_oefiles():
- """Get default oefiles"""
- dirs = os.listdir(os.getcwd())
- oefiles = []
- for f in dirs:
- (root, ext) = os.path.splitext(f)
- if ext == ".oe":
- oefiles.append(os.path.abspath(os.path.join(os.getcwd(),f)))
- return oefiles
+ """Get default oefiles"""
+ dirs = os.listdir(os.getcwd())
+ oefiles = []
+ for f in dirs:
+ (root, ext) = os.path.splitext(f)
+ if ext == ".oe":
+ oefiles.append(os.path.abspath(os.path.join(os.getcwd(),f)))
+ return oefiles
if not len(files):
- files = get_oefiles()
+ files = get_oefiles()
if not len(files):
- usage()
+ usage()
def inst_pkg(d):
- from oe import data, build, error
- if data.getVar('pkg_preinst', d):
- try:
- build.exec_func('pkg_preinst', d)
- except build.FuncFailed:
- oe.note("preinst execution failure")
- return 0
- if type is not 'direct':
- try:
- build.exec_func('package_%s_fn' % type, d)
- except build.FuncFailed:
- oe.error("failed obtaining the filename of the outputted package for %s" % type)
- return 0
- if data.getVar('package_%s_install' % type, d):
- try:
- build.exec_func('package_%s_install' % type, d)
- print "package %s (%s) installed." % (p, data.getVar('PN', d, 1))
- except build.FuncFailed:
- return 0
- else:
- oe.error("no package_%s_install function to execute. skipping." % type)
- return 0
- if data.getVar('pkg_postinst', d):
- try:
- build.exec_func('pkg_postinst', d)
- except build.FuncFailed:
- oe.note("postinst execution failure")
- pass
- return 1
+ from oe import data, build, error
+ if data.getVar('pkg_preinst', d):
+ try:
+ build.exec_func('pkg_preinst', d)
+ except build.FuncFailed:
+ oe.note("preinst execution failure")
+ return 0
+ if type is not 'direct':
+ try:
+ build.exec_func('package_%s_fn' % type, d)
+ except build.FuncFailed:
+ oe.error("failed obtaining the filename of the outputted package for %s" % type)
+ return 0
+ if data.getVar('package_%s_install' % type, d):
+ try:
+ build.exec_func('package_%s_install' % type, d)
+ print "package %s (%s) installed." % (p, data.getVar('PN', d, 1))
+ except build.FuncFailed:
+ return 0
+ else:
+ oe.error("no package_%s_install function to execute. skipping." % type)
+ return 0
+ if data.getVar('pkg_postinst', d):
+ try:
+ build.exec_func('pkg_postinst', d)
+ except build.FuncFailed:
+ oe.note("postinst execution failure")
+ pass
+ return 1
# if type is not direct, add 'package_[type]' to INHERIT
if type is not 'direct':
- inherit = data.getVar('INHERIT', cfg_oe, 1) or ""
- inherit += " base package_%s" % type
- data.setVarFlag('INHERIT', 'export', 1, cfg_oe)
- data.setVar('INHERIT', inherit, cfg_oe)
+ inherit = data.getVar('INHERIT', cfg_oe, 1) or ""
+ inherit += " base package_%s" % type
+ data.setVarFlag('INHERIT', 'export', 1, cfg_oe)
+ data.setVar('INHERIT', inherit, cfg_oe)
pkgs_to_install = None
if args:
- if not pkgs_to_install:
- pkgs_to_install = []
- pkgs_to_install.extend(args)
+ if not pkgs_to_install:
+ pkgs_to_install = []
+ pkgs_to_install.extend(args)
if not pkgs_to_install:
- inst_oepkgs = data.getVar('INST_OEPKGS', cfg_oe, 1)
- if inst_oepkgs:
- pkgs_to_install = inst_oepkgs.split()
+ inst_oepkgs = data.getVar('INST_OEPKGS', cfg_oe, 1)
+ if inst_oepkgs:
+ pkgs_to_install = inst_oepkgs.split()
debug(1, "installing: %s" % pkgs_to_install)
import glob
for f in files:
- if pkgs_to_install is not None and len(pkgs_to_install) == 0:
- # done!
- break
- globbed = glob.glob(f) or [ f ]
- if globbed:
- if [ f ] != globbed:
- files += globbed
- continue
- from copy import deepcopy
- fdata = deepcopy(cfg_oe)
- try:
- parse.handle(f, fdata)
- except Exception, e:
- error("%s" % e)
- fdata = None
- if fdata is None:
- continue
- # allow metadata files to add items to OEFILES
- data.update_data(fdata)
- addoefiles = data.getVar('OEFILES', fdata) or None
- if addoefiles:
- for aof in addoefiles.split():
- if not files.count(aof):
- if not os.path.isabs(aof):
- aof = os.path.join(os.path.dirname(f),aof)
- files.append(aof)
- pkgs = (data.getVar('PACKAGES', fdata, 1) or "").split()
- # Iterate through PACKAGES
- for p in pkgs:
- if pkgs_to_install is not None:
- if not p in pkgs_to_install:
- continue
- d = deepcopy(fdata)
- data.setVar('PKG', p, d)
- # Add package to overrides, collapse the metadata
- overrides = data.getVar('OVERRIDES', d, 1) or ""
- overrides += ":%s" % p
- data.setVar('OVERRIDES', overrides, d)
- data.update_data(d)
- data.setVarFlag('INHERIT', 'export', 1, d)
- # Look at vars to determine the file names for the package type in question
- # Call installer for a given package type as pulled from the metadata with INHERIT set properly
- data.setVar('D', rootfs, d)
- if inst_pkg(d):
- if pkgs_to_install is not None:
- del pkgs_to_install[pkgs_to_install.index(p)]
- if pkgs_to_install is not None and len(pkgs_to_install) == 0:
- break
+ if pkgs_to_install is not None and len(pkgs_to_install) == 0:
+# # done!
+ break
+ globbed = glob.glob(f) or [ f ]
+ if globbed:
+ if [ f ] != globbed:
+ files += globbed
+ continue
+ from copy import deepcopy
+ fdata = deepcopy(cfg_oe)
+ try:
+ parse.handle(f, fdata)
+ except Exception, e:
+ error("%s" % e)
+ fdata = None
+ if fdata is None:
+ continue
+# # allow metadata files to add items to OEFILES
+ data.update_data(fdata)
+ addoefiles = data.getVar('OEFILES', fdata) or None
+ if addoefiles:
+ for aof in addoefiles.split():
+ if not files.count(aof):
+ if not os.path.isabs(aof):
+ aof = os.path.join(os.path.dirname(f),aof)
+ files.append(aof)
+ pkgs = (data.getVar('PACKAGES', fdata, 1) or "").split()
+# # Iterate through PACKAGES
+ for p in pkgs:
+ if pkgs_to_install is not None:
+ if not p in pkgs_to_install:
+ continue
+ d = deepcopy(fdata)
+ data.setVar('PKG', p, d)
+# # Add package to overrides, collapse the metadata
+ overrides = data.getVar('OVERRIDES', d, 1) or ""
+ overrides += ":%s" % p
+ data.setVar('OVERRIDES', overrides, d)
+ data.update_data(d)
+ data.setVarFlag('INHERIT', 'export', 1, d)
+# # Look at vars to determine the file names for the package type in question
+# # Call installer for a given package type as pulled from the metadata with INHERIT set properly
+ data.setVar('D', rootfs, d)
+ if inst_pkg(d):
+ if pkgs_to_install is not None:
+ del pkgs_to_install[pkgs_to_install.index(p)]
+ if pkgs_to_install is not None and len(pkgs_to_install) == 0:
+ break
diff --git a/bin/oemake b/bin/oemake
index 63d2371d0..03121feaf 100644
--- a/bin/oemake
+++ b/bin/oemake
@@ -26,211 +26,211 @@ __preferred = {}
__world_target = Set()
__ignored_dependencies = Set()
__depcmds = { "clean": None,
- "mrproper": None }
+ "mrproper": None }
__stats = {}
def handle_options( args ):
- parser = optparse.OptionParser( version = "OpenEmbedded Build Infrastructure Core version %s, %%prog version %s" % ( oe.__version__, __version__ ),
- usage = """%prog [options] [package ...]
+ parser = optparse.OptionParser( version = "OpenEmbedded Build Infrastructure Core version %s, %%prog version %s" % ( oe.__version__, __version__ ),
+ usage = """%prog [options] [package ...]
Builds specified packages, expecting that the .oe files
it has to work from are in OEFILES
Default packages are all packages in OEFILES.
Default OEFILES are the .oe files in the current directory.""" )
- parser.add_option( "-k", "--continue", help = "continue as much as possible after an error. While the target that failed, and those that depend on it, cannot be remade, the other dependencies of these targets can be processed all the same.",
- action = "store_false", dest = "abort", default = True )
+ parser.add_option( "-k", "--continue", help = "continue as much as possible after an error. While the target that failed, and those that depend on it, cannot be remade, the other dependencies of these targets can be processed all the same.",
+ action = "store_false", dest = "abort", default = True )
- parser.add_option( "-f", "--force", help = "force run of specified cmd, regardless of stamp status",
- action = "store_true", dest = "force", default = False )
+ parser.add_option( "-f", "--force", help = "force run of specified cmd, regardless of stamp status",
+ action = "store_true", dest = "force", default = False )
- parser.add_option( "-c", "--cmd", help = "specify command to pass to oebuild",
- action = "store", dest = "cmd", default = "build" )
+ parser.add_option( "-c", "--cmd", help = "specify command to pass to oebuild",
+ action = "store", dest = "cmd", default = "build" )
- parser.add_option( "-r", "--read", help = "read the specified file before oe.conf",
- action = "append", dest = "file", default = [] )
+ parser.add_option( "-r", "--read", help = "read the specified file before oe.conf",
+ action = "append", dest = "file", default = [] )
- parser.add_option( "-v", "--verbose", help = "output more chit-chat to the terminal",
- action = "store_true", dest = "verbose", default = False )
+ parser.add_option( "-v", "--verbose", help = "output more chit-chat to the terminal",
+ action = "store_true", dest = "verbose", default = False )
- parser.add_option( "-n", "--dry-run", help = "don't call oebuild, just go through the motions",
- action = "store_true", dest = "dry_run", default = False )
+ parser.add_option( "-n", "--dry-run", help = "don't call oebuild, just go through the motions",
+ action = "store_true", dest = "dry_run", default = False )
- parser.add_option( "-p", "--parse-only", help = "quit after parsing the OE files (developers only)",
- action = "store_true", dest = "parse_only", default = False )
+ parser.add_option( "-p", "--parse-only", help = "quit after parsing the OE files (developers only)",
+ action = "store_true", dest = "parse_only", default = False )
- parser.add_option( "-d", "--disable-psyco", help = "disable using the psyco just-in-time compiler (not recommended)",
- action = "store_true", dest = "disable_psyco", default = False )
+ parser.add_option( "-d", "--disable-psyco", help = "disable using the psyco just-in-time compiler (not recommended)",
+ action = "store_true", dest = "disable_psyco", default = False )
- options, args = parser.parse_args( args )
- return options, args[1:]
+ options, args = parser.parse_args( args )
+ return options, args[1:]
def try_build(fn, virtual):
- if fn in __building_list:
- oe.error("%s depends on itself (eventually)" % fn)
- oe.error("upwards chain is: %s" % (" -> ".join(__build_path)))
- return False
+ if fn in __building_list:
+ oe.error("%s depends on itself (eventually)" % fn)
+ oe.error("upwards chain is: %s" % (" -> ".join(__build_path)))
+ return False
- __building_list.append(fn)
+ __building_list.append(fn)
- the_data = make.pkgdata[fn]
- item = oe.data.getVar('PN', the_data, 1)
- pathstr = "%s (%s)" % (item, virtual)
- __build_path.append(pathstr)
+ the_data = make.pkgdata[fn]
+ item = oe.data.getVar('PN', the_data, 1)
+ pathstr = "%s (%s)" % (item, virtual)
+ __build_path.append(pathstr)
- depends_list = (oe.data.getVar('DEPENDS', the_data, 1) or "").split()
- if make.options.verbose:
- oe.note("current path: %s" % (" -> ".join(__build_path)))
- oe.note("dependencies for %s are: %s" % (item, " ".join(depends_list)))
+ depends_list = (oe.data.getVar('DEPENDS', the_data, 1) or "").split()
+ if make.options.verbose:
+ oe.note("current path: %s" % (" -> ".join(__build_path)))
+ oe.note("dependencies for %s are: %s" % (item, " ".join(depends_list)))
+ try:
+ failed = False
+
+ if __depcmd:
+ oldcmd = make.options.cmd
+ make.options.cmd = __depcmd
+
+ for d in depends_list:
+ if d in __ignored_dependencies:
+ continue
+ if not __depcmd:
+ continue
+ if buildPackage(d) == 0:
+ oe.error("dependency %s (for %s) not satisfied" % (d,item))
+ failed = True
+ if make.options.abort:
+ break
+
+ if __depcmd:
+ make.options.cmd = oldcmd
+
+ if failed:
+ __stats["deps"] += 1
+ return False
+
+ oe.event.fire(oe.event.PkgStarted(item, make.pkgdata[fn]))
try:
- failed = False
-
- if __depcmd:
- oldcmd = make.options.cmd
- make.options.cmd = __depcmd
-
- for d in depends_list:
- if d in __ignored_dependencies:
- continue
- if not __depcmd:
- continue
- if buildPackage(d) == 0:
- oe.error("dependency %s (for %s) not satisfied" % (d,item))
- failed = True
- if make.options.abort:
- break
-
- if __depcmd:
- make.options.cmd = oldcmd
-
- if failed:
- __stats["deps"] += 1
- return False
-
- oe.event.fire(oe.event.PkgStarted(item, make.pkgdata[fn]))
- try:
- __stats["attempt"] += 1
- if not make.options.dry_run:
- oe.build.exec_task('do_%s' % make.options.cmd, make.pkgdata[fn])
- oe.event.fire(oe.event.PkgSucceeded(item, make.pkgdata[fn]))
- __build_cache.append(fn)
- return True
- except oe.build.FuncFailed:
- __stats["fail"] += 1
- oe.error("task stack execution failed")
- oe.event.fire(oe.event.PkgFailed(item, make.pkgdata[fn]))
- __build_cache_fail.append(fn)
- return False
- except oe.build.EventException:
- __stats["fail"] += 1
- (type, value, traceback) = sys.exc_info()
- e = value.event
- oe.error("%s event exception, aborting" % oe.event.getName(e))
- oe.event.fire(oe.event.PkgFailed(item, make.pkgdata[fn]))
- __build_cache_fail.append(fn)
- return False
- finally:
- __building_list.remove(fn)
- __build_path.remove(pathstr)
-
+ __stats["attempt"] += 1
+ if not make.options.dry_run:
+ oe.build.exec_task('do_%s' % make.options.cmd, make.pkgdata[fn])
+ oe.event.fire(oe.event.PkgSucceeded(item, make.pkgdata[fn]))
+ __build_cache.append(fn)
+ return True
+ except oe.build.FuncFailed:
+ __stats["fail"] += 1
+ oe.error("task stack execution failed")
+ oe.event.fire(oe.event.PkgFailed(item, make.pkgdata[fn]))
+ __build_cache_fail.append(fn)
+ return False
+ except oe.build.EventException:
+ __stats["fail"] += 1
+ (type, value, traceback) = sys.exc_info()
+ e = value.event
+ oe.error("%s event exception, aborting" % oe.event.getName(e))
+ oe.event.fire(oe.event.PkgFailed(item, make.pkgdata[fn]))
+ __build_cache_fail.append(fn)
+ return False
+ finally:
+ __building_list.remove(fn)
+ __build_path.remove(pathstr)
+
def buildPackage(item):
- fn = None
+ fn = None
+
+ if not providers.has_key(item):
+ oe.error("Nothing provides %s" % item)
+ return 0
+
+ all_p = providers[item]
+
+ for p in all_p:
+ if p in __build_cache:
+ return 1
+
+ versions = {}
+ for p in all_p:
+ the_data = make.pkgdata[p]
+ pn = oe.data.getVar('PN', the_data, 1)
+ pv = oe.data.getVar('PV', the_data, 1)
+ pr = oe.data.getVar('PR', the_data, 1)
+ if not versions.has_key(pn):
+ versions[pn] = []
+ versions[pn].append(((pv, pr), p))
+
+ # find the latest version of each provider
+ preferred_versions = {}
+ for p in versions.keys():
+ latest = None
+ latest_f = None
+ for (v, _fn) in versions[p]:
+ if (latest is None) or (make.vercmp(latest, v) < 0):
+ latest = v
+ latest_f = _fn
+ preferred_versions[p] = (latest, latest_f)
- if not providers.has_key(item):
- oe.error("Nothing provides %s" % item)
- return 0
-
- all_p = providers[item]
-
- for p in all_p:
- if p in __build_cache:
- return 1
-
- versions = {}
- for p in all_p:
- the_data = make.pkgdata[p]
- pn = oe.data.getVar('PN', the_data, 1)
- pv = oe.data.getVar('PV', the_data, 1)
- pr = oe.data.getVar('PR', the_data, 1)
- if not versions.has_key(pn):
- versions[pn] = []
- versions[pn].append(((pv, pr), p))
-
- # find the latest version of each provider
- preferred_versions = {}
- for p in versions.keys():
- latest = None
- latest_f = None
- for (v, _fn) in versions[p]:
- if (latest is None) or (make.vercmp(latest, v) < 0):
- latest = v
- latest_f = _fn
- preferred_versions[p] = (latest, latest_f)
-
- # build a new list with just the latest version of everything
- eligible = []
- for p in preferred_versions.keys():
- (v, f) = preferred_versions[p]
- eligible.append(f)
+ # build a new list with just the latest version of everything
+ eligible = []
+ for p in preferred_versions.keys():
+ (v, f) = preferred_versions[p]
+ eligible.append(f)
+
+ for p in eligible:
+ if p in __build_cache_fail:
+ oe.debug(1, "rejecting already-failed %s" % p)
+ eligible.remove(p)
+
+ if len(eligible) == 0:
+ oe.error("no eligible providers for %s" % item)
+ return 0
+ # look to see if one of them is already staged, or marked as preferred.
+ # if so, bump it to the head of the queue
+ for p in all_p:
+ the_data = make.pkgdata[p]
+ pn = oe.data.getVar('PN', the_data, 1)
+ pv = oe.data.getVar('PV', the_data, 1)
+ pr = oe.data.getVar('PR', the_data, 1)
+ tmpdir = oe.data.getVar('TMPDIR', the_data, 1)
+ stamp = '%s/stamps/%s-%s-%s.do_populate_staging' % (tmpdir, pn, pv, pr)
+ if os.path.exists(stamp):
+ (newvers, fn) = preferred_versions[pn]
+ if not fn in eligible:
+ # package was made ineligible by already-failed check
+ continue
+ oldver = "%s-%s" % (pv, pr)
+ newver = '-'.join(newvers)
+ if (newver != oldver):
+ extra_chat = "; upgrading from %s to %s" % (oldver, newver)
+ else:
+ extra_chat = ""
+ if make.options.verbose:
+ oe.note("selecting already-staged %s to satisfy %s%s" % (pn, item, extra_chat))
+ eligible.remove(fn)
+ eligible = [fn] + eligible
+ break
+
+ if __preferred.has_key(item):
for p in eligible:
- if p in __build_cache_fail:
- oe.debug(1, "rejecting already-failed %s" % p)
- eligible.remove(p)
-
- if len(eligible) == 0:
- oe.error("no eligible providers for %s" % item)
- return 0
-
- # look to see if one of them is already staged, or marked as preferred.
- # if so, bump it to the head of the queue
- for p in all_p:
- the_data = make.pkgdata[p]
- pn = oe.data.getVar('PN', the_data, 1)
- pv = oe.data.getVar('PV', the_data, 1)
- pr = oe.data.getVar('PR', the_data, 1)
- tmpdir = oe.data.getVar('TMPDIR', the_data, 1)
- stamp = '%s/stamps/%s-%s-%s.do_populate_staging' % (tmpdir, pn, pv, pr)
- if os.path.exists(stamp):
- (newvers, fn) = preferred_versions[pn]
- if not fn in eligible:
- # package was made ineligible by already-failed check
- continue
- oldver = "%s-%s" % (pv, pr)
- newver = '-'.join(newvers)
- if (newver != oldver):
- extra_chat = "; upgrading from %s to %s" % (oldver, newver)
- else:
- extra_chat = ""
- if make.options.verbose:
- oe.note("selecting already-staged %s to satisfy %s%s" % (pn, item, extra_chat))
- eligible.remove(fn)
- eligible = [fn] + eligible
- break
-
- if __preferred.has_key(item):
- for p in eligible:
- the_data = make.pkgdata[p]
- pn = oe.data.getVar('PN', the_data, 1)
- if __preferred[item] == pn:
- if make.options.verbose:
- oe.note("selecting %s to satisfy %s due to PREFERRED_PROVIDERS" % (pn, item))
- eligible.remove(p)
- eligible = [p] + eligible
- break
-
- # run through the list until we find one that we can build
- for fn in eligible:
- oe.debug(2, "selecting %s to satisfy %s" % (fn, item))
- if try_build(fn, item):
- return 1
-
- oe.note("no buildable providers for %s" % item)
- return 0
+ the_data = make.pkgdata[p]
+ pn = oe.data.getVar('PN', the_data, 1)
+ if __preferred[item] == pn:
+ if make.options.verbose:
+ oe.note("selecting %s to satisfy %s due to PREFERRED_PROVIDERS" % (pn, item))
+ eligible.remove(p)
+ eligible = [p] + eligible
+ break
+
+ # run through the list until we find one that we can build
+ for fn in eligible:
+ oe.debug(2, "selecting %s to satisfy %s" % (fn, item))
+ if try_build(fn, item):
+ return 1
+
+ oe.note("no buildable providers for %s" % item)
+ return 0
def build_depgraph():
@@ -238,55 +238,55 @@ def build_depgraph():
pn_provides = {}
for f in make.pkgdata.keys():
- d = make.pkgdata[f]
-
- pn = oe.data.getVar('PN', d, 1)
+ d = make.pkgdata[f]
+
+ pn = oe.data.getVar('PN', d, 1)
- deps = (oe.data.getVar("DEPENDS", d, 1) or "").split()
- provides = Set([pn] + (oe.data.getVar("PROVIDES", d, 1) or "").split())
+ deps = (oe.data.getVar("DEPENDS", d, 1) or "").split()
+ provides = Set([pn] + (oe.data.getVar("PROVIDES", d, 1) or "").split())
- for dep in deps:
- all_depends.add(dep)
+ for dep in deps:
+ all_depends.add(dep)
- if not pn_provides.has_key(pn):
- pn_provides[pn] = Set()
- pn_provides[pn] |= provides
-
- for provide in provides:
- if not providers.has_key(provide):
- providers[provide] = []
- providers[provide].append(f)
+ if not pn_provides.has_key(pn):
+ pn_provides[pn] = Set()
+ pn_provides[pn] |= provides
+
+ for provide in provides:
+ if not providers.has_key(provide):
+ providers[provide] = []
+ providers[provide].append(f)
- for p in (oe.data.getVar('PREFERRED_PROVIDERS', d, 1) or "").split():
- (providee, provider) = p.split(':')
- if __preferred.has_key(providee) and __preferred[providee] != provider:
- oe.error("conflicting preferences for %s: both %s and %s specified" % (providee, provider, __preferred[providee]))
- __preferred[providee] = provider
+ for p in (oe.data.getVar('PREFERRED_PROVIDERS', d, 1) or "").split():
+ (providee, provider) = p.split(':')
+ if __preferred.has_key(providee) and __preferred[providee] != provider:
+ oe.error("conflicting preferences for %s: both %s and %s specified" % (providee, provider, __preferred[providee]))
+ __preferred[providee] = provider
for f in make.pkgdata.keys():
- d = make.pkgdata[f]
- if oe.data.getVar('BROKEN', d, 1):
- continue
- terminal = True
- pn = oe.data.getVar('PN', d, 1)
- for p in pn_provides[pn]:
- if p in all_depends or p.startswith('virtual/'):
- terminal = False
- break
- if terminal:
- __world_target.add(pn)
+ d = make.pkgdata[f]
+ if oe.data.getVar('BROKEN', d, 1):
+ continue
+ terminal = True
+ pn = oe.data.getVar('PN', d, 1)
+ for p in pn_provides[pn]:
+ if p in all_depends or p.startswith('virtual/'):
+ terminal = False
+ break
+ if terminal:
+ __world_target.add(pn)
def myProgressCallback( x, y, f ):
- if os.isatty(sys.stdout.fileno()):
- sys.stdout.write("\rNOTE: Parsing .oe files: %s (%04d/%04d) [%2d %%]" % ( parsespin.next(), x, y, x*100/y ) )
- sys.stdout.flush()
- else:
- if x == 1:
- sys.stdout.write("Parsing .oe files, please wait...")
- sys.stdout.flush()
- if x == y:
- sys.stdout.write("done.\n")
- sys.stdout.flush()
+ if os.isatty(sys.stdout.fileno()):
+ sys.stdout.write("\rNOTE: Parsing .oe files: %s (%04d/%04d) [%2d %%]" % ( parsespin.next(), x, y, x*100/y ) )
+ sys.stdout.flush()
+ else:
+ if x == 1:
+ sys.stdout.write("Parsing .oe files, please wait...")
+ sys.stdout.flush()
+ if x == y:
+ sys.stdout.write("done.\n")
+ sys.stdout.flush()
#
@@ -298,30 +298,30 @@ if __name__ == "__main__":
make.options, args = handle_options( sys.argv )
if not make.options.cmd:
- make.options.cmd = "build"
+ make.options.cmd = "build"
if make.options.cmd in __depcmds:
- __depcmd=__depcmds[make.options.cmd]
+ __depcmd=__depcmds[make.options.cmd]
else:
- __depcmd=make.options.cmd
+ __depcmd=make.options.cmd
make.pkgdata = {}
make.cfg = {}
providers = {}
for f in make.options.file:
- try:
- make.cfg = oe.parse.handle(f, make.cfg)
- except IOError:
- oe.fatal("Unable to open %s" % f)
+ try:
+ make.cfg = oe.parse.handle(f, make.cfg)
+ except IOError:
+ oe.fatal("Unable to open %s" % f)
try:
- make.cfg = oe.parse.handle("conf/oe.conf", make.cfg)
+ make.cfg = oe.parse.handle("conf/oe.conf", make.cfg)
except IOError:
- oe.fatal("Unable to open oe.conf")
+ oe.fatal("Unable to open oe.conf")
if not oe.data.getVar("BUILDNAME", make.cfg):
- oe.data.setVar("BUILDNAME", os.popen('date +%Y%m%d%H%M').readline().strip(), make.cfg)
+ oe.data.setVar("BUILDNAME", os.popen('date +%Y%m%d%H%M').readline().strip(), make.cfg)
buildname = oe.data.getVar("BUILDNAME", make.cfg)
@@ -330,16 +330,16 @@ if __name__ == "__main__":
pkgs_to_build = None
if args:
- if not pkgs_to_build:
- pkgs_to_build = []
- pkgs_to_build.extend(args)
+ if not pkgs_to_build:
+ pkgs_to_build = []
+ pkgs_to_build.extend(args)
if not pkgs_to_build:
- oepkgs = oe.data.getVar('OEPKGS', make.cfg, 1)
- if oepkgs:
- pkgs_to_build = oepkgs.split()
+ oepkgs = oe.data.getVar('OEPKGS', make.cfg, 1)
+ if oepkgs:
+ pkgs_to_build = oepkgs.split()
if not pkgs_to_build:
- print "Nothing to build. Use 'oemake world' to build everything."
- sys.exit(0)
+ print "Nothing to build. Use 'oemake world' to build everything."
+ sys.exit(0)
__stats["attempt"] = 0
__stats["success"] = 0
@@ -348,47 +348,47 @@ if __name__ == "__main__":
# Import Psyco if available and not disabled
if not make.options.disable_psyco:
- try:
- import psyco
- except ImportError:
- print "NOTE: Psyco JIT Compiler (http://psyco.sf.net) not available. Install it to increase performance."
- else:
- psyco.bind( make.collect_oefiles )
+ try:
+ import psyco
+ except ImportError:
+ print "NOTE: Psyco JIT Compiler (http://psyco.sf.net) not available. Install it to increase performance."
+ else:
+ psyco.bind( make.collect_oefiles )
else:
- print "NOTE: You have disabled Psyco. This decreases performance."
+ print "NOTE: You have disabled Psyco. This decreases performance."
try:
- make.collect_oefiles( myProgressCallback )
- print
- if make.options.parse_only:
- print "Requested parsing .oe files only. Exiting."
- sys.exit(0)
- build_depgraph()
-
- if 'world' in pkgs_to_build:
- pkgs_to_build.remove('world')
- for t in __world_target:
- pkgs_to_build.append(t)
-
- oe.event.fire(oe.event.BuildStarted(buildname, pkgs_to_build, make.cfg))
-
- for k in pkgs_to_build:
- if buildPackage(k) == 0:
- oe.error("Build of " + k + " failed")
- if make.options.abort:
- sys.exit(1)
-
- oe.event.fire(oe.event.BuildCompleted(buildname, pkgs_to_build, make.cfg))
-
- print "Build statistics:"
- print " Attempted builds: %d" % __stats["attempt"]
- if __stats["fail"] != 0:
- print " Failed builds: %d" % __stats["fail"]
- if __stats["deps"] != 0:
- print " Dependencies not satisfied: %d" % __stats["deps"]
- if __stats["fail"] != 0 or __stats["deps"] != 0:
- sys.exit(1)
+ make.collect_oefiles( myProgressCallback )
+ print
+ if make.options.parse_only:
+ print "Requested parsing .oe files only. Exiting."
sys.exit(0)
+ build_depgraph()
+
+ if 'world' in pkgs_to_build:
+ pkgs_to_build.remove('world')
+ for t in __world_target:
+ pkgs_to_build.append(t)
+
+ oe.event.fire(oe.event.BuildStarted(buildname, pkgs_to_build, make.cfg))
+
+ for k in pkgs_to_build:
+ if buildPackage(k) == 0:
+ oe.error("Build of " + k + " failed")
+ if make.options.abort:
+ sys.exit(1)
+
+ oe.event.fire(oe.event.BuildCompleted(buildname, pkgs_to_build, make.cfg))
+
+ print "Build statistics:"
+ print " Attempted builds: %d" % __stats["attempt"]
+ if __stats["fail"] != 0:
+ print " Failed builds: %d" % __stats["fail"]
+ if __stats["deps"] != 0:
+ print " Dependencies not satisfied: %d" % __stats["deps"]
+ if __stats["fail"] != 0 or __stats["deps"] != 0:
+ sys.exit(1)
+ sys.exit(0)
except KeyboardInterrupt:
- print "\nNOTE: KeyboardInterrupt - Build not completed."
+ print "\nNOTE: KeyboardInterrupt - Build not completed."
diff --git a/bin/oemaked b/bin/oemaked
index 008f713a0..bf2b49445 100644
--- a/bin/oemaked
+++ b/bin/oemaked
@@ -3,33 +3,33 @@
import os, sys, stat, daemon, time
if not "OEFILES" in os.environ:
- sys.exit(1)
+ sys.exit(1)
olddir=os.getcwd()
delay=30
files = []
for file in os.environ["OEFILES"].split():
- file = os.path.abspath(file)
- if os.access(file, os.R_OK):
- print "%s" % file
- files.append([file, None])
+ file = os.path.abspath(file)
+ if os.access(file, os.R_OK):
+ print "%s" % file
+ files.append([file, None])
daemon.daemonize("/home/kergoth/out", "/home/kergoth/err", "/dev/null")
os.chdir(olddir)
def runOEMake():
- os.system("oemake")
+ os.system("oemake")
while 1:
- __dirty = 0
- for file in files:
- time = os.stat(file[0])[stat.ST_MTIME]
- if file[1] is None or time != file[1]:
- __dirty = 1
- file[1] = time
- if __dirty == 1:
- runOEMake()
-
- time.sleep(delay)
+ __dirty = 0
+ for file in files:
+ time = os.stat(file[0])[stat.ST_MTIME]
+ if file[1] is None or time != file[1]:
+ __dirty = 1
+ file[1] = time
+ if __dirty == 1:
+ runOEMake()
+
+ time.sleep(delay)
diff --git a/bin/oemakepkgs b/bin/oemakepkgs
index d1d2b58a1..076a516a4 100644
--- a/bin/oemakepkgs
+++ b/bin/oemakepkgs
@@ -27,18 +27,18 @@
#
# Here is a sample pkglist file:
#
-# native - ipkg-native
-# native - ipkg-utils
-# base - autoconf 2.57
-# #base - automake
-# #base - libtool
-# base ipk glibc
-# base ipk ncurses
+# native - ipkg-native
+# native - ipkg-utils
+# base - autoconf 2.57
+# #base - automake
+# #base - libtool
+# base ipk glibc
+# base ipk ncurses
#
# There are two other directives that we support so far:
#
-# use <dir-or-file-to-search-for-oe-files>
-# ignore <dir-or-file-to-not-search>
+# use <dir-or-file-to-search-for-oe-files>
+# ignore <dir-or-file-to-not-search>
#
@@ -55,120 +55,120 @@ selected_group = ''
def add_oe_file(name, dirname):
- """Adds one *.oe file to oefiles[]"""
+ """Adds one *.oe file to oefiles[]"""
- try:
- name, version = name.split('_')
- except ValueError:
- version = ''
- #print dirname, name, version
- if not name in oefiles:
- oefiles[name] = {}
- oefiles[name][version] = dirname
+ try:
+ name, version = name.split('_')
+ except ValueError:
+ version = ''
+# #print dirname, name, version
+ if not name in oefiles:
+ oefiles[name] = {}
+ oefiles[name][version] = dirname
def print_oefiles():
- pkgs = oefiles.keys()
- pkgs.sort()
- for p in pkgs:
- versions = oefiles[p].keys()
- versions.sort()
- for v in versions:
- print "%-25s %-20s %s" % (p, v, oefiles[p][v])
+ pkgs = oefiles.keys()
+ pkgs.sort()
+ for p in pkgs:
+ versions = oefiles[p].keys()
+ versions.sort()
+ for v in versions:
+ print "%-25s %-20s %s" % (p, v, oefiles[p][v])
def add_oe_files(arg, dirname, names):
- """Adds all found *.oe files to the global oefiles{} hash, except
- ones in SCCS directories"""
+ """Adds all found *.oe files to the global oefiles{} hash, except
+ ones in SCCS directories"""
- global oefiles
+ global oefiles
- # delete the files/directories to ignore from the list of names:
- for i in ignore.keys():
- try:
- names.remove(i)
- except ValueError:
- pass
- for n in names:
- name, ext = os.path.splitext(n)
- if ext == ".oe":
- add_oe_file(name, dirname)
+# # delete the files/directories to ignore from the list of names:
+ for i in ignore.keys():
+ try:
+ names.remove(i)
+ except ValueError:
+ pass
+ for n in names:
+ name, ext = os.path.splitext(n)
+ if ext == ".oe":
+ add_oe_file(name, dirname)
def search_package(name, flags, version):
- """Search for the right specified package/version was found"""
+ """Search for the right specified package/version was found"""
- #print "Searching for package %s %s" % (name, version)
- if not name in oefiles:
- print "Package '%s' not found" % name
- return
+# #print "Searching for package %s %s" % (name, version)
+ if not name in oefiles:
+ print "Package '%s' not found" % name
+ return
- versions = oefiles[name].keys()
+ versions = oefiles[name].keys()
- # Use highest version if none specified
- # TOOD: this code is full tilt boogy. A string compare can't compare version numbers
- # e.g. for sort the string "1.9" is higher than "1.10"
- versions.sort()
- if not version: version = versions[-1]
+# # Use highest version if none specified
+# # TOOD: this code is full tilt boogy. A string compare can't compare version numbers
+# # e.g. for sort the string "1.9" is higher than "1.10"
+ versions.sort()
+ if not version: version = versions[-1]
- if not oefiles[name][version]:
- print "Package '%s' with version '%s' not found" % (name, version)
- return
+ if not oefiles[name][version]:
+ print "Package '%s' with version '%s' not found" % (name, version)
+ return
- if version:
- fn = "%s_%s.oe" % (name, version)
- else:
- fn = "%s.oe" % name
- print "Process", os.path.join(oefiles[name][version],fn)
+ if version:
+ fn = "%s_%s.oe" % (name, version)
+ else:
+ fn = "%s.oe" % name
+ print "Process", os.path.join(oefiles[name][version],fn)
__pkglist_regexp__ = re.compile( r"^(\S+)\s+(\S+)\s+(\S+)\s*(\S*)$" )
def parse_pkglist(fn):
- """Parses the *.pkglist file and process valid entries via search_package"""
+ """Parses the *.pkglist file and process valid entries via search_package"""
- global ignore
+ global ignore
- print "reading %s" % fn
- f = open(fn, 'r')
- lineno = 0
- while 1:
- lineno = lineno + 1
- line = f.readline()
- if not line:
- break
- line = line.strip()
- if line=='' or line[0]=='#':
- continue
+ print "reading %s" % fn
+ f = open(fn, 'r')
+ lineno = 0
+ while 1:
+ lineno = lineno + 1
+ line = f.readline()
+ if not line:
+ break
+ line = line.strip()
+ if line=='' or line[0]=='#':
+ continue
- # key words
- if line.startswith("use "):
- os.path.walk(line[4:], add_oe_files, '')
- continue
+# # key words
+ if line.startswith("use "):
+ os.path.walk(line[4:], add_oe_files, '')
+ continue
- if line.startswith("ignore "):
- ignore[line[7:]] = 1
- continue
+ if line.startswith("ignore "):
+ ignore[line[7:]] = 1
+ continue
- # normal list entry
- m = __pkglist_regexp__.match(line)
- if m:
- group = m.group(1)
+# # normal list entry
+ m = __pkglist_regexp__.match(line)
+ if m:
+ group = m.group(1)
- #if selected_group and group != selected_group: continue
+# #if selected_group and group != selected_group: continue
- flags = m.group(2)
- name = m.group(3)
- version = m.group(4)
+ flags = m.group(2)
+ name = m.group(3)
+ version = m.group(4)
- search_package(name, flags, version)
- continue
+ search_package(name, flags, version)
+ continue
- error("%s:%d: wrong format" % (fn, lineno))
+ error("%s:%d: wrong format" % (fn, lineno))
try:
- cfg = oe.parse.handle("conf/oe.conf", cfg)
+ cfg = oe.parse.handle("conf/oe.conf", cfg)
except IOError:
- fatal("Unable to open oe.conf")
+ fatal("Unable to open oe.conf")
@@ -179,14 +179,14 @@ oe.data.setVar('OEDEBUG', 2)
found = False
pkg_fn = oe.data.expand("${MACHINE}.pkglist", cfg)
for p in ('.:'+oe.data.getVar("OEPATH", cfg)).split(':'):
- p = oe.data.expand(p, cfg)
- p = os.path.join(p, pkg_fn)
- #print "Trying to read %s" % p
- if os.access(p, os.R_OK):
- parse_pkglist(p)
- found = True
- break
+ p = oe.data.expand(p, cfg)
+ p = os.path.join(p, pkg_fn)
+# #print "Trying to read %s" % p
+ if os.access(p, os.R_OK):
+ parse_pkglist(p)
+ found = True
+ break
if not found:
- print "'%s' not found in OEPATH" % pkg_fn
+ print "'%s' not found in OEPATH" % pkg_fn
print_oefiles()
diff --git a/bin/oeread b/bin/oeread
index 78435ec58..a8155083c 100644
--- a/bin/oeread
+++ b/bin/oeread
@@ -10,26 +10,26 @@ cfgkeys = cfg.keys()
cfgkeys.sort()
if len(sys.argv) == 2:
- oefile = copy.deepcopy(cfg)
- try:
- oefile = oe.parse.handle(sys.argv[1], oefile)
- except Exception, e:
- oe.fatal("%s" % e)
- oefilekeys = oefile.keys()
- oefilekeys.sort()
- print "Variables in %s:" % sys.argv[1]
- for k in oefilekeys:
- if k.startswith('base_'): continue
- if k.startswith('FILES_'): continue
- if k.startswith('do_'): continue
- if k.startswith('oe'): continue
- if k in cfg:
- if cfg[k] == oefile[k]:
- continue
- if 'content' in oefile[k]:
- print k,'=',oe.data.expand(oefile[k]['content'], oefile)
+ oefile = copy.deepcopy(cfg)
+ try:
+ oefile = oe.parse.handle(sys.argv[1], oefile)
+ except Exception, e:
+ oe.fatal("%s" % e)
+ oefilekeys = oefile.keys()
+ oefilekeys.sort()
+ print "Variables in %s:" % sys.argv[1]
+ for k in oefilekeys:
+ if k.startswith('base_'): continue
+ if k.startswith('FILES_'): continue
+ if k.startswith('do_'): continue
+ if k.startswith('oe'): continue
+ if k in cfg:
+ if cfg[k] == oefile[k]:
+ continue
+ if 'content' in oefile[k]:
+ print k,'=',oe.data.expand(oefile[k]['content'], oefile)
else:
- print "Variables in conf/oe.conf & friends:"
- for k in cfgkeys:
- print "%-30s %s" % (k, cfg[k])
+ print "Variables in conf/oe.conf & friends:"
+ for k in cfgkeys:
+ print "%-30s %s" % (k, cfg[k])
diff --git a/bin/parse_manifest b/bin/parse_manifest
index 29fcac34a..3d3c3ea35 100644
--- a/bin/parse_manifest
+++ b/bin/parse_manifest
@@ -4,16 +4,16 @@ import sys, oe, oe.manifest
mfile = sys.__stdin__
if len(sys.argv) == 2:
- mfile = file(sys.argv[1], "r")
+ mfile = file(sys.argv[1], "r")
d = oe.data.init()
manifest = oe.manifest.parse(mfile, d)
for func in ("do_stage", "do_install", "do_populate"):
- value = oe.manifest.emit(func, manifest, d)
- if value:
- oe.data.setVar(func, value, d)
- oe.data.setVarFlag(func, "func", 1, d)
- oe.data.emit_var(func, sys.__stdout__, d)
- sys.__stdout__.write("\n")
+ value = oe.manifest.emit(func, manifest, d)
+ if value:
+ oe.data.setVar(func, value, d)
+ oe.data.setVarFlag(func, "func", 1, d)
+ oe.data.emit_var(func, sys.__stdout__, d)
+ sys.__stdout__.write("\n")