summaryrefslogtreecommitdiffstats
path: root/lib/bb
diff options
context:
space:
mode:
authorRichard Purdie <richard.purdie@linuxfoundation.org>2016-11-16 11:19:01 +0000
committerRichard Purdie <richard.purdie@linuxfoundation.org>2016-11-23 10:59:49 +0000
commitff7892fa808116acc1ac50effa023a4cb031a5fc (patch)
treeeac5dc67571cdd0202f6f75017616ed29866caed /lib/bb
parentcefb8c93c8299e68352cf7ec5ad9ca50c0d499ed (diff)
downloadbitbake-ff7892fa808116acc1ac50effa023a4cb031a5fc.tar.gz
lib/bb: Don't use deprecated bb.data.getVar/setVar API
The old style bb.data.getVar/setVar API is obsolete. Most of bitbake doesn't use it but there were some pieces that escaped conversion. This patch fixes the remaining users mostly in the fetchers. Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'lib/bb')
-rw-r--r--lib/bb/fetch2/__init__.py2
-rw-r--r--lib/bb/fetch2/clearcase.py6
-rw-r--r--lib/bb/fetch2/git.py4
-rw-r--r--lib/bb/fetch2/hg.py2
-rw-r--r--lib/bb/fetch2/local.py8
-rw-r--r--lib/bb/fetch2/npm.py2
-rw-r--r--lib/bb/fetch2/repo.py6
-rw-r--r--lib/bb/fetch2/sftp.py4
-rw-r--r--lib/bb/tests/codeparser.py14
9 files changed, 24 insertions, 24 deletions
diff --git a/lib/bb/fetch2/__init__.py b/lib/bb/fetch2/__init__.py
index cd7362c44..5c76b2252 100644
--- a/lib/bb/fetch2/__init__.py
+++ b/lib/bb/fetch2/__init__.py
@@ -1282,7 +1282,7 @@ class FetchMethod(object):
Can also setup variables in urldata for use in go (saving code duplication
and duplicate code execution)
"""
- return os.path.join(data.getVar("DL_DIR", d, True), urldata.localfile)
+ return os.path.join(d.getVar("DL_DIR", True), urldata.localfile)
def supports_checksum(self, urldata):
"""
diff --git a/lib/bb/fetch2/clearcase.py b/lib/bb/fetch2/clearcase.py
index 70e280a8d..d35b2dabe 100644
--- a/lib/bb/fetch2/clearcase.py
+++ b/lib/bb/fetch2/clearcase.py
@@ -110,7 +110,7 @@ class ClearCase(FetchMethod):
ud.basecmd = d.getVar("FETCHCMD_ccrc", True) or spawn.find_executable("cleartool") or spawn.find_executable("rcleartool")
- if data.getVar("SRCREV", d, True) == "INVALID":
+ if d.getVar("SRCREV", True) == "INVALID":
raise FetchError("Set a valid SRCREV for the clearcase fetcher in your recipe, e.g. SRCREV = \"/main/LATEST\" or any other label of your choice.")
ud.label = d.getVar("SRCREV", False)
@@ -124,7 +124,7 @@ class ClearCase(FetchMethod):
ud.viewname = "%s-view%s" % (ud.identifier, d.getVar("DATETIME", d, True))
ud.csname = "%s-config-spec" % (ud.identifier)
- ud.ccasedir = os.path.join(data.getVar("DL_DIR", d, True), ud.type)
+ ud.ccasedir = os.path.join(d.getVar("DL_DIR", True), ud.type)
ud.viewdir = os.path.join(ud.ccasedir, ud.viewname)
ud.configspecfile = os.path.join(ud.ccasedir, ud.csname)
ud.localfile = "%s.tar.gz" % (ud.identifier)
@@ -144,7 +144,7 @@ class ClearCase(FetchMethod):
self.debug("configspecfile = %s" % ud.configspecfile)
self.debug("localfile = %s" % ud.localfile)
- ud.localfile = os.path.join(data.getVar("DL_DIR", d, True), ud.localfile)
+ ud.localfile = os.path.join(d.getVar("DL_DIR", True), ud.localfile)
def _build_ccase_command(self, ud, command):
"""
diff --git a/lib/bb/fetch2/git.py b/lib/bb/fetch2/git.py
index 1bec60ab7..6b618345c 100644
--- a/lib/bb/fetch2/git.py
+++ b/lib/bb/fetch2/git.py
@@ -182,9 +182,9 @@ class Git(FetchMethod):
if ud.usehead:
ud.unresolvedrev['default'] = 'HEAD'
- ud.basecmd = data.getVar("FETCHCMD_git", d, True) or "git -c core.fsyncobjectfiles=0"
+ ud.basecmd = d.getVar("FETCHCMD_git", True) or "git -c core.fsyncobjectfiles=0"
- ud.write_tarballs = ((data.getVar("BB_GENERATE_MIRROR_TARBALLS", d, True) or "0") != "0") or ud.rebaseable
+ ud.write_tarballs = ((d.getVar("BB_GENERATE_MIRROR_TARBALLS", True) or "0") != "0") or ud.rebaseable
ud.setup_revisons(d)
diff --git a/lib/bb/fetch2/hg.py b/lib/bb/fetch2/hg.py
index 20df8016d..a1419aade 100644
--- a/lib/bb/fetch2/hg.py
+++ b/lib/bb/fetch2/hg.py
@@ -84,7 +84,7 @@ class Hg(FetchMethod):
ud.pkgdir = os.path.join(hgdir, hgsrcname)
ud.moddir = os.path.join(ud.pkgdir, ud.module)
ud.localfile = ud.moddir
- ud.basecmd = data.getVar("FETCHCMD_hg", d, True) or "/usr/bin/env hg"
+ ud.basecmd = d.getVar("FETCHCMD_hg", True) or "/usr/bin/env hg"
ud.write_tarballs = d.getVar("BB_GENERATE_MIRROR_TARBALLS", True)
diff --git a/lib/bb/fetch2/local.py b/lib/bb/fetch2/local.py
index 51ca78d12..5adfd5d44 100644
--- a/lib/bb/fetch2/local.py
+++ b/lib/bb/fetch2/local.py
@@ -63,13 +63,13 @@ class Local(FetchMethod):
newpath = path
if path[0] == "/":
return [path]
- filespath = data.getVar('FILESPATH', d, True)
+ filespath = d.getVar('FILESPATH', True)
if filespath:
logger.debug(2, "Searching for %s in paths:\n %s" % (path, "\n ".join(filespath.split(":"))))
newpath, hist = bb.utils.which(filespath, path, history=True)
searched.extend(hist)
if not newpath:
- filesdir = data.getVar('FILESDIR', d, True)
+ filesdir = d.getVar('FILESDIR', True)
if filesdir:
logger.debug(2, "Searching for %s in path: %s" % (path, filesdir))
newpath = os.path.join(filesdir, path)
@@ -100,10 +100,10 @@ class Local(FetchMethod):
# no need to fetch local files, we'll deal with them in place.
if self.supports_checksum(urldata) and not os.path.exists(urldata.localpath):
locations = []
- filespath = data.getVar('FILESPATH', d, True)
+ filespath = d.getVar('FILESPATH', True)
if filespath:
locations = filespath.split(":")
- filesdir = data.getVar('FILESDIR', d, True)
+ filesdir = d.getVar('FILESDIR', True)
if filesdir:
locations.append(filesdir)
locations.append(d.getVar("DL_DIR", True))
diff --git a/lib/bb/fetch2/npm.py b/lib/bb/fetch2/npm.py
index c3e02e47f..66ab075b1 100644
--- a/lib/bb/fetch2/npm.py
+++ b/lib/bb/fetch2/npm.py
@@ -90,7 +90,7 @@ class Npm(FetchMethod):
self.basecmd = d.getVar("FETCHCMD_wget", True) or "/usr/bin/env wget -O -t 2 -T 30 -nv --passive-ftp --no-check-certificate "
ud.prefixdir = prefixdir
- ud.write_tarballs = ((data.getVar("BB_GENERATE_MIRROR_TARBALLS", d, True) or "0") != "0")
+ ud.write_tarballs = ((d.getVar("BB_GENERATE_MIRROR_TARBALLS", True) or "0") != "0")
ud.mirrortarball = 'npm_%s-%s.tar.xz' % (ud.pkgname, ud.version)
ud.fullmirror = os.path.join(d.getVar("DL_DIR", True), ud.mirrortarball)
diff --git a/lib/bb/fetch2/repo.py b/lib/bb/fetch2/repo.py
index ecc6e68e9..bfd4ae16a 100644
--- a/lib/bb/fetch2/repo.py
+++ b/lib/bb/fetch2/repo.py
@@ -51,17 +51,17 @@ class Repo(FetchMethod):
if not ud.manifest.endswith('.xml'):
ud.manifest += '.xml'
- ud.localfile = data.expand("repo_%s%s_%s_%s.tar.gz" % (ud.host, ud.path.replace("/", "."), ud.manifest, ud.branch), d)
+ ud.localfile = d.expand("repo_%s%s_%s_%s.tar.gz" % (ud.host, ud.path.replace("/", "."), ud.manifest, ud.branch))
def download(self, ud, d):
"""Fetch url"""
- if os.access(os.path.join(data.getVar("DL_DIR", d, True), ud.localfile), os.R_OK):
+ if os.access(os.path.join(d.getVar("DL_DIR", True), ud.localfile), os.R_OK):
logger.debug(1, "%s already exists (or was stashed). Skipping repo init / sync.", ud.localpath)
return
gitsrcname = "%s%s" % (ud.host, ud.path.replace("/", "."))
- repodir = data.getVar("REPODIR", d, True) or os.path.join(data.getVar("DL_DIR", d, True), "repo")
+ repodir = d.getVar("REPODIR", True) or os.path.join(d.getVar("DL_DIR", True), "repo")
codir = os.path.join(repodir, gitsrcname, ud.manifest)
if ud.user:
diff --git a/lib/bb/fetch2/sftp.py b/lib/bb/fetch2/sftp.py
index 7989fccc7..48ddfc176 100644
--- a/lib/bb/fetch2/sftp.py
+++ b/lib/bb/fetch2/sftp.py
@@ -92,7 +92,7 @@ class SFTP(FetchMethod):
else:
ud.basename = os.path.basename(ud.path)
- ud.localfile = data.expand(urllib.parse.unquote(ud.basename), d)
+ ud.localfile = d.expand(urllib.parse.unquote(ud.basename))
def download(self, ud, d):
"""Fetch urls"""
@@ -104,7 +104,7 @@ class SFTP(FetchMethod):
port = '-P %d' % urlo.port
urlo.port = None
- dldir = data.getVar('DL_DIR', d, True)
+ dldir = d.getVar('DL_DIR', True)
lpath = os.path.join(dldir, ud.localfile)
user = ''
diff --git a/lib/bb/tests/codeparser.py b/lib/bb/tests/codeparser.py
index 14f0e2572..b80c315d3 100644
--- a/lib/bb/tests/codeparser.py
+++ b/lib/bb/tests/codeparser.py
@@ -68,7 +68,7 @@ class VariableReferenceTest(ReferenceTest):
def test_python_reference(self):
self.setEmptyVars(["BAR"])
- self.parseExpression("${@bb.data.getVar('BAR', d, True) + 'foo'}")
+ self.parseExpression("${@d.getVar('BAR', True) + 'foo'}")
self.assertReferences(set(["BAR"]))
class ShellReferenceTest(ReferenceTest):
@@ -209,17 +209,17 @@ be. These unit tests are testing snippets."""
return " " + value
def test_getvar_reference(self):
- self.parseExpression("bb.data.getVar('foo', d, True)")
+ self.parseExpression("d.getVar('foo', True)")
self.assertReferences(set(["foo"]))
self.assertExecs(set())
def test_getvar_computed_reference(self):
- self.parseExpression("bb.data.getVar('f' + 'o' + 'o', d, True)")
+ self.parseExpression("d.getVar('f' + 'o' + 'o', True)")
self.assertReferences(set())
self.assertExecs(set())
def test_getvar_exec_reference(self):
- self.parseExpression("eval('bb.data.getVar(\"foo\", d, True)')")
+ self.parseExpression("eval('d.getVar(\"foo\", True)')")
self.assertReferences(set())
self.assertExecs(set(["eval"]))
@@ -269,7 +269,7 @@ be. These unit tests are testing snippets."""
class DependencyReferenceTest(ReferenceTest):
pydata = """
-bb.data.getVar('somevar', d, True)
+d.getVar('somevar', True)
def test(d):
foo = 'bar %s' % 'foo'
def test2(d):
@@ -285,9 +285,9 @@ def a():
test(d)
-bb.data.expand(bb.data.getVar("something", False, d), d)
+bb.data.expand(d.getVar("something", False), d)
bb.data.expand("${inexpand} somethingelse", d)
-bb.data.getVar(a(), d, False)
+d.getVar(a(), False)
"""
def test_python(self):