summaryrefslogtreecommitdiff
path: root/classes
diff options
context:
space:
mode:
Diffstat (limited to 'classes')
-rw-r--r--classes/base.bbclass70
-rw-r--r--classes/packaged-staging.bbclass116
-rw-r--r--classes/sdk.bbclass3
3 files changed, 142 insertions, 47 deletions
diff --git a/classes/base.bbclass b/classes/base.bbclass
index 1213ef07fa..b653bec83f 100644
--- a/classes/base.bbclass
+++ b/classes/base.bbclass
@@ -160,9 +160,9 @@ DEPENDS_prepend="${@base_dep_prepend(d)} "
def base_set_filespath(path, d):
import os, bb
filespath = []
+ # The ":" ensures we have an 'empty' override
+ overrides = (bb.data.getVar("OVERRIDES", d, 1) or "") + ":"
for p in path:
- overrides = bb.data.getVar("OVERRIDES", d, 1) or ""
- overrides = overrides + ":"
for o in overrides.split(":"):
filespath.append(os.path.join(p, o))
return ":".join(filespath)
@@ -325,7 +325,7 @@ oe_libinstall() {
__runcmd rm -f $destpath/$libname.la
__runcmd sed -e 's/^installed=yes$/installed=no/' \
-e '/^dependency_libs=/s,${WORKDIR}[[:alnum:]/\._+-]*/\([[:alnum:]\._+-]*\),${STAGING_LIBDIR}/\1,g' \
- -e "/^dependency_libs=/s,\([[:space:]']+\)${libdir},\1${STAGING_LIBDIR},g" \
+ -e "/^dependency_libs=/s,\([[:space:]']\)${libdir},\1${STAGING_LIBDIR},g" \
$dotlai >$destpath/$libname.la
else
__runcmd install -m 0644 $dotlai $destpath/$libname.la
@@ -473,6 +473,24 @@ python base_do_mrproper() {
bb.build.exec_func('do_clean', d)
}
+SCENEFUNCS += "base_scenefunction"
+
+python base_do_setscene () {
+ for f in (bb.data.getVar('SCENEFUNCS', d, 1) or '').split():
+ bb.build.exec_func(f, d)
+ if not os.path.exists(bb.data.getVar('STAMP', d, 1) + ".do_setscene"):
+ bb.build.make_stamp("do_setscene", d)
+}
+do_setscene[selfstamp] = "1"
+addtask setscene before do_fetch
+
+python base_scenefunction () {
+ stamp = bb.data.getVar('STAMP', d, 1) + ".needclean"
+ if os.path.exists(stamp):
+ bb.build.exec_func("do_clean", d)
+}
+
+
addtask fetch
do_fetch[dirs] = "${DL_DIR}"
do_fetch[depends] = "shasum-native:do_populate_staging"
@@ -543,6 +561,45 @@ base_do_fetchall() {
:
}
+addtask checkuri
+do_checkuri[nostamp] = "1"
+python do_checkuri() {
+ import sys
+
+ localdata = bb.data.createCopy(d)
+ bb.data.update_data(localdata)
+
+ src_uri = bb.data.getVar('SRC_URI', localdata, 1)
+
+ try:
+ bb.fetch.init(src_uri.split(),d)
+ except bb.fetch.NoMethodError:
+ (type, value, traceback) = sys.exc_info()
+ raise bb.build.FuncFailed("No method: %s" % value)
+
+ try:
+ bb.fetch.checkstatus(localdata)
+ except bb.fetch.MissingParameterError:
+ (type, value, traceback) = sys.exc_info()
+ raise bb.build.FuncFailed("Missing parameters: %s" % value)
+ except bb.fetch.FetchError:
+ (type, value, traceback) = sys.exc_info()
+ raise bb.build.FuncFailed("Fetch failed: %s" % value)
+ except bb.fetch.MD5SumError:
+ (type, value, traceback) = sys.exc_info()
+ raise bb.build.FuncFailed("MD5 failed: %s" % value)
+ except:
+ (type, value, traceback) = sys.exc_info()
+ raise bb.build.FuncFailed("Unknown fetch Error: %s" % value)
+}
+
+addtask checkuriall after do_checkuri
+do_checkuriall[recrdeptask] = "do_checkuri"
+do_checkuriall[nostamp] = "1"
+base_do_checkuriall() {
+ :
+}
+
addtask buildall after do_build
do_buildall[recrdeptask] = "do_build"
base_do_buildall() {
@@ -701,6 +758,7 @@ python base_eventhandler() {
dir = "%s.*" % e.stampPrefix[fn]
bb.note("Removing stamps: " + dir)
os.system('rm -f '+ dir)
+ os.system('touch ' + e.stampPrefix[fn] + '.needclean')
if not data in e.__dict__:
return NotHandled
@@ -829,7 +887,7 @@ def has_subpkgdata(pkg, d):
return os.access(get_subpkgedata_fn(pkg, d), os.R_OK)
def read_subpkgdata(pkg, d):
- import bb, os
+ import bb
return read_pkgdatafile(get_subpkgedata_fn(pkg, d))
def has_pkgdata(pn, d):
@@ -838,7 +896,7 @@ def has_pkgdata(pn, d):
return os.access(fn, os.R_OK)
def read_pkgdata(pn, d):
- import bb, os
+ import bb
fn = bb.data.expand('${PKGDATA_DIR}/%s' % pn, d)
return read_pkgdatafile(fn)
@@ -978,7 +1036,7 @@ inherit patch
# Move to autotools.bbclass?
inherit siteinfo
-EXPORT_FUNCTIONS do_clean do_mrproper do_fetch do_unpack do_configure do_compile do_install do_package do_populate_pkgs do_stage do_rebuild do_fetchall
+EXPORT_FUNCTIONS do_setscene do_clean do_mrproper do_fetch do_unpack do_configure do_compile do_install do_package do_populate_pkgs do_stage do_rebuild do_fetchall
MIRRORS[func] = "0"
MIRRORS () {
diff --git a/classes/packaged-staging.bbclass b/classes/packaged-staging.bbclass
index bb166cb2f5..a98b4a71a5 100644
--- a/classes/packaged-staging.bbclass
+++ b/classes/packaged-staging.bbclass
@@ -41,6 +41,8 @@ PSTAGE_NATIVEDEPENDS = "\
stagemanager-native \
"
+BB_STAMP_WHITELIST = "${PSTAGE_NATIVEDEPENDS}"
+
python () {
import bb
pstage_allowed = True
@@ -71,9 +73,9 @@ python () {
deps += " stagemanager-native:do_populate_staging"
bb.data.setVarFlag('do_populate_staging', 'depends', deps, d)
- deps = bb.data.getVarFlag('do_prepackaged_stage', 'depends', d) or ""
+ deps = bb.data.getVarFlag('do_setscene', 'depends', d) or ""
deps += " opkg-native:do_populate_staging ipkg-utils-native:do_populate_staging"
- bb.data.setVarFlag('do_prepackaged_stage', 'depends', deps, d)
+ bb.data.setVarFlag('do_setscene', 'depends', deps, d)
bb.data.setVar("PSTAGING_ACTIVE", "1", d)
else:
bb.data.setVar("PSTAGING_ACTIVE", "0", d)
@@ -90,17 +92,48 @@ PSTAGE_LIST_CMD = "opkg-cl list_installed -f ${PSTAGE_MACHCONFIG} -o ${TMPDIR}"
PSTAGE_TMPDIR_STAGE = "${WORKDIR}/staging-pkg"
-do_clean_append() {
+def pstage_manualclean(srcname, destvarname, d):
+ import os, bb
+
+ src = os.path.join(bb.data.getVar('PSTAGE_TMPDIR_STAGE', d, True), srcname)
+ dest = bb.data.getVar(destvarname, d, True)
+
+ for walkroot, dirs, files in os.walk(src):
+ for file in files:
+ filepath = os.path.join(walkroot, file).replace(src, dest)
+ bb.note("rm %s" % filepath)
+ os.system("rm %s" % filepath)
+
+def pstage_cleanpackage(pkgname, d):
+ import os, bb
+
+ path = bb.data.getVar("PATH", d, 1)
+ list_cmd = bb.data.getVar("PSTAGE_LIST_CMD", d, True)
+
+ bb.note("Checking if staging package installed")
+ lf = bb.utils.lockfile(bb.data.expand("${STAGING_DIR}/staging.lock", d))
+ ret = os.system("PATH=\"%s\" %s | grep %s" % (path, list_cmd, pkgname))
+ if ret == 0:
+ bb.note("Yes. Uninstalling package from staging...")
+ removecmd = bb.data.getVar("PSTAGE_REMOVE_CMD", d, 1)
+ ret = os.system("PATH=\"%s\" %s %s" % (path, removecmd, pkgname))
+ if ret != 0:
+ bb.note("Failure removing staging package")
+ else:
+ bb.note("No. Manually removing any installed files")
+ pstage_manualclean("staging", "STAGING_DIR", d)
+ pstage_manualclean("cross", "CROSS_DIR", d)
+ pstage_manualclean("deploy", "DEPLOY_DIR", d)
+
+ bb.utils.unlockfile(lf)
+
+do_clean_prepend() {
"""
Clear the build and temp directories
"""
- bb.note("Uninstalling package from staging...")
- path = bb.data.getVar("PATH", d, 1)
- removecmd = bb.data.getVar("PSTAGE_REMOVE_CMD", d, 1)
+
removepkg = bb.data.expand("${PSTAGE_PKGPN}", d)
- ret = os.system("PATH=\"%s\" %s %s" % (path, removecmd, removepkg))
- if ret != 0:
- bb.note("Failure removing staging package")
+ pstage_cleanpackage(removepkg, d)
stagepkg = bb.data.expand("${PSTAGE_PKG}", d)
bb.note("Removing staging package %s" % stagepkg)
@@ -123,22 +156,16 @@ staging_helper () {
PSTAGE_TASKS_COVERED = "fetch unpack munge patch configure qa_configure rig_locales compile sizecheck install deploy package populate_staging package_write_deb package_write_ipk package_write package_stage qa_staging"
-python do_prepackaged_stage () {
+SCENEFUNCS += "packagestage_scenefunc"
+
+python packagestage_scenefunc () {
import os
if bb.data.getVar("PSTAGING_ACTIVE", d, 1) == "0":
- bb.build.make_stamp("do_prepackaged_stage", d)
return
- bb.note("Uninstalling any existing package from staging...")
- path = bb.data.getVar("PATH", d, 1)
- removecmd = bb.data.getVar("PSTAGE_REMOVE_CMD", d, 1)
removepkg = bb.data.expand("${PSTAGE_PKGPN}", d)
- lf = bb.utils.lockfile(bb.data.expand("${STAGING_DIR}/staging.lock", d))
- ret = os.system("PATH=\"%s\" %s %s" % (path, removecmd, removepkg))
- bb.utils.unlockfile(lf)
- if ret != 0:
- bb.note("Failure attempting to remove staging package")
+ pstage_cleanpackage(removepkg, d)
stagepkg = bb.data.expand("${PSTAGE_PKG}", d)
@@ -156,17 +183,11 @@ python do_prepackaged_stage () {
if ret != 0:
bb.note("Failure installing prestage package")
- #bb.build.make_stamp("do_prepackaged_stage", d)
- #for task in bb.data.getVar("PSTAGE_TASKS_COVERED", d, 1).split():
- # bb.build.make_stamp("do_" + task, d)
bb.build.make_stamp("do_stage_package_populated", d)
- else:
- bb.build.make_stamp("do_prepackaged_stage", d)
}
-do_prepackaged_stage[cleandirs] = "${PSTAGE_TMPDIR_STAGE}"
-do_prepackaged_stage[selfstamp] = "1"
-addtask prepackaged_stage before do_fetch
+packagestage_scenefunc[cleandirs] = "${PSTAGE_TMPDIR_STAGE}"
+packagestage_scenefunc[dirs] = "${STAGING_DIR}"
addhandler packagedstage_stampfixing_eventhandler
python packagedstage_stampfixing_eventhandler() {
@@ -201,7 +222,7 @@ populate_staging_preamble () {
populate_staging_postamble () {
if [ "$PSTAGING_ACTIVE" = "1" ]; then
# list the packages currently installed in staging
- ${PSTAGE_LIST_CMD} | awk '{print $1}' > ${DEPLOY_DIR_PSTAGE}/installed-list
+ # ${PSTAGE_LIST_CMD} | awk '{print $1}' > ${DEPLOY_DIR_PSTAGE}/installed-list
set +e
stage-manager -p ${STAGING_DIR} -c ${DEPLOY_DIR_PSTAGE}/stamp-cache-staging -u -d ${PSTAGE_TMPDIR_STAGE}/staging
@@ -246,7 +267,14 @@ staging_packager () {
}
staging_package_installer () {
- ${PSTAGE_INSTALL_CMD} ${PSTAGE_PKG}
+ #${PSTAGE_INSTALL_CMD} ${PSTAGE_PKG}
+
+ STATUSFILE=${TMPDIR}${layout_libdir}/opkg/status
+ echo "Package: ${PSTAGE_PKGPN}" >> $STATUSFILE
+ echo "Version: ${PSTAGE_PKGVERSION}" >> $STATUSFILE
+ echo "Status: install user installed" >> $STATUSFILE
+ echo "Architecture: ${PSTAGE_PKGARCH}" >> $STATUSFILE
+ echo "" >> $STATUSFILE
}
python do_package_stage () {
@@ -281,11 +309,10 @@ python do_package_stage () {
if bb.data.inherits_class('package_ipk', d):
srcname = bb.data.expand(pkgname + "_${PV}-" + pr + "_" + arch + ".ipk", d)
srcfile = bb.data.expand("${DEPLOY_DIR_IPK}/" + arch + "/" + srcname, d)
- if not os.path.exists(srcfile):
- bb.fatal("Package %s does not exist yet it should" % srcfile)
- destpath = ipkpath + "/" + arch + "/"
- bb.mkdirhier(destpath)
- bb.copyfile(srcfile, destpath + srcname)
+ if os.path.exists(srcfile):
+ destpath = ipkpath + "/" + arch + "/"
+ bb.mkdirhier(destpath)
+ bb.copyfile(srcfile, destpath + srcname)
if bb.data.inherits_class('package_deb', d):
if arch == 'all':
@@ -293,11 +320,10 @@ python do_package_stage () {
else:
srcname = bb.data.expand(pkgname + "_${PV}-" + pr + "_${DPKG_ARCH}.deb", d)
srcfile = bb.data.expand("${DEPLOY_DIR_DEB}/" + arch + "/" + srcname, d)
- if not os.path.exists(srcfile):
- bb.fatal("Package %s does not exist yet it should" % srcfile)
- destpath = debpath + "/" + arch + "/"
- bb.mkdirhier(destpath)
- bb.copyfile(srcfile, destpath + srcname)
+ if os.path.exists(srcfile):
+ destpath = debpath + "/" + arch + "/"
+ bb.mkdirhier(destpath)
+ bb.copyfile(srcfile, destpath + srcname)
#
# Handle stamps/ files
@@ -307,7 +333,7 @@ python do_package_stage () {
bb.mkdirhier(destdir)
# We need to include the package_stage stamp in the staging package so create one
bb.build.make_stamp("do_package_stage", d)
- os.system("cp %s.do_* %s/" % (stampfn, destdir))
+ os.system("cp -dpR %s.do_* %s/" % (stampfn, destdir))
bb.build.exec_func("staging_helper", d)
bb.build.exec_func("staging_packager", d)
@@ -320,3 +346,13 @@ python do_package_stage () {
# Note an assumption here is that do_deploy runs before do_package_write/do_populate_staging
#
addtask package_stage after do_package_write do_populate_staging before do_build
+
+do_package_stage_all () {
+ :
+}
+do_package_stage_all[recrdeptask] = "do_package_stage"
+addtask package_stage_all after do_package_stage before do_build
+
+
+
+
diff --git a/classes/sdk.bbclass b/classes/sdk.bbclass
index cbc1742dab..a94332b92c 100644
--- a/classes/sdk.bbclass
+++ b/classes/sdk.bbclass
@@ -4,6 +4,7 @@ EXCLUDE_FROM_WORLD = "1"
OLD_PACKAGE_ARCH := ${PACKAGE_ARCH}
PACKAGE_ARCH = "${BUILD_ARCH}-${OLD_PACKAGE_ARCH}-sdk"
+STAGING_DIR_HOST = "${STAGING_DIR}/${HOST_SYS}-sdk"
HOST_ARCH = "${BUILD_ARCH}"
HOST_VENDOR = "${BUILD_VENDOR}"
@@ -49,4 +50,4 @@ FILES_${PN}-dbg += "${prefix}/.debug \
${prefix}/bin/.debug \
"
-export PKG_CONFIG_SYSROOT_DIR = "${STAGING_DIR}/${HOST_SYS}"
+export PKG_CONFIG_SYSROOT_DIR = "${STAGING_DIR_HOST}"