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.

(From OE-Core rev: 137a4626a7e8107fc8a71724d5124f44236293b9)

Signed-off-by: Lianhao Lu <lianhao.lu@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
This commit is contained in:
Lianhao Lu 2011-07-05 13:55:41 +08:00 committed by Richard Purdie
parent 44b3590509
commit af1cd61210
1 changed files with 53 additions and 1 deletions

View File

@ -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