summaryrefslogtreecommitdiffstats
path: root/meta/classes/package_tar.bbclass
diff options
context:
space:
mode:
authorRichard Purdie <richard.purdie@linuxfoundation.org>2011-11-09 15:00:01 +0000
committerRichard Purdie <richard.purdie@linuxfoundation.org>2011-11-10 11:51:19 +0000
commitc8dee9b92dfd545852ecac8dc2adfc95ac02e957 (patch)
tree5f1b86954646a0f3bb914407994388a6a4346769 /meta/classes/package_tar.bbclass
parent5d3860f4a8abb8e95442b04f8b84a333af362fcd (diff)
downloadpoky-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/package_tar.bbclass')
-rw-r--r--meta/classes/package_tar.bbclass38
1 files changed, 19 insertions, 19 deletions
diff --git a/meta/classes/package_tar.bbclass b/meta/classes/package_tar.bbclass
index a806e4514b..f26a2c0008 100644
--- a/meta/classes/package_tar.bbclass
+++ b/meta/classes/package_tar.bbclass
@@ -3,15 +3,15 @@ inherit package
3IMAGE_PKGTYPE ?= "tar" 3IMAGE_PKGTYPE ?= "tar"
4 4
5python package_tar_fn () { 5python package_tar_fn () {
6 fn = os.path.join(bb.data.getVar('DEPLOY_DIR_TAR', d), "%s-%s-%s.tar.gz" % (bb.data.getVar('PKG', d), bb.data.getVar('PKGV', d), bb.data.getVar('PKGR', d))) 6 fn = os.path.join(d.getVar('DEPLOY_DIR_TAR'), "%s-%s-%s.tar.gz" % (d.getVar('PKG'), d.getVar('PKGV'), d.getVar('PKGR')))
7 fn = bb.data.expand(fn, d) 7 fn = bb.data.expand(fn, d)
8 bb.data.setVar('PKGFN', fn, d) 8 d.setVar('PKGFN', fn)
9} 9}
10 10
11python package_tar_install () { 11python package_tar_install () {
12 pkg = bb.data.getVar('PKG', d, 1) 12 pkg = d.getVar('PKG', 1)
13 pkgfn = bb.data.getVar('PKGFN', d, 1) 13 pkgfn = d.getVar('PKGFN', 1)
14 rootfs = bb.data.getVar('IMAGE_ROOTFS', d, 1) 14 rootfs = d.getVar('IMAGE_ROOTFS', 1)
15 15
16 if None in (pkg,pkgfn,rootfs): 16 if None in (pkg,pkgfn,rootfs):
17 bb.error("missing variables (one or more of PKG, PKGFN, IMAGEROOTFS)") 17 bb.error("missing variables (one or more of PKG, PKGFN, IMAGEROOTFS)")
@@ -35,24 +35,24 @@ python package_tar_install () {
35} 35}
36 36
37python do_package_tar () { 37python do_package_tar () {
38 workdir = bb.data.getVar('WORKDIR', d, 1) 38 workdir = d.getVar('WORKDIR', 1)
39 if not workdir: 39 if not workdir:
40 bb.error("WORKDIR not defined, unable to package") 40 bb.error("WORKDIR not defined, unable to package")
41 return 41 return
42 42
43 outdir = bb.data.getVar('DEPLOY_DIR_TAR', d, 1) 43 outdir = d.getVar('DEPLOY_DIR_TAR', 1)
44 if not outdir: 44 if not outdir:
45 bb.error("DEPLOY_DIR_TAR not defined, unable to package") 45 bb.error("DEPLOY_DIR_TAR not defined, unable to package")
46 return 46 return
47 bb.mkdirhier(outdir) 47 bb.mkdirhier(outdir)
48 48
49 dvar = bb.data.getVar('D', d, 1) 49 dvar = d.getVar('D', 1)
50 if not dvar: 50 if not dvar:
51 bb.error("D not defined, unable to package") 51 bb.error("D not defined, unable to package")
52 return 52 return
53 bb.mkdirhier(dvar) 53 bb.mkdirhier(dvar)
54 54
55 packages = bb.data.getVar('PACKAGES', d, 1) 55 packages = d.getVar('PACKAGES', 1)
56 if not packages: 56 if not packages:
57 bb.debug(1, "PACKAGES not defined, nothing to package") 57 bb.debug(1, "PACKAGES not defined, nothing to package")
58 return 58 return
@@ -61,11 +61,11 @@ python do_package_tar () {
61 localdata = bb.data.createCopy(d) 61 localdata = bb.data.createCopy(d)
62 root = "%s/install/%s" % (workdir, pkg) 62 root = "%s/install/%s" % (workdir, pkg)
63 63
64 bb.data.setVar('ROOT', '', localdata) 64 localdata.setVar('ROOT', '')
65 bb.data.setVar('ROOT_%s' % pkg, root, localdata) 65 localdata.setVar('ROOT_%s' % pkg, root)
66 bb.data.setVar('PKG', pkg, localdata) 66 localdata.setVar('PKG', pkg)
67 67
68 overrides = bb.data.getVar('OVERRIDES', localdata) 68 overrides = localdata.getVar('OVERRIDES')
69 if not overrides: 69 if not overrides:
70 raise bb.build.FuncFailed('OVERRIDES not defined') 70 raise bb.build.FuncFailed('OVERRIDES not defined')
71 overrides = bb.data.expand(overrides, localdata) 71 overrides = bb.data.expand(overrides, localdata)
@@ -73,17 +73,17 @@ python do_package_tar () {
73 73
74 bb.data.update_data(localdata) 74 bb.data.update_data(localdata)
75 75
76 root = bb.data.getVar('ROOT', localdata) 76 root = localdata.getVar('ROOT')
77 bb.mkdirhier(root) 77 bb.mkdirhier(root)
78 basedir = os.path.dirname(root) 78 basedir = os.path.dirname(root)
79 pkgoutdir = outdir 79 pkgoutdir = outdir
80 bb.mkdirhier(pkgoutdir) 80 bb.mkdirhier(pkgoutdir)
81 bb.build.exec_func('package_tar_fn', localdata) 81 bb.build.exec_func('package_tar_fn', localdata)
82 tarfn = bb.data.getVar('PKGFN', localdata, 1) 82 tarfn = localdata.getVar('PKGFN', 1)
83 os.chdir(root) 83 os.chdir(root)
84 from glob import glob 84 from glob import glob
85 if not glob('*'): 85 if not glob('*'):
86 bb.note("Not creating empty archive for %s-%s-%s" % (pkg, bb.data.getVar('PKGV', localdata, 1), bb.data.getVar('PKGR', localdata, 1))) 86 bb.note("Not creating empty archive for %s-%s-%s" % (pkg, localdata.getVar('PKGV', 1), localdata.getVar('PKGR', 1)))
87 continue 87 continue
88 ret = os.system("tar -czf %s %s" % (tarfn, '.')) 88 ret = os.system("tar -czf %s %s" % (tarfn, '.'))
89 if ret != 0: 89 if ret != 0:
@@ -91,12 +91,12 @@ python do_package_tar () {
91} 91}
92 92
93python () { 93python () {
94 if bb.data.getVar('PACKAGES', d, True) != '': 94 if d.getVar('PACKAGES', True) != '':
95 deps = (bb.data.getVarFlag('do_package_write_tar', 'depends', d) or "").split() 95 deps = (d.getVarFlag('do_package_write_tar', 'depends') or "").split()
96 deps.append('tar-native:do_populate_sysroot') 96 deps.append('tar-native:do_populate_sysroot')
97 deps.append('virtual/fakeroot-native:do_populate_sysroot') 97 deps.append('virtual/fakeroot-native:do_populate_sysroot')
98 bb.data.setVarFlag('do_package_write_tar', 'depends', " ".join(deps), d) 98 bb.data.setVarFlag('do_package_write_tar', 'depends', " ".join(deps), d)
99 bb.data.setVarFlag('do_package_write_ipk', 'fakeroot', "1", d) 99 d.setVarFlag('do_package_write_ipk', 'fakeroot', "1")
100} 100}
101 101
102 102