3 python package_tar_fn () {
4 fn = os.path.join(bb.data.getVar('DEPLOY_DIR_TAR', d, True), bb.data.expand('${PKG}-${PV}-${PR}${DISTRO_PR}.tar.gz', d, True))
5 bb.data.setVar('PKGFN', fn, d)
8 python package_tar_install () {
9 pkg = bb.data.getVar('PKG', d, 1)
10 pkgfn = bb.data.getVar('PKGFN', d, 1)
11 rootfs = bb.data.getVar('IMAGE_ROOTFS', d, 1)
13 if None in (pkg,pkgfn,rootfs):
14 bb.error("missing variables (one or more of PKG, PKGFN, IMAGEROOTFS)")
15 raise bb.build.FuncFailed
21 (type, value, traceback) = sys.exc_info()
23 raise bb.build.FuncFailed
25 if not os.access(pkgfn, os.R_OK):
26 bb.debug(1, "%s does not exist, skipping" % pkgfn)
27 raise bb.build.FuncFailed
29 ret = os.system('zcat %s | tar -xf -' % pkgfn)
31 raise bb.build.FuncFailed
34 python do_package_tar () {
35 workdir = bb.data.getVar('WORKDIR', d, 1)
37 bb.error("WORKDIR not defined, unable to package")
40 outdir = bb.data.getVar('DEPLOY_DIR_TAR', d, 1)
42 bb.error("DEPLOY_DIR_TAR not defined, unable to package")
46 dvar = bb.data.getVar('D', d, 1)
48 bb.error("D not defined, unable to package")
52 packages = bb.data.getVar('PACKAGES', d, 1)
54 bb.debug(1, "PACKAGES not defined, nothing to package")
57 for pkg in packages.split():
58 localdata = bb.data.createCopy(d)
59 pkgdest = bb.data.getVar('PKGDEST', d, 1)
60 root = "%s/%s" % (pkgdest, pkg)
62 bb.data.setVar('ROOT', '', localdata)
63 bb.data.setVar('ROOT_%s' % pkg, root, localdata)
64 bb.data.setVar('PKG', pkg, localdata)
66 overrides = bb.data.getVar('OVERRIDES', localdata)
68 raise bb.build.FuncFailed('OVERRIDES not defined')
69 overrides = bb.data.expand(overrides, localdata)
70 bb.data.setVar('OVERRIDES', '%s:%s' % (overrides, pkg), localdata)
72 bb.data.update_data(localdata)
74 root = bb.data.getVar('ROOT', localdata)
76 basedir = os.path.dirname(root)
78 bb.mkdirhier(pkgoutdir)
79 bb.build.exec_func('package_tar_fn', localdata)
80 tarfn = bb.data.getVar('PKGFN', localdata, 1)
83 if not glob('*') + glob('.[!.]*'):
84 bb.note("Not creating empty archive for %s-%s" % (pkg, bb.data.expand('${PV}-${PR}${DISTRO_PR}', d, True)))
86 ret = os.system("tar -czf %s %s" % (tarfn, '.'))
88 bb.error("Creation of tar %s failed." % tarfn)
92 if bb.data.getVar('PACKAGES', d, True) != '':
93 deps = (bb.data.getVarFlag('do_package_write_tar', 'depends', d) or "").split()
94 deps.append('tar-native:do_populate_staging')
95 deps.append('fakeroot-native:do_populate_staging')
96 bb.data.setVarFlag('do_package_write_tar', 'depends', " ".join(deps), d)
100 python do_package_write_tar () {
101 bb.build.exec_func("read_subpackage_metadata", d)
102 bb.build.exec_func("do_package_tar", d)
104 do_package_write_tar[dirs] = "${D}"
105 addtask package_write_tar before do_build after do_package