3 python package_tar_fn () {
6 fn = os.path.join(oe.data.getVar('DEPLOY_DIR_TAR', d), "%s-%s-%s.tar.gz" % (oe.data.getVar('PKG', d), oe.data.getVar('PV', d), oe.data.getVar('PR', d)))
7 fn = oe.data.expand(fn, d)
8 oe.data.setVar('PKGFN', fn, d)
11 python package_tar_install () {
13 pkg = oe.data.getVar('PKG', d, 1)
14 pkgfn = oe.data.getVar('PKGFN', d, 1)
15 rootfs = oe.data.getVar('IMAGE_ROOTFS', d, 1)
17 if None in (pkg,pkgfn,rootfs):
18 oe.error("missing variables (one or more of PKG, PKGFN, IMAGEROOTFS)")
19 raise oe.build.FuncFailed
24 (type, value, traceback) = sys.exc_info()
26 raise oe.build.FuncFailed
28 if not os.access(pkgfn, os.R_OK):
29 oe.debug(1, "%s does not exist, skipping" % pkgfn)
30 raise oe.build.FuncFailed
32 ret = os.system('zcat %s | tar -xf -' % pkgfn)
34 raise oe.build.FuncFailed
37 python do_package_tar () {
38 workdir = oe.data.getVar('WORKDIR', d, 1)
40 oe.error("WORKDIR not defined, unable to package")
43 import os # path manipulations
44 outdir = oe.data.getVar('DEPLOY_DIR_TAR', d, 1)
46 oe.error("DEPLOY_DIR_TAR not defined, unable to package")
50 dvar = oe.data.getVar('D', d, 1)
52 oe.error("D not defined, unable to package")
56 packages = oe.data.getVar('PACKAGES', d, 1)
58 oe.debug(1, "PACKAGES not defined, nothing to package")
61 for pkg in packages.split():
62 from copy import copy, deepcopy
63 localdata = deepcopy(d)
64 root = "%s/install/%s" % (workdir, pkg)
66 oe.data.setVar('ROOT', '', localdata)
67 oe.data.setVar('ROOT_%s' % pkg, root, localdata)
68 oe.data.setVar('PKG', pkg, localdata)
70 overrides = oe.data.getVar('OVERRIDES', localdata)
72 raise oe.build.FuncFailed('OVERRIDES not defined')
73 overrides = oe.data.expand(overrides, localdata)
74 oe.data.setVar('OVERRIDES', '%s:%s' % (overrides, pkg), localdata)
76 oe.data.update_data(localdata)
78 root = oe.data.getVar('ROOT', localdata)
80 basedir = os.path.dirname(root)
82 oe.mkdirhier(pkgoutdir)
83 oe.build.exec_func('package_tar_fn', localdata)
84 tarfn = oe.data.getVar('PKGFN', localdata, 1)
85 # if os.path.exists(tarfn):
91 oe.note("Not creating empty archive for %s-%s-%s" % (pkg, oe.data.getVar('PV', localdata, 1), oe.data.getVar('PR', localdata, 1)))
93 ret = os.system("tar -czvf %s %s" % (tarfn, '.'))
95 oe.error("Creation of tar %s failed." % tarfn)
100 addtask package_tar after do_package before do_build