diff options
author | Tim Ansell <mithro@mithis.com> | 2004-11-25 11:30:58 +0000 |
---|---|---|
committer | Tim Ansell <mithro@mithis.com> | 2004-11-25 11:30:58 +0000 |
commit | 9918acbe5451abe65b61363ce851b8b16e653062 (patch) | |
tree | 8784aa5795d0b756fb4a5930bcb173ba35e1f195 /classes/package_tar.oeclass | |
parent | 2220f0ca2b02a634cad48d563996fbde726f5e69 (diff) |
Merge bk://oe-devel@oe-devel.bkbits.net/packages
into mithis.com:/cc/packages
2004/11/25 21:26:24+10:30 mithis.com!mithro
irda now works out of the box on C700 and C860.
2004/11/25 16:00:21+10:30 mithis.com!mithro
Merge bk://oe-devel@oe-devel.bkbits.net/packages
into mithis.com:/cc/packages
2004/11/22 06:03:48+10:30 com[tim]!mithro
packages.cow7.diffs
BKrev: 41a5c272IuQI7xqgYGRkklwBvdUGNw
Diffstat (limited to 'classes/package_tar.oeclass')
-rw-r--r-- | classes/package_tar.oeclass | 100 |
1 files changed, 100 insertions, 0 deletions
diff --git a/classes/package_tar.oeclass b/classes/package_tar.oeclass index e69de29bb2..e8faedf7be 100644 --- a/classes/package_tar.oeclass +++ b/classes/package_tar.oeclass @@ -0,0 +1,100 @@ +inherit package + +python package_tar_fn () { + import os + from oe import data + 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))) + fn = oe.data.expand(fn, d) + oe.data.setVar('PKGFN', fn, d) +} + +python package_tar_install () { + import os, sys + pkg = oe.data.getVar('PKG', d, 1) + pkgfn = oe.data.getVar('PKGFN', d, 1) + rootfs = oe.data.getVar('IMAGE_ROOTFS', d, 1) + + if None in (pkg,pkgfn,rootfs): + oe.error("missing variables (one or more of PKG, PKGFN, IMAGEROOTFS)") + raise oe.build.FuncFailed + try: + oe.mkdirhier(rootfs) + os.chdir(rootfs) + except OSError: + (type, value, traceback) = sys.exc_info() + print value + raise oe.build.FuncFailed + + if not os.access(pkgfn, os.R_OK): + oe.debug(1, "%s does not exist, skipping" % pkgfn) + raise oe.build.FuncFailed + + ret = os.system('zcat %s | tar -xf -' % pkgfn) + if ret != 0: + raise oe.build.FuncFailed +} + +python do_package_tar () { + workdir = oe.data.getVar('WORKDIR', d, 1) + if not workdir: + oe.error("WORKDIR not defined, unable to package") + return + + import os # path manipulations + outdir = oe.data.getVar('DEPLOY_DIR_TAR', d, 1) + if not outdir: + oe.error("DEPLOY_DIR_TAR not defined, unable to package") + return + oe.mkdirhier(outdir) + + dvar = oe.data.getVar('D', d, 1) + if not dvar: + oe.error("D not defined, unable to package") + return + oe.mkdirhier(dvar) + + packages = oe.data.getVar('PACKAGES', d, 1) + if not packages: + oe.debug(1, "PACKAGES not defined, nothing to package") + return + + for pkg in packages.split(): + localdata = {} + oe.data.linkDataSet(localdata,d) + root = "%s/install/%s" % (workdir, pkg) + + oe.data.setVar('ROOT', '', localdata) + oe.data.setVar('ROOT_%s' % pkg, root, localdata) + oe.data.setVar('PKG', pkg, localdata) + + overrides = oe.data.getVar('OVERRIDES', localdata) + if not overrides: + raise oe.build.FuncFailed('OVERRIDES not defined') + overrides = oe.data.expand(overrides, localdata) + oe.data.setVar('OVERRIDES', '%s:%s' % (overrides, pkg), localdata) + + oe.data.update_data(localdata) +# stuff + root = oe.data.getVar('ROOT', localdata) + oe.mkdirhier(root) + basedir = os.path.dirname(root) + pkgoutdir = outdir + oe.mkdirhier(pkgoutdir) + oe.build.exec_func('package_tar_fn', localdata) + tarfn = oe.data.getVar('PKGFN', localdata, 1) +# if os.path.exists(tarfn): +# del localdata +# continue + os.chdir(root) + from glob import glob + if not glob('*'): + oe.note("Not creating empty archive for %s-%s-%s" % (pkg, oe.data.getVar('PV', localdata, 1), oe.data.getVar('PR', localdata, 1))) + continue + ret = os.system("tar -czvf %s %s" % (tarfn, '.')) + if ret != 0: + oe.error("Creation of tar %s failed." % tarfn) +# end stuff + del localdata +} + +addtask package_tar after do_package before do_build |