3 PACKAGE_EXTRA_DEPENDS += "tar-native"
5 PACKAGE_WRITE_FUNCS += "do_package_tar"
8 python package_tar_fn () {
11 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)))
12 fn = bb.data.expand(fn, d)
13 bb.data.setVar('PKGFN', fn, d)
16 python package_tar_install () {
18 pkg = bb.data.getVar('PKG', d, 1)
19 pkgfn = bb.data.getVar('PKGFN', d, 1)
20 rootfs = bb.data.getVar('IMAGE_ROOTFS', d, 1)
22 if None in (pkg,pkgfn,rootfs):
23 bb.error("missing variables (one or more of PKG, PKGFN, IMAGEROOTFS)")
24 raise bb.build.FuncFailed
29 (type, value, traceback) = sys.exc_info()
31 raise bb.build.FuncFailed
33 if not os.access(pkgfn, os.R_OK):
34 bb.debug(1, "%s does not exist, skipping" % pkgfn)
35 raise bb.build.FuncFailed
37 ret = os.system('zcat %s | tar -xf -' % pkgfn)
39 raise bb.build.FuncFailed
42 python do_package_tar () {
43 workdir = bb.data.getVar('WORKDIR', d, 1)
45 bb.error("WORKDIR not defined, unable to package")
48 import os # path manipulations
49 outdir = bb.data.getVar('DEPLOY_DIR_TAR', d, 1)
51 bb.error("DEPLOY_DIR_TAR not defined, unable to package")
55 dvar = bb.data.getVar('D', d, 1)
57 bb.error("D not defined, unable to package")
61 packages = bb.data.getVar('PACKAGES', d, 1)
63 bb.debug(1, "PACKAGES not defined, nothing to package")
66 for pkg in packages.split():
67 localdata = bb.data.createCopy(d)
68 root = "%s/install/%s" % (workdir, pkg)
70 bb.data.setVar('ROOT', '', localdata)
71 bb.data.setVar('ROOT_%s' % pkg, root, localdata)
72 bb.data.setVar('PKG', pkg, localdata)
74 overrides = bb.data.getVar('OVERRIDES', localdata)
76 raise bb.build.FuncFailed('OVERRIDES not defined')
77 overrides = bb.data.expand(overrides, localdata)
78 bb.data.setVar('OVERRIDES', '%s:%s' % (overrides, pkg), localdata)
80 bb.data.update_data(localdata)
82 root = bb.data.getVar('ROOT', localdata)
84 basedir = os.path.dirname(root)
86 bb.mkdirhier(pkgoutdir)
87 bb.build.exec_func('package_tar_fn', localdata)
88 tarfn = bb.data.getVar('PKGFN', localdata, 1)
89 # if os.path.exists(tarfn):
95 bb.note("Not creating empty archive for %s-%s-%s" % (pkg, bb.data.getVar('PV', localdata, 1), bb.data.getVar('PR', localdata, 1)))
97 ret = os.system("tar -czvf %s %s" % (tarfn, '.'))
99 bb.error("Creation of tar %s failed." % tarfn)
101 file(bb.data.expand('${STAGING_DIR}/pkgdata/runtime/%s.packaged' % pkg, d), 'w').close()