3 PACKAGE_WRITE_FUNCS += "do_package_tar"
6 python package_tar_fn () {
9 fn = os.path.join(bb.data.getVar('DEPLOY_DIR_TAR', d), "%s-%s-%s.tar.gz" % (bb.data.getVar('PKG', d), bb.data.getVar('PV', d), bb.data.getVar('PR', d)))
10 fn = bb.data.expand(fn, d)
11 bb.data.setVar('PKGFN', fn, d)
14 python package_tar_install () {
16 pkg = bb.data.getVar('PKG', d, 1)
17 pkgfn = bb.data.getVar('PKGFN', d, 1)
18 rootfs = bb.data.getVar('IMAGE_ROOTFS', d, 1)
20 if None in (pkg,pkgfn,rootfs):
21 bb.error("missing variables (one or more of PKG, PKGFN, IMAGEROOTFS)")
22 raise bb.build.FuncFailed
27 (type, value, traceback) = sys.exc_info()
29 raise bb.build.FuncFailed
31 if not os.access(pkgfn, os.R_OK):
32 bb.debug(1, "%s does not exist, skipping" % pkgfn)
33 raise bb.build.FuncFailed
35 ret = os.system('zcat %s | tar -xf -' % pkgfn)
37 raise bb.build.FuncFailed
40 python do_package_tar () {
41 workdir = bb.data.getVar('WORKDIR', d, 1)
43 bb.error("WORKDIR not defined, unable to package")
46 import os # path manipulations
47 outdir = bb.data.getVar('DEPLOY_DIR_TAR', d, 1)
49 bb.error("DEPLOY_DIR_TAR not defined, unable to package")
53 dvar = bb.data.getVar('D', d, 1)
55 bb.error("D not defined, unable to package")
59 packages = bb.data.getVar('PACKAGES', d, 1)
61 bb.debug(1, "PACKAGES not defined, nothing to package")
64 for pkg in packages.split():
65 localdata = bb.data.createCopy(d)
66 root = "%s/install/%s" % (workdir, pkg)
68 bb.data.setVar('ROOT', '', localdata)
69 bb.data.setVar('ROOT_%s' % pkg, root, localdata)
70 bb.data.setVar('PKG', pkg, localdata)
72 overrides = bb.data.getVar('OVERRIDES', localdata)
74 raise bb.build.FuncFailed('OVERRIDES not defined')
75 overrides = bb.data.expand(overrides, localdata)
76 bb.data.setVar('OVERRIDES', '%s:%s' % (overrides, pkg), localdata)
78 bb.data.update_data(localdata)
80 root = bb.data.getVar('ROOT', localdata)
82 basedir = os.path.dirname(root)
84 bb.mkdirhier(pkgoutdir)
85 bb.build.exec_func('package_tar_fn', localdata)
86 tarfn = bb.data.getVar('PKGFN', localdata, 1)
87 # if os.path.exists(tarfn):
93 bb.note("Not creating empty archive for %s-%s-%s" % (pkg, bb.data.getVar('PV', localdata, 1), bb.data.getVar('PR', localdata, 1)))
95 ret = os.system("tar -czvf %s %s" % (tarfn, '.'))
97 bb.error("Creation of tar %s failed." % tarfn)
99 file(bb.data.expand('${STAGING_DIR}/pkgdata/runtime/%s.packaged' % pkg, d), 'w').close()