diff options
author | Richard Purdie <richard.purdie@linuxfoundation.org> | 2011-11-09 15:00:01 +0000 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2011-11-10 11:51:19 +0000 |
commit | c8dee9b92dfd545852ecac8dc2adfc95ac02e957 (patch) | |
tree | 5f1b86954646a0f3bb914407994388a6a4346769 /meta/classes/sstate.bbclass | |
parent | 5d3860f4a8abb8e95442b04f8b84a333af362fcd (diff) | |
download | poky-c8dee9b92dfd545852ecac8dc2adfc95ac02e957.tar.gz |
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 *`
(From OE-Core rev: b22831fd63164c4db9c0b72934d7d734a6585251)
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/classes/sstate.bbclass')
-rw-r--r-- | meta/classes/sstate.bbclass | 94 |
1 files changed, 47 insertions, 47 deletions
diff --git a/meta/classes/sstate.bbclass b/meta/classes/sstate.bbclass index 6abf55bb14..a777c79bb3 100644 --- a/meta/classes/sstate.bbclass +++ b/meta/classes/sstate.bbclass | |||
@@ -20,7 +20,7 @@ SSTATEPOSTINSTFUNCS ?= "" | |||
20 | 20 | ||
21 | python () { | 21 | python () { |
22 | if bb.data.inherits_class('native', d): | 22 | if bb.data.inherits_class('native', d): |
23 | bb.data.setVar('SSTATE_PKGARCH', bb.data.getVar('BUILD_ARCH', d), d) | 23 | bb.data.setVar('SSTATE_PKGARCH', d.getVar('BUILD_ARCH'), d) |
24 | elif bb.data.inherits_class('cross', d): | 24 | elif bb.data.inherits_class('cross', d): |
25 | bb.data.setVar('SSTATE_PKGARCH', bb.data.expand("${BUILD_ARCH}_${TUNE_PKGARCH}", d), d) | 25 | bb.data.setVar('SSTATE_PKGARCH', bb.data.expand("${BUILD_ARCH}_${TUNE_PKGARCH}", d), d) |
26 | bb.data.setVar('SSTATE_MANMACH', bb.data.expand("${BUILD_ARCH}_${MACHINE}", d), d) | 26 | bb.data.setVar('SSTATE_MANMACH', bb.data.expand("${BUILD_ARCH}_${MACHINE}", d), d) |
@@ -37,19 +37,19 @@ python () { | |||
37 | # reused if we manipulate the paths | 37 | # reused if we manipulate the paths |
38 | if bb.data.inherits_class('native', d) or bb.data.inherits_class('cross', d) or bb.data.inherits_class('sdk', d) or bb.data.inherits_class('crosssdk', d): | 38 | if bb.data.inherits_class('native', d) or bb.data.inherits_class('cross', d) or bb.data.inherits_class('sdk', d) or bb.data.inherits_class('crosssdk', d): |
39 | scan_cmd = "grep -Irl ${STAGING_DIR} ${SSTATE_BUILDDIR}" | 39 | scan_cmd = "grep -Irl ${STAGING_DIR} ${SSTATE_BUILDDIR}" |
40 | bb.data.setVar('SSTATE_SCAN_CMD', scan_cmd, d) | 40 | d.setVar('SSTATE_SCAN_CMD', scan_cmd) |
41 | 41 | ||
42 | unique_tasks = set((bb.data.getVar('SSTATETASKS', d, True) or "").split()) | 42 | unique_tasks = set((d.getVar('SSTATETASKS', True) or "").split()) |
43 | d.setVar('SSTATETASKS', " ".join(unique_tasks)) | 43 | d.setVar('SSTATETASKS', " ".join(unique_tasks)) |
44 | namemap = [] | 44 | namemap = [] |
45 | for task in unique_tasks: | 45 | for task in unique_tasks: |
46 | namemap.append(bb.data.getVarFlag(task, 'sstate-name', d)) | 46 | namemap.append(d.getVarFlag(task, 'sstate-name')) |
47 | funcs = bb.data.getVarFlag(task, 'prefuncs', d) or "" | 47 | funcs = d.getVarFlag(task, 'prefuncs') or "" |
48 | funcs = "sstate_task_prefunc " + funcs | 48 | funcs = "sstate_task_prefunc " + funcs |
49 | bb.data.setVarFlag(task, 'prefuncs', funcs, d) | 49 | d.setVarFlag(task, 'prefuncs', funcs) |
50 | funcs = bb.data.getVarFlag(task, 'postfuncs', d) or "" | 50 | funcs = d.getVarFlag(task, 'postfuncs') or "" |
51 | funcs = funcs + " sstate_task_postfunc" | 51 | funcs = funcs + " sstate_task_postfunc" |
52 | bb.data.setVarFlag(task, 'postfuncs', funcs, d) | 52 | d.setVarFlag(task, 'postfuncs', funcs) |
53 | d.setVar('SSTATETASKNAMES', " ".join(namemap)) | 53 | d.setVar('SSTATETASKNAMES', " ".join(namemap)) |
54 | } | 54 | } |
55 | 55 | ||
@@ -65,18 +65,18 @@ def sstate_init(name, task, d): | |||
65 | 65 | ||
66 | def sstate_state_fromvars(d, task = None): | 66 | def sstate_state_fromvars(d, task = None): |
67 | if task is None: | 67 | if task is None: |
68 | task = bb.data.getVar('BB_CURRENTTASK', d, True) | 68 | task = d.getVar('BB_CURRENTTASK', True) |
69 | if not task: | 69 | if not task: |
70 | bb.fatal("sstate code running without task context?!") | 70 | bb.fatal("sstate code running without task context?!") |
71 | task = task.replace("_setscene", "") | 71 | task = task.replace("_setscene", "") |
72 | 72 | ||
73 | name = bb.data.expand(bb.data.getVarFlag("do_" + task, 'sstate-name', d), d) | 73 | name = bb.data.expand(d.getVarFlag("do_" + task, 'sstate-name'), d) |
74 | inputs = (bb.data.expand(bb.data.getVarFlag("do_" + task, 'sstate-inputdirs', d) or "", d)).split() | 74 | inputs = (bb.data.expand(d.getVarFlag("do_" + task, 'sstate-inputdirs') or "", d)).split() |
75 | outputs = (bb.data.expand(bb.data.getVarFlag("do_" + task, 'sstate-outputdirs', d) or "", d)).split() | 75 | outputs = (bb.data.expand(d.getVarFlag("do_" + task, 'sstate-outputdirs') or "", d)).split() |
76 | plaindirs = (bb.data.expand(bb.data.getVarFlag("do_" + task, 'sstate-plaindirs', d) or "", d)).split() | 76 | plaindirs = (bb.data.expand(d.getVarFlag("do_" + task, 'sstate-plaindirs') or "", d)).split() |
77 | lockfiles = (bb.data.expand(bb.data.getVarFlag("do_" + task, 'sstate-lockfile', d) or "", d)).split() | 77 | lockfiles = (bb.data.expand(d.getVarFlag("do_" + task, 'sstate-lockfile') or "", d)).split() |
78 | lockfilesshared = (bb.data.expand(bb.data.getVarFlag("do_" + task, 'sstate-lockfile-shared', d) or "", d)).split() | 78 | lockfilesshared = (bb.data.expand(d.getVarFlag("do_" + task, 'sstate-lockfile-shared') or "", d)).split() |
79 | interceptfuncs = (bb.data.expand(bb.data.getVarFlag("do_" + task, 'sstate-interceptfuncs', d) or "", d)).split() | 79 | interceptfuncs = (bb.data.expand(d.getVarFlag("do_" + task, 'sstate-interceptfuncs') or "", d)).split() |
80 | if not name or len(inputs) != len(outputs): | 80 | if not name or len(inputs) != len(outputs): |
81 | bb.fatal("sstate variables not setup correctly?!") | 81 | bb.fatal("sstate variables not setup correctly?!") |
82 | 82 | ||
@@ -139,7 +139,7 @@ def sstate_install(ss, d): | |||
139 | f.write(di + "\n") | 139 | f.write(di + "\n") |
140 | f.close() | 140 | f.close() |
141 | 141 | ||
142 | for postinst in (bb.data.getVar('SSTATEPOSTINSTFUNCS', d, True) or '').split(): | 142 | for postinst in (d.getVar('SSTATEPOSTINSTFUNCS', True) or '').split(): |
143 | bb.build.exec_func(postinst, d) | 143 | bb.build.exec_func(postinst, d) |
144 | 144 | ||
145 | for lock in locks: | 145 | for lock in locks: |
@@ -156,7 +156,7 @@ def sstate_installpkg(ss, d): | |||
156 | oe.path.remove(dir) | 156 | oe.path.remove(dir) |
157 | 157 | ||
158 | sstateinst = bb.data.expand("${WORKDIR}/sstate-install-%s/" % ss['name'], d) | 158 | sstateinst = bb.data.expand("${WORKDIR}/sstate-install-%s/" % ss['name'], d) |
159 | sstatepkg = bb.data.getVar('SSTATE_PKG', d, True) + '_' + ss['name'] + ".tgz" | 159 | sstatepkg = d.getVar('SSTATE_PKG', True) + '_' + ss['name'] + ".tgz" |
160 | 160 | ||
161 | if not os.path.exists(sstatepkg): | 161 | if not os.path.exists(sstatepkg): |
162 | pstaging_fetch(sstatepkg, d) | 162 | pstaging_fetch(sstatepkg, d) |
@@ -167,16 +167,16 @@ def sstate_installpkg(ss, d): | |||
167 | 167 | ||
168 | sstate_clean(ss, d) | 168 | sstate_clean(ss, d) |
169 | 169 | ||
170 | bb.data.setVar('SSTATE_INSTDIR', sstateinst, d) | 170 | d.setVar('SSTATE_INSTDIR', sstateinst) |
171 | bb.data.setVar('SSTATE_PKG', sstatepkg, d) | 171 | d.setVar('SSTATE_PKG', sstatepkg) |
172 | bb.build.exec_func('sstate_unpack_package', d) | 172 | bb.build.exec_func('sstate_unpack_package', d) |
173 | 173 | ||
174 | # Fixup hardcoded paths | 174 | # Fixup hardcoded paths |
175 | fixmefn = sstateinst + "fixmepath" | 175 | fixmefn = sstateinst + "fixmepath" |
176 | if os.path.isfile(fixmefn): | 176 | if os.path.isfile(fixmefn): |
177 | staging = bb.data.getVar('STAGING_DIR', d, True) | 177 | staging = d.getVar('STAGING_DIR', True) |
178 | staging_target = bb.data.getVar('STAGING_DIR_TARGET', d, True) | 178 | staging_target = d.getVar('STAGING_DIR_TARGET', True) |
179 | staging_host = bb.data.getVar('STAGING_DIR_HOST', d, True) | 179 | staging_host = d.getVar('STAGING_DIR_HOST', True) |
180 | fixmefd = open(fixmefn, "r") | 180 | fixmefd = open(fixmefn, "r") |
181 | fixmefiles = fixmefd.readlines() | 181 | fixmefiles = fixmefd.readlines() |
182 | fixmefd.close() | 182 | fixmefd.close() |
@@ -206,13 +206,13 @@ def sstate_installpkg(ss, d): | |||
206 | def sstate_clean_cachefile(ss, d): | 206 | def sstate_clean_cachefile(ss, d): |
207 | import oe.path | 207 | import oe.path |
208 | 208 | ||
209 | sstatepkgdir = bb.data.getVar('SSTATE_DIR', d, True) | 209 | sstatepkgdir = d.getVar('SSTATE_DIR', True) |
210 | sstatepkgfile = sstatepkgdir + '/' + bb.data.getVar('SSTATE_PKGSPEC', d, True) + "*_" + ss['name'] + ".tgz*" | 210 | sstatepkgfile = sstatepkgdir + '/' + d.getVar('SSTATE_PKGSPEC', True) + "*_" + ss['name'] + ".tgz*" |
211 | bb.note("Removing %s" % sstatepkgfile) | 211 | bb.note("Removing %s" % sstatepkgfile) |
212 | oe.path.remove(sstatepkgfile) | 212 | oe.path.remove(sstatepkgfile) |
213 | 213 | ||
214 | def sstate_clean_cachefiles(d): | 214 | def sstate_clean_cachefiles(d): |
215 | for task in (bb.data.getVar('SSTATETASKS', d, True) or "").split(): | 215 | for task in (d.getVar('SSTATETASKS', True) or "").split(): |
216 | ss = sstate_state_fromvars(d, task[3:]) | 216 | ss = sstate_state_fromvars(d, task[3:]) |
217 | sstate_clean_cachefile(ss, d) | 217 | sstate_clean_cachefile(ss, d) |
218 | 218 | ||
@@ -274,10 +274,10 @@ CLEANFUNCS += "sstate_cleanall" | |||
274 | python sstate_cleanall() { | 274 | python sstate_cleanall() { |
275 | import fnmatch | 275 | import fnmatch |
276 | 276 | ||
277 | bb.note("Removing shared state for package %s" % bb.data.getVar('PN', d, True)) | 277 | bb.note("Removing shared state for package %s" % d.getVar('PN', True)) |
278 | 278 | ||
279 | manifest_dir = bb.data.getVar('SSTATE_MANIFESTS', d, True) | 279 | manifest_dir = d.getVar('SSTATE_MANIFESTS', True) |
280 | manifest_prefix = bb.data.getVar("SSTATE_MANFILEPREFIX", d, True) | 280 | manifest_prefix = d.getVar("SSTATE_MANFILEPREFIX", True) |
281 | manifest_pattern = os.path.basename(manifest_prefix) + ".*" | 281 | manifest_pattern = os.path.basename(manifest_prefix) + ".*" |
282 | 282 | ||
283 | if not os.path.exists(manifest_dir): | 283 | if not os.path.exists(manifest_dir): |
@@ -298,7 +298,7 @@ python sstate_cleanall() { | |||
298 | def sstate_hardcode_path(d): | 298 | def sstate_hardcode_path(d): |
299 | # Need to remove hardcoded paths and fix these when we install the | 299 | # Need to remove hardcoded paths and fix these when we install the |
300 | # staging packages. | 300 | # staging packages. |
301 | sstate_scan_cmd = bb.data.getVar('SSTATE_SCAN_CMD', d, True) | 301 | sstate_scan_cmd = d.getVar('SSTATE_SCAN_CMD', True) |
302 | p = os.popen("%s" % sstate_scan_cmd) | 302 | p = os.popen("%s" % sstate_scan_cmd) |
303 | file_list = p.read() | 303 | file_list = p.read() |
304 | 304 | ||
@@ -306,10 +306,10 @@ def sstate_hardcode_path(d): | |||
306 | p.close() | 306 | p.close() |
307 | return | 307 | return |
308 | 308 | ||
309 | staging = bb.data.getVar('STAGING_DIR', d, True) | 309 | staging = d.getVar('STAGING_DIR', True) |
310 | staging_target = bb.data.getVar('STAGING_DIR_TARGET', d, True) | 310 | staging_target = d.getVar('STAGING_DIR_TARGET', True) |
311 | staging_host = bb.data.getVar('STAGING_DIR_HOST', d, True) | 311 | staging_host = d.getVar('STAGING_DIR_HOST', True) |
312 | sstate_builddir = bb.data.getVar('SSTATE_BUILDDIR', d, True) | 312 | sstate_builddir = d.getVar('SSTATE_BUILDDIR', True) |
313 | 313 | ||
314 | for i in file_list.split('\n'): | 314 | for i in file_list.split('\n'): |
315 | if not i: | 315 | if not i: |
@@ -349,10 +349,10 @@ def sstate_package(ss, d): | |||
349 | os.remove(path) | 349 | os.remove(path) |
350 | os.symlink(base, path) | 350 | os.symlink(base, path) |
351 | 351 | ||
352 | tmpdir = bb.data.getVar('TMPDIR', d, True) | 352 | tmpdir = d.getVar('TMPDIR', True) |
353 | 353 | ||
354 | sstatebuild = bb.data.expand("${WORKDIR}/sstate-build-%s/" % ss['name'], d) | 354 | sstatebuild = bb.data.expand("${WORKDIR}/sstate-build-%s/" % ss['name'], d) |
355 | sstatepkg = bb.data.getVar('SSTATE_PKG', d, True) + '_'+ ss['name'] + ".tgz" | 355 | sstatepkg = d.getVar('SSTATE_PKG', True) + '_'+ ss['name'] + ".tgz" |
356 | bb.mkdirhier(sstatebuild) | 356 | bb.mkdirhier(sstatebuild) |
357 | bb.mkdirhier(os.path.dirname(sstatepkg)) | 357 | bb.mkdirhier(os.path.dirname(sstatepkg)) |
358 | for state in ss['dirs']: | 358 | for state in ss['dirs']: |
@@ -369,15 +369,15 @@ def sstate_package(ss, d): | |||
369 | bb.debug(2, "Preparing tree %s for packaging at %s" % (state[1], sstatebuild + state[0])) | 369 | bb.debug(2, "Preparing tree %s for packaging at %s" % (state[1], sstatebuild + state[0])) |
370 | oe.path.copytree(state[1], sstatebuild + state[0]) | 370 | oe.path.copytree(state[1], sstatebuild + state[0]) |
371 | 371 | ||
372 | workdir = bb.data.getVar('WORKDIR', d, True) | 372 | workdir = d.getVar('WORKDIR', True) |
373 | for plain in ss['plaindirs']: | 373 | for plain in ss['plaindirs']: |
374 | pdir = plain.replace(workdir, sstatebuild) | 374 | pdir = plain.replace(workdir, sstatebuild) |
375 | bb.mkdirhier(plain) | 375 | bb.mkdirhier(plain) |
376 | bb.mkdirhier(pdir) | 376 | bb.mkdirhier(pdir) |
377 | oe.path.copytree(plain, pdir) | 377 | oe.path.copytree(plain, pdir) |
378 | 378 | ||
379 | bb.data.setVar('SSTATE_BUILDDIR', sstatebuild, d) | 379 | d.setVar('SSTATE_BUILDDIR', sstatebuild) |
380 | bb.data.setVar('SSTATE_PKG', sstatepkg, d) | 380 | d.setVar('SSTATE_PKG', sstatepkg) |
381 | sstate_hardcode_path(d) | 381 | sstate_hardcode_path(d) |
382 | bb.build.exec_func('sstate_create_package', d) | 382 | bb.build.exec_func('sstate_create_package', d) |
383 | 383 | ||
@@ -389,7 +389,7 @@ def pstaging_fetch(sstatepkg, d): | |||
389 | import bb.fetch2 | 389 | import bb.fetch2 |
390 | 390 | ||
391 | # Only try and fetch if the user has configured a mirror | 391 | # Only try and fetch if the user has configured a mirror |
392 | mirrors = bb.data.getVar('SSTATE_MIRRORS', d, True) | 392 | mirrors = d.getVar('SSTATE_MIRRORS', True) |
393 | if not mirrors: | 393 | if not mirrors: |
394 | return | 394 | return |
395 | 395 | ||
@@ -402,9 +402,9 @@ def pstaging_fetch(sstatepkg, d): | |||
402 | 402 | ||
403 | bb.mkdirhier(dldir) | 403 | bb.mkdirhier(dldir) |
404 | 404 | ||
405 | bb.data.setVar('DL_DIR', dldir, localdata) | 405 | localdata.setVar('DL_DIR', dldir) |
406 | bb.data.setVar('PREMIRRORS', mirrors, localdata) | 406 | localdata.setVar('PREMIRRORS', mirrors) |
407 | bb.data.setVar('SRC_URI', srcuri, localdata) | 407 | localdata.setVar('SRC_URI', srcuri) |
408 | 408 | ||
409 | # Try a fetch from the sstate mirror, if it fails just return and | 409 | # Try a fetch from the sstate mirror, if it fails just return and |
410 | # we will build the package | 410 | # we will build the package |
@@ -493,15 +493,15 @@ def sstate_checkhashes(sq_fn, sq_task, sq_hash, sq_hashfn, d): | |||
493 | else: | 493 | else: |
494 | bb.debug(2, "SState: Looked for but didn't find file %s" % sstatefile) | 494 | bb.debug(2, "SState: Looked for but didn't find file %s" % sstatefile) |
495 | 495 | ||
496 | mirrors = bb.data.getVar("SSTATE_MIRRORS", d, True) | 496 | mirrors = d.getVar("SSTATE_MIRRORS", True) |
497 | if mirrors: | 497 | if mirrors: |
498 | # Copy the data object and override DL_DIR and SRC_URI | 498 | # Copy the data object and override DL_DIR and SRC_URI |
499 | localdata = bb.data.createCopy(d) | 499 | localdata = bb.data.createCopy(d) |
500 | bb.data.update_data(localdata) | 500 | bb.data.update_data(localdata) |
501 | 501 | ||
502 | dldir = bb.data.expand("${SSTATE_DIR}", localdata) | 502 | dldir = bb.data.expand("${SSTATE_DIR}", localdata) |
503 | bb.data.setVar('DL_DIR', dldir, localdata) | 503 | localdata.setVar('DL_DIR', dldir) |
504 | bb.data.setVar('PREMIRRORS', mirrors, localdata) | 504 | localdata.setVar('PREMIRRORS', mirrors) |
505 | 505 | ||
506 | bb.debug(2, "SState using premirror of: %s" % mirrors) | 506 | bb.debug(2, "SState using premirror of: %s" % mirrors) |
507 | 507 | ||
@@ -513,7 +513,7 @@ def sstate_checkhashes(sq_fn, sq_task, sq_hash, sq_hashfn, d): | |||
513 | sstatefile = sstatefile.replace("${BB_TASKHASH}", sq_hash[task]) | 513 | sstatefile = sstatefile.replace("${BB_TASKHASH}", sq_hash[task]) |
514 | 514 | ||
515 | srcuri = "file://" + os.path.basename(sstatefile) | 515 | srcuri = "file://" + os.path.basename(sstatefile) |
516 | bb.data.setVar('SRC_URI', srcuri, localdata) | 516 | localdata.setVar('SRC_URI', srcuri) |
517 | bb.debug(2, "SState: Attempting to fetch %s" % srcuri) | 517 | bb.debug(2, "SState: Attempting to fetch %s" % srcuri) |
518 | 518 | ||
519 | try: | 519 | try: |