From b22831fd63164c4db9c0b72934d7d734a6585251 Mon Sep 17 00:00:00 2001 From: Richard Purdie Date: Wed, 9 Nov 2011 15:00:01 +0000 Subject: Convert to use direct access to the data store (instead of bb.data.*Var*()) This is the result of running the following over the metadata: sed \ -e 's:bb.data.\(setVar([^,()]*,[^,()]*\), *\([^ )]*\) *):\2.\1):g' \ -e 's:bb.data.\(setVarFlag([^,()]*,[^,()]*,[^,()]*\), *\([^) ]*\) *):\2.\1):g' \ -e 's:bb.data.\(getVar([^,()]*\), *\([^(), ]*\) *,\([^)]*\)):\2.\1,\3):g' \ -e 's:bb.data.\(getVarFlag([^,()]*,[^,()]*\), *\([^(), ]*\) *,\([^)]*\)):\2.\1,\3):g' \ -e 's:bb.data.\(getVarFlag([^,()]*,[^,()]*\), *\([^() ]*\) *):\2.\1):g' \ -e 's:bb.data.\(getVar([^,()]*\), *\([^) ]*\) *):\2.\1):g' \ -i `grep -ril bb.data *` Signed-off-by: Richard Purdie --- meta/lib/oe/distro_check.py | 22 +++++++++++----------- meta/lib/oe/patch.py | 4 ++-- meta/lib/oe/utils.py | 8 ++++---- 3 files changed, 17 insertions(+), 17 deletions(-) (limited to 'meta/lib') diff --git a/meta/lib/oe/distro_check.py b/meta/lib/oe/distro_check.py index 4721355bd..ad391e3b0 100644 --- a/meta/lib/oe/distro_check.py +++ b/meta/lib/oe/distro_check.py @@ -276,32 +276,32 @@ def compare_in_distro_packages_list(distro_check_dir, d): localdata = bb.data.createCopy(d) pkglst_dir = os.path.join(distro_check_dir, "package_lists") matching_distros = [] - pn = bb.data.getVar('PN', d, True) - recipe_name = bb.data.getVar('PN', d, True) + pn = d.getVar('PN', True) + recipe_name = d.getVar('PN', True) bb.note("Checking: %s" % pn) trim_dict = dict({"-native":"-native", "-cross":"-cross", "-initial":"-initial"}) if pn.find("-native") != -1: pnstripped = pn.split("-native") - bb.data.setVar('OVERRIDES', "pn-" + pnstripped[0] + ":" + bb.data.getVar('OVERRIDES', d, True), localdata) + bb.data.setVar('OVERRIDES', "pn-" + pnstripped[0] + ":" + d.getVar('OVERRIDES', True), localdata) bb.data.update_data(localdata) recipe_name = pnstripped[0] if pn.find("-cross") != -1: pnstripped = pn.split("-cross") - bb.data.setVar('OVERRIDES', "pn-" + pnstripped[0] + ":" + bb.data.getVar('OVERRIDES', d, True), localdata) + bb.data.setVar('OVERRIDES', "pn-" + pnstripped[0] + ":" + d.getVar('OVERRIDES', True), localdata) bb.data.update_data(localdata) recipe_name = pnstripped[0] if pn.find("-initial") != -1: pnstripped = pn.split("-initial") - bb.data.setVar('OVERRIDES', "pn-" + pnstripped[0] + ":" + bb.data.getVar('OVERRIDES', d, True), localdata) + bb.data.setVar('OVERRIDES', "pn-" + pnstripped[0] + ":" + d.getVar('OVERRIDES', True), localdata) bb.data.update_data(localdata) recipe_name = pnstripped[0] bb.note("Recipe: %s" % recipe_name) - tmp = bb.data.getVar('DISTRO_PN_ALIAS', localdata, True) + tmp = localdata.getVar('DISTRO_PN_ALIAS', True) distro_exceptions = dict({"OE-Core":'OE-Core', "OpenedHand":'OpenedHand', "Intel":'Intel', "Upstream":'Upstream', "Windriver":'Windriver', "OSPDT":'OSPDT Approved', "Poky":'poky'}) @@ -343,23 +343,23 @@ def compare_in_distro_packages_list(distro_check_dir, d): return matching_distros def create_log_file(d, logname): - logpath = bb.data.getVar('LOG_DIR', d, True) + logpath = d.getVar('LOG_DIR', True) bb.utils.mkdirhier(logpath) logfn, logsuffix = os.path.splitext(logname) - logfile = os.path.join(logpath, "%s.%s%s" % (logfn, bb.data.getVar('DATETIME', d, True), logsuffix)) + logfile = os.path.join(logpath, "%s.%s%s" % (logfn, d.getVar('DATETIME', True), logsuffix)) if not os.path.exists(logfile): slogfile = os.path.join(logpath, logname) if os.path.exists(slogfile): os.remove(slogfile) os.system("touch %s" % logfile) os.symlink(logfile, slogfile) - bb.data.setVar('LOG_FILE', logfile, d) + d.setVar('LOG_FILE', logfile) return logfile def save_distro_check_result(result, datetime, result_file, d): - pn = bb.data.getVar('PN', d, True) - logdir = bb.data.getVar('LOG_DIR', d, True) + pn = d.getVar('PN', True) + logdir = d.getVar('LOG_DIR', True) if not logdir: bb.error("LOG_DIR variable is not defined, can't write the distro_check results") return diff --git a/meta/lib/oe/patch.py b/meta/lib/oe/patch.py index 75fb91e0f..f4ccb3e18 100644 --- a/meta/lib/oe/patch.py +++ b/meta/lib/oe/patch.py @@ -179,7 +179,7 @@ class GitApplyTree(PatchTree): class QuiltTree(PatchSet): def _runcmd(self, args, run = True): - quiltrc = bb.data.getVar('QUILTRCFILE', self.d, 1) + quiltrc = self.d.getVar('QUILTRCFILE', 1) if not run: return ["quilt"] + ["--quiltrc"] + [quiltrc] + args runcmd(["quilt"] + ["--quiltrc"] + [quiltrc] + args, self.dir) @@ -357,7 +357,7 @@ class UserResolver(Resolver): # Patch application failed patchcmd = self.patchset.Push(True, False, False) - t = bb.data.getVar('T', self.patchset.d, 1) + t = self.patchset.d.getVar('T', 1) if not t: bb.msg.fatal("Build", "T not set") bb.utils.mkdirhier(t) diff --git a/meta/lib/oe/utils.py b/meta/lib/oe/utils.py index b3473d347..95daace6c 100644 --- a/meta/lib/oe/utils.py +++ b/meta/lib/oe/utils.py @@ -16,19 +16,19 @@ def ifelse(condition, iftrue = True, iffalse = False): return iffalse def conditional(variable, checkvalue, truevalue, falsevalue, d): - if bb.data.getVar(variable,d,1) == checkvalue: + if d.getVar(variable,1) == checkvalue: return truevalue else: return falsevalue def less_or_equal(variable, checkvalue, truevalue, falsevalue, d): - if float(bb.data.getVar(variable,d,1)) <= float(checkvalue): + if float(d.getVar(variable,1)) <= float(checkvalue): return truevalue else: return falsevalue def version_less_or_equal(variable, checkvalue, truevalue, falsevalue, d): - result = bb.vercmp(bb.data.getVar(variable,d,True), checkvalue) + result = bb.vercmp(d.getVar(variable,True), checkvalue) if result <= 0: return truevalue else: @@ -48,7 +48,7 @@ def contains(variable, checkvalues, truevalue, falsevalue, d): return falsevalue def both_contain(variable1, variable2, checkvalue, d): - if bb.data.getVar(variable1,d,1).find(checkvalue) != -1 and bb.data.getVar(variable2,d,1).find(checkvalue) != -1: + if d.getVar(variable1,1).find(checkvalue) != -1 and d.getVar(variable2,1).find(checkvalue) != -1: return checkvalue else: return "" -- cgit v1.2.3