summaryrefslogtreecommitdiff
path: root/meta/classes/image.bbclass
diff options
context:
space:
mode:
authorLianhao Lu <lianhao.lu@intel.com>2011-07-05 13:55:41 +0800
committerRichard Purdie <richard.purdie@linuxfoundation.org>2011-07-27 16:25:09 +0100
commit137a4626a7e8107fc8a71724d5124f44236293b9 (patch)
treeed641fa3b1851b009a390c26c6a5d40cd7888501 /meta/classes/image.bbclass
parent1939a4395997098862912e013a2b13ed2f385f9f (diff)
downloadopenembedded-core-137a4626a7e8107fc8a71724d5124f44236293b9.tar.gz
openembedded-core-137a4626a7e8107fc8a71724d5124f44236293b9.tar.bz2
openembedded-core-137a4626a7e8107fc8a71724d5124f44236293b9.zip
image.bbclass: Added variables for multilib support.
1. Added MULTILIB_PACKAGE_INSTALL for multilib instances of packages to be installed in the rootfs. 2. MULTILIBRE_ALLOW_REP contains the regular expression to match the files allow to be replaced by the conflicting files. 3. MULTILIBRE_FORCE_SAME contains the regular expression to match the files allow to be replaced only if the conflicting files are identical. 4. Added shell function multilib_sanity_check() to check whether the overwring for multilib situation is allowed. Signed-off-by: Lianhao Lu <lianhao.lu@intel.com>
Diffstat (limited to 'meta/classes/image.bbclass')
-rw-r--r--meta/classes/image.bbclass54
1 files changed, 53 insertions, 1 deletions
diff --git a/meta/classes/image.bbclass b/meta/classes/image.bbclass
index 79a56f0408..243baa9c35 100644
--- a/meta/classes/image.bbclass
+++ b/meta/classes/image.bbclass
@@ -5,13 +5,15 @@ inherit imagetest-${IMAGETEST}
LICENSE = "MIT"
PACKAGES = ""
-RDEPENDS += "${IMAGE_INSTALL} ${LINGUAS_INSTALL}"
+MULTILIB_IMAGE_INSTALL ?= ""
+RDEPENDS += "${IMAGE_INSTALL} ${LINGUAS_INSTALL} ${MULTILIB_IMAGE_INSTALL}"
INHIBIT_DEFAULT_DEPS = "1"
# "export IMAGE_BASENAME" not supported at this time
IMAGE_BASENAME[export] = "1"
export PACKAGE_INSTALL ?= "${IMAGE_INSTALL}"
+export MULTILIB_PACKAGE_INSTALL ?= "${MULTILIB_IMAGE_INSTALL}"
PACKAGE_INSTALL_ATTEMPTONLY ?= ""
# Images are generally built explicitly, do not need to be part of world.
@@ -91,6 +93,7 @@ do_rootfs[umask] = 022
fakeroot do_rootfs () {
#set -x
rm -rf ${IMAGE_ROOTFS}
+ rm -rf ${MULTILIB_TEMP_ROOTFS}
mkdir -p ${IMAGE_ROOTFS}
mkdir -p ${DEPLOY_DIR_IMAGE}
@@ -166,6 +169,55 @@ log_check() {
done
}
+MULTILIBRE_ALLOW_REP =. "${base_bindir}|${base_sbindir}|${bindir}|${sbindir}|${libexecdir}|"
+MULTILIBRE_FORCE_SAME =. "${sysconfdir}|${datadir}|"
+MULTILIB_CHECK_FILE = "${WORKDIR}/multilib_check.py"
+MULTILIB_TEMP_ROOTFS = "${WORKDIR}/multilib"
+
+multilib_generate_python_file() {
+ cat >${MULTILIB_CHECK_FILE} <<EOF
+import sys, os, os.path
+import re,filecmp
+
+allow_rep=re.compile(re.sub("\|$","","${MULTILIBRE_ALLOW_REP}"))
+force_same=re.compile(re.sub("\|$","","${MULTILIBRE_FORCE_SAME}"))
+error_promt="Multilib check error:"
+
+files={}
+dirs=raw_input()
+for dir in dirs.split():
+ for root, subfolers, subfiles in os.walk(dir):
+ for file in subfiles:
+ item=os.path.join(root,file)
+ key=str(os.path.join("/",os.path.relpath(item,dir)))
+
+ valid=True;
+ if files.has_key(key):
+ #check whether files are the same
+ if force_same.match(key):
+ if not filecmp.cmp(files[key],item):
+ valid=False
+ print("%s %s is not the same as %s\n" % (error_promt, item, files[key]))
+ sys.exit(1)
+ #check whether the file is allow to replace
+ elif allow_rep.match(key):
+ valid=True
+ else:
+ valid=False
+ print("%s duplicated files %s %s not allowed\n" % (error_promt, item, files[key]))
+ sys.exit(1)
+
+ #pass the check, add to list
+ if valid:
+ files[key]=item
+EOF
+}
+
+multilib_sanity_check() {
+ multilib_generate_python_file
+ echo $@ | python ${MULTILIB_CHECK_FILE}
+}
+
# set '*' as the rootpassword so the images
# can decide if they want it or not