inherit package
-BOOTSTRAP_EXTRA_RDEPENDS += "ipkg-collateral ipkg"
+BOOTSTRAP_EXTRA_RDEPENDS += "opkg-collateral opkg"
IMAGE_PKGTYPE ?= "ipk"
-IPKGCONF_TARGET = "${STAGING_ETCDIR_NATIVE}/ipkg.conf"
-IPKGCONF_SDK = "${STAGING_ETCDIR_NATIVE}/ipkg-sdk.conf"
+IPKGCONF_TARGET = "${STAGING_ETCDIR_NATIVE}/opkg.conf"
+IPKGCONF_SDK = "${STAGING_ETCDIR_NATIVE}/opkg-sdk.conf"
python package_ipk_fn () {
from bb import data
bb.data.setVar('PKGFN', bb.data.getVar('PKG',d), d)
}
-python package_ipk_install () {
+python package_ipk_install () {
+ #
+ # Warning - this function is not multimachine safe (see stagingdir reference)!
+ #
+
import os, sys
pkg = bb.data.getVar('PKG', d, 1)
pkgfn = bb.data.getVar('PKGFN', d, 1)
raise bb.build.FuncFailed
# Generate ipk.conf if it or the stamp doesnt exist
- conffile = os.path.join(stagingdir,"ipkg.conf")
+ conffile = os.path.join(stagingdir,"opkg.conf")
if not os.access(conffile, os.R_OK):
ipkg_archs = bb.data.getVar('PACKAGE_ARCHS',d)
if ipkg_archs is None:
f = open(os.path.join(tmpdir, "stamps", "IPK_PACKAGE_INDEX_CLEAN"),"w")
f.close()
- ret = os.system('ipkg-cl -o %s -f %s update' % (rootfs, conffile))
- ret = os.system('ipkg-cl -o %s -f %s install %s' % (rootfs, conffile, pkgfn))
+ ret = os.system('opkg-cl -o %s -f %s update' % (rootfs, conffile))
+ ret = os.system('opkg-cl -o %s -f %s install %s' % (rootfs, conffile, pkgfn))
if (ret != 0 ):
raise bb.build.FuncFailed
}
}
python do_package_ipk () {
- import sys, re, copy, fcntl
+ import sys, re, copy
workdir = bb.data.getVar('WORKDIR', d, 1)
if not workdir:
return
bb.mkdirhier(dvar)
- packages = bb.data.getVar('PACKAGES', d, 1)
- if not packages:
- bb.debug(1, "PACKAGES not defined, nothing 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"))
- if packages == []:
- bb.debug(1, "No packages; nothing to do")
- return
-
- def lockfile(name):
- lf = open(name, "a+")
- fcntl.flock(lf.fileno(), fcntl.LOCK_EX)
- return lf
-
- def unlockfile(lf):
- fcntl.flock(lf.fileno(), fcntl.LOCK_UN)
- lf.close
-
-
+ packages = bb.data.getVar('PACKAGES', d, True)
for pkg in packages.split():
localdata = bb.data.createCopy(d)
pkgdest = bb.data.getVar('PKGDEST', d, 1)
root = "%s/%s" % (pkgdest, pkg)
- lf = lockfile(root + ".lock")
+ lf = bb.utils.lockfile(root + ".lock")
bb.data.setVar('ROOT', '', localdata)
bb.data.setVar('ROOT_%s' % pkg, root, localdata)
if not g and bb.data.getVar('ALLOW_EMPTY', localdata) != "1":
from bb import note
note("Not creating empty archive for %s-%s-%s" % (pkg, bb.data.getVar('PV', localdata, 1), bb.data.getVar('PR', localdata, 1)))
- unlockfile(lf)
+ bb.utils.unlockfile(lf)
continue
controldir = os.path.join(root, 'CONTROL')
try:
ctrlfile = file(os.path.join(controldir, 'control'), 'w')
except OSError:
- unlockfile(lf)
+ bb.utils.unlockfile(lf)
raise bb.build.FuncFailed("unable to open control file for writing.")
fields = []
except KeyError:
(type, value, traceback) = sys.exc_info()
ctrlfile.close()
- unlockfile(lf)
+ bb.utils.unlockfile(lf)
raise bb.build.FuncFailed("Missing field for ipk generation: %s" % value)
# more fields
try:
scriptfile = file(os.path.join(controldir, script), 'w')
except OSError:
- unlockfile(lf)
+ bb.utils.unlockfile(lf)
raise bb.build.FuncFailed("unable to open %s script file for writing." % script)
scriptfile.write(scriptvar)
scriptfile.close()
try:
conffiles = file(os.path.join(controldir, 'conffiles'), 'w')
except OSError:
- unlockfile(lf)
+ bb.utils.unlockfile(lf)
raise bb.build.FuncFailed("unable to open conffiles for writing.")
for f in conffiles_str.split():
conffiles.write('%s\n' % f)
ret = os.system("PATH=\"%s\" %s %s %s" % (bb.data.getVar("PATH", localdata, 1),
bb.data.getVar("IPKGBUILDCMD",d,1), pkg, pkgoutdir))
if ret != 0:
- unlockfile(lf)
+ bb.utils.unlockfile(lf)
raise bb.build.FuncFailed("ipkg-build execution failed")
for script in ["preinst", "postinst", "prerm", "postrm", "control" ]:
os.rmdir(controldir)
except OSError:
pass
- unlockfile(lf)
+ bb.utils.unlockfile(lf)
}
python () {
}
python do_package_write_ipk () {
+ packages = bb.data.getVar('PACKAGES', d, True)
+ if not packages:
+ bb.debug(1, "No PACKAGES defined, nothing to package")
+ return
+
bb.build.exec_func("read_subpackage_metadata", d)
bb.build.exec_func("do_package_ipk", d)
}