diff options
-rw-r--r-- | classes/base.oeclass | 14 | ||||
-rw-r--r-- | classes/package.oeclass | 5 | ||||
-rw-r--r-- | classes/package_ipk.oeclass | 5 | ||||
-rw-r--r-- | classes/package_rpm.oeclass | 135 | ||||
-rw-r--r-- | classes/package_tar.oeclass | 100 | ||||
-rw-r--r-- | irda-utils/files/init | 0 | ||||
-rw-r--r-- | irda-utils/irda-utils_0.9.16.oe | 23 | ||||
-rw-r--r-- | misc-binary-only/tda1004x-firmware.oe | 5 |
8 files changed, 273 insertions, 14 deletions
diff --git a/classes/base.oeclass b/classes/base.oeclass index 35c7fbecd1..4e3e17137b 100644 --- a/classes/base.oeclass +++ b/classes/base.oeclass @@ -247,7 +247,7 @@ python do_showdata() { # emit variables and shell functions oe.data.emit_env(sys.__stdout__, d, True) # emit the metadata which isnt valid shell - for e in d.keys(): + for e in oe.data.keys(d): if oe.data.getVarFlag(e, 'python', d): sys.__stdout__.write("\npython %s () {\n%s}\n" % (e, oe.data.getVar(e, d, 1))) elif oe.data.getVarFlag(e, 'func', d): @@ -263,7 +263,7 @@ python do_listtasks() { # emit variables and shell functions #oe.data.emit_env(sys.__stdout__, d) # emit the metadata which isnt valid shell - for e in d.keys(): + for e in oe.data.keys(d): if oe.data.getVarFlag(e, 'task', d): sys.__stdout__.write("%s\n" % e) } @@ -299,9 +299,10 @@ addtask fetch do_fetch[dirs] = "${DL_DIR}" do_fetch[nostamp] = "1" python base_do_fetch() { - import sys, copy + import sys - localdata = copy.deepcopy(d) + localdata = {} + oe.data.linkDataSet(localdata,d) oe.data.update_data(localdata) src_uri = oe.data.getVar('SRC_URI', localdata, 1) @@ -373,9 +374,10 @@ def oe_unpack_file(file, data, url = None): addtask unpack after do_fetch do_unpack[dirs] = "${WORKDIR}" python base_do_unpack() { - import re, copy, os + import re, os - localdata = copy.deepcopy(d) + localdata = {} + oe.data.linkDataSet(localdata,d) oe.data.update_data(localdata) src_uri = oe.data.getVar('SRC_URI', localdata) diff --git a/classes/package.oeclass b/classes/package.oeclass index 443c057147..e26f5e90cc 100644 --- a/classes/package.oeclass +++ b/classes/package.oeclass @@ -98,7 +98,7 @@ def package_frob_arch(d): return python populate_packages () { - import glob, copy, stat, errno, re + import glob, stat, errno, re workdir = oe.data.getVar('WORKDIR', d, 1) if not workdir: @@ -140,7 +140,8 @@ python populate_packages () { return (s[stat.ST_MODE] & stat.S_IEXEC) for pkg in packages.split(): - localdata = copy.deepcopy(d) + localdata = {} + oe.data.linkDataSet(localdata,d) root = os.path.join(workdir, "install", pkg) os.system('rm -rf %s' % root) diff --git a/classes/package_ipk.oeclass b/classes/package_ipk.oeclass index 5ec1f82cdc..f680b1bca3 100644 --- a/classes/package_ipk.oeclass +++ b/classes/package_ipk.oeclass @@ -60,7 +60,6 @@ python package_ipk_install () { } python package_ipk_do_package_ipk () { - import copy # to back up env data import sys workdir = oe.data.getVar('WORKDIR', d, 1) @@ -96,8 +95,8 @@ python package_ipk_do_package_ipk () { return for pkg in packages.split(): - from copy import deepcopy - localdata = deepcopy(d) + localdata = {} + oe.data.linkDataSet(localdata,d) root = "%s/install/%s" % (workdir, pkg) oe.data.setVar('ROOT', '', localdata) diff --git a/classes/package_rpm.oeclass b/classes/package_rpm.oeclass index e69de29bb2..36398f789e 100644 --- a/classes/package_rpm.oeclass +++ b/classes/package_rpm.oeclass @@ -0,0 +1,135 @@ +inherit package +inherit rpm_core + +RPMBUILD="rpmbuild --short-circuit ${RPMOPTS}" + +python write_specfile() { + from oe import data, build + import sys + out_vartranslate = { + "PKG": "Name", + "PV": "Version", + "PR": "Release", + "DESCRIPTION": "%description", + "ROOT": "BuildRoot", + "LICENSE": "License", + "SECTION": "Group", + } + + root = oe.data.getVar('ROOT', d) + + # get %files + filesvar = oe.data.expand(oe.data.getVar('FILES', d), d) or "" + from glob import glob + files = filesvar.split() + todelete = [] + for file in files: + if file[0] == '.': + newfile = file[1:] + files[files.index(file)] = newfile + file = newfile + else: + newfile = file + realfile = os.path.join(root, './'+file) + if not glob(realfile): + todelete.append(files[files.index(newfile)]) + for r in todelete: + try: + del files[files.index(r)] + except ValueError: + pass + if not files: + from oe import note + note("Not creating empty archive for %s-%s-%s" % (oe.data.getVar('PKG',d, 1), oe.data.getVar('PV', d, 1), oe.data.getVar('PR', d, 1))) + return + + # output .spec using this metadata store + try: + from __builtin__ import file + if not oe.data.getVar('OUTSPECFILE', d): + raise OSError('eek!') + specfile = file(oe.data.getVar('OUTSPECFILE', d), 'w') + except OSError: + raise oe.build.FuncFailed("unable to open spec file for writing.") + +# fd = sys.__stdout__ + fd = specfile + for var in out_vartranslate.keys(): + if out_vartranslate[var][0] == "%": + continue + fd.write("%s\t: %s\n" % (out_vartranslate[var], oe.data.getVar(var, d))) + fd.write("Summary\t: .\n") + + for var in out_vartranslate.keys(): + if out_vartranslate[var][0] != "%": + continue + fd.write(out_vartranslate[var] + "\n") + fd.write(oe.data.getVar(var, d) + "\n\n") + + fd.write("%files\n") + for file in files: + fd.write("%s\n" % file) + + fd.close() + + # call out rpm -bb on the .spec, thereby creating an rpm + + oe.data.setVar('BUILDSPEC', "${RPMBUILD} -bb ${OUTSPECFILE}\n", d) + oe.data.setVarFlag('BUILDSPEC', 'func', '1', d) + oe.build.exec_func('BUILDSPEC', d) + + # move the rpm into the pkgoutdir + rpm = oe.data.expand('${RPMBUILDPATH}/RPMS/${TARGET_ARCH}/${PKG}-${PV}-${PR}.${TARGET_ARCH}.rpm', d) + outrpm = oe.data.expand('${DEPLOY_DIR_RPM}/${PKG}-${PV}-${PR}.${TARGET_ARCH}.rpm', d) + oe.movefile(rpm, outrpm) +} + +python do_package_rpm () { + workdir = oe.data.getVar('WORKDIR', d) + if not workdir: + raise oe.build.FuncFailed("WORKDIR not defined") + workdir = oe.data.expand(workdir, d) + + import os # path manipulations + outdir = oe.data.getVar('DEPLOY_DIR_RPM', d) + if not outdir: + raise oe.build.FuncFailed("DEPLOY_DIR_RPM not defined") + outdir = oe.data.expand(outdir, d) + oe.mkdirhier(outdir) + + packages = oe.data.getVar('PACKAGES', d) + if not packages: + packages = "${PN}" + oe.data.setVar('FILES', '', d) + ddir = oe.data.expand(oe.data.getVar('D', d), d) + oe.mkdirhier(ddir) + oe.data.setVar(oe.data.expand('FILES_${PN}', d), ''.join([ "./%s" % x for x in os.listdir(ddir)]), d) + packages = oe.data.expand(packages, d) + + 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) + basedir = os.path.dirname(root) + pkgoutdir = outdir + oe.mkdirhier(pkgoutdir) + oe.data.setVar('OUTSPECFILE', os.path.join(workdir, "%s.spec" % pkg), localdata) + oe.build.exec_func('write_specfile', localdata) + del localdata +} + +addtask package_rpm after do_package before do_build 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 diff --git a/irda-utils/files/init b/irda-utils/files/init new file mode 100644 index 0000000000..e69de29bb2 --- /dev/null +++ b/irda-utils/files/init diff --git a/irda-utils/irda-utils_0.9.16.oe b/irda-utils/irda-utils_0.9.16.oe index 36c1e11cfe..f9aec187a3 100644 --- a/irda-utils/irda-utils_0.9.16.oe +++ b/irda-utils/irda-utils_0.9.16.oe @@ -3,10 +3,12 @@ DESCRIPTION = "Provides common files needed to use IrDA. \ IrDA allows communication over Infrared with other devices \ such as phones and laptops." LICENSE = "GPL" +PR="r1" SRC_URI = "${SOURCEFORGE_MIRROR}/irda/irda-utils-${PV}.tar.gz \ file://configure.patch;patch=1 \ - file://m4.patch;patch=1" + file://m4.patch;patch=1 \ + file://init" inherit autotools @@ -19,4 +21,23 @@ do_install () { install -d ${D}${sbindir} oe_runmake -C irattach ROOT="${D}" install oe_runmake -C irdaping ROOT="${D}" install + + install -d ${D}/${sysconfdir}/init.d + install -m 0755 ${WORKDIR}/init ${D}/etc/init.d/irattach +} + +pkg_postinst_irda-utils() { +if test "x$D" != "x"; then + exit 1 +else + update-rc.d irattach defaults +fi +} + +pkg_postrm_irda-utils() { +if test "x$D" != "x"; then + exit 1 +else + update-rc.d -f irattach remove +fi } diff --git a/misc-binary-only/tda1004x-firmware.oe b/misc-binary-only/tda1004x-firmware.oe index 9c494ff584..ffd72c31f0 100644 --- a/misc-binary-only/tda1004x-firmware.oe +++ b/misc-binary-only/tda1004x-firmware.oe @@ -5,9 +5,10 @@ SRC_URI = "http://hauppauge.lightpath.net/de/nova-pci216.exe" FILES_${PN} = '*' python do_unpack() { - import re, copy + import re - localdata = copy.deepcopy(d) + localdata = {} + oe.data.linkDataSet(localdata,d) overrides = oe.data.getVar('OVERRIDES', localdata, 1) if not overrides: raise oe.build.FuncFailed('OVERRIDES not defined') |