diff --git a/classes/binary_ipk.bbclass b/classes/binary_ipk.bbclass new file mode 100644 index 0000000..8cb1eb3 --- /dev/null +++ b/classes/binary_ipk.bbclass @@ -0,0 +1,56 @@ +### A class for installing prebuilt packages + +inherit package_ipk + +PACKAGES="${PN}" + +do_configure() { + : +} +do_compile() { + : +} +do_stage() { + : +} +do_install() { + : +} +do_populate_staging() { + : +} +do_install() { + : +} + +python do_package_ipk() { + import sys, bb, os, re, glob + + outdir = bb.data.getVar('DEPLOY_DIR_IPK', d, 1) + if not outdir: + bb.error("DEPLOY_DIR_IPK not defined, unable to package") + return + + tmpdir = bb.data.getVar('TMPDIR', d, 1) + if os.access(os.path.join(tmpdir, "stamps", "IPK_PACKAGE_INDEX_CLEAN"), os.R_OK): + os.unlink(os.path.join(tmpdir, "stamps", "IPK_PACKAGE_INDEX_CLEAN")) + + + path = bb.data.getVar('PATH', d, 1) + workdir = bb.data.getVar('WORKDIR', d, 1) + packages = glob.glob("%s/*.ipk" % (workdir)) + + for pkg in packages: + ipkgPipe = os.popen("PATH=%s ipkg-list-fields %s | grep \"Architecture\" | cut -d \' \' -sf2" % (path, pkg)) + arch = ipkgPipe.readline() + bb.debug(1, "PKG %s, ARCH %s" % (pkg, arch)) + ipkgPipe.close() + if arch == '' or arch == None: + bb.fatal("Unable to read architecture from %s" % (pkg)) + + pkgoutdir = "%s/%s" % (outdir, arch) + + bb.note("Installing %s into %s" % (pkg, pkgoutdir)) + os.system("cp %s %s" % (pkg, pkgoutdir)) +} + diff --git a/classes/package_ipk.bbclass b/classes/package_ipk.bbclass index e556108..853da21 100644 --- a/classes/package_ipk.bbclass +++ b/classes/package_ipk.bbclass @@ -302,6 +302,21 @@ python do_package_ipk () { bb.utils.unlockfile(lf) raise bb.build.FuncFailed("ipkg-build execution failed") + #for binary packaging, a release package will also install into its WORKDIR + binrelease = bb.data.getVar("BINRELEASE", d, 1) + if binrelease == '1': + bindir = "%s/binrelease" % (workdir) + bb.mkdirhier(bindir) + ret = os.system("PATH=\"%s\" %s %s %s" % (bb.data.getVar("PATH", localdata, 1), bb.data.getVar("IPKGBUILDCMD",d,1), pkg, bindir)) + + #Don't binrelease dbg/dev/doc packages + todelPkgs = glob("%s/*-dbg*.ipk" % (bindir)) + todelPkgs.extend(glob("%s/*-dev*.ipk" % (bindir))) + todelPkgs.extend(glob("%s/*-doc*.ipk" % (bindir))) + for todel in todelPkgs: + bb.debug(1, "Uninstalling %s for binrelease" % (todel)) + os.system("rm -f %s" % (todel)) + bb.utils.prunedir(controldir) bb.utils.unlockfile(lf) }