summaryrefslogtreecommitdiff
path: root/classes
diff options
context:
space:
mode:
Diffstat (limited to 'classes')
-rw-r--r--classes/base.bbclass17
-rw-r--r--classes/image.bbclass72
-rw-r--r--classes/package.bbclass2
-rw-r--r--classes/rootfs_ipk.bbclass104
-rw-r--r--classes/siteinfo.bbclass3
5 files changed, 101 insertions, 97 deletions
diff --git a/classes/base.bbclass b/classes/base.bbclass
index 249a25a218..504707e37b 100644
--- a/classes/base.bbclass
+++ b/classes/base.bbclass
@@ -41,12 +41,17 @@ def base_conditional(variable, checkvalue, truevalue, falsevalue, d):
else:
return falsevalue
-def base_contains(variable, checkvalue, truevalue, falsevalue, d):
- import bb
- if bb.data.getVar(variable,d,1).find(checkvalue) != -1:
- return truevalue
- else:
- return falsevalue
+def base_contains(variable, checkvalues, truevalue, falsevalue, d):
+ import bb
+ matches = 0
+ if type(checkvalues).__name__ == "str":
+ checkvalues = [checkvalues]
+ for value in checkvalues:
+ if bb.data.getVar(variable,d,1).find(value) != -1:
+ matches = matches + 1
+ if matches == len(checkvalues):
+ return truevalue
+ return falsevalue
def base_both_contain(variable1, variable2, checkvalue, d):
import bb
diff --git a/classes/image.bbclass b/classes/image.bbclass
index 2beb137aef..bcf9bef13c 100644
--- a/classes/image.bbclass
+++ b/classes/image.bbclass
@@ -1,4 +1,6 @@
-inherit rootfs_ipk
+inherit rootfs_${IMAGE_PKGTYPE}
+
+PACKAGES = ""
# We need to recursively follow RDEPENDS and RRECOMMENDS for images
BUILD_ALL_DEPS = "1"
@@ -9,6 +11,8 @@ EXCLUDE_FROM_WORLD = "1"
USE_DEVFS ?= "0"
+PID = "${@os.getpid()}"
+
DEPENDS += "makedevs-native"
PACKAGE_ARCH = "${MACHINE_ARCH}"
@@ -46,6 +50,17 @@ def get_devtable_list(d):
IMAGE_POSTPROCESS_COMMAND ?= ""
+# some default locales
+IMAGE_LINGUAS ?= "de-de fr-fr en-gb"
+
+LINGUAS_INSTALL = "${@" ".join(map(lambda s: "locale-base-%s" % s, bb.data.getVar('IMAGE_LINGUAS', d, 1).split()))}"
+
+ROOTFS_POSTPROCESS_COMMAND ?= ""
+
+do_rootfs[nostamp] = "1"
+do_rootfs[dirs] = "${TOPDIR}"
+do_build[nostamp] = "1"
+
# Must call real_do_rootfs() from inside here, rather than as a separate
# task, so that we have a single fakeroot context for the whole process.
fakeroot do_rootfs () {
@@ -59,7 +74,7 @@ fakeroot do_rootfs () {
done
fi
- real_do_rootfs
+ rootfs_${IMAGE_PKGTYPE}_do_rootfs
insert_feed_uris
@@ -68,6 +83,7 @@ fakeroot do_rootfs () {
${IMAGE_PREPROCESS_COMMAND}
export TOPDIR=${TOPDIR}
+ export MACHINE=${MACHINE}
for type in ${IMAGE_FSTYPES}; do
if test -z "$FAKEROOTKEY"; then
@@ -97,3 +113,55 @@ insert_feed_uris () {
echo "src/gz $feed_name $feed_uri" >> ${IMAGE_ROOTFS}/etc/ipkg/${feed_name}-feed.conf
done
}
+
+log_check() {
+ set +x
+ for target in $*
+ do
+ lf_path="${WORKDIR}/temp/log.do_$target.${PID}"
+
+ echo "log_check: Using $lf_path as logfile"
+
+ if test -e "$lf_path"
+ then
+ rootfs_${IMAGE_PKGTYPE}_log_check $target $lf_path
+ else
+ echo "Cannot find logfile [$lf_path]"
+ fi
+ echo "Logfile is clean"
+ done
+
+ set -x
+}
+
+# set '*' as the rootpassword so the images
+# can decide if they want it or not
+
+zap_root_password () {
+ sed 's%^root:[^:]*:%root:*:%' < ${IMAGE_ROOTFS}/etc/passwd >${IMAGE_ROOTFS}/etc/passwd.new
+ mv ${IMAGE_ROOTFS}/etc/passwd.new ${IMAGE_ROOTFS}/etc/passwd
+}
+
+create_etc_timestamp() {
+ date +%2m%2d%2H%2M%Y >${IMAGE_ROOTFS}/etc/timestamp
+}
+
+# Turn any symbolic /sbin/init link into a file
+remove_init_link () {
+ if [ -h ${IMAGE_ROOTFS}/sbin/init ]; then
+ LINKFILE=${IMAGE_ROOTFS}`readlink ${IMAGE_ROOTFS}/sbin/init`
+ rm ${IMAGE_ROOTFS}/sbin/init
+ cp $LINKFILE ${IMAGE_ROOTFS}/sbin/init
+ fi
+}
+
+make_zimage_symlink_relative () {
+ if [ -L ${IMAGE_ROOTFS}/boot/zImage ]; then
+ (cd ${IMAGE_ROOTFS}/boot/ && for i in `ls zImage-* | sort`; do ln -sf $i zImage; done)
+ fi
+}
+
+# export the zap_root_password, create_etc_timestamp and remote_init_link
+EXPORT_FUNCTIONS zap_root_password create_etc_timestamp remove_init_link do_rootfs make_zimage_symlink_relative
+
+addtask rootfs before do_build after do_install
diff --git a/classes/package.bbclass b/classes/package.bbclass
index 132fdcb37a..a327aa46bd 100644
--- a/classes/package.bbclass
+++ b/classes/package.bbclass
@@ -116,7 +116,7 @@ def do_split_packages(d, root, file_regex, output_pattern, description, postinst
bb.data.setVar('PACKAGES', ' '.join(packages), d)
-PACKAGE_DEPENDS ?= "file-native"
+PACKAGE_DEPENDS ?= "file-native fakeroot-native"
DEPENDS_prepend =+ "${PACKAGE_DEPENDS} "
# file(1) output to match to consider a file an unstripped executable
FILE_UNSTRIPPED_MATCH ?= "not stripped"
diff --git a/classes/rootfs_ipk.bbclass b/classes/rootfs_ipk.bbclass
index 9af23c7a73..03ba5f86b7 100644
--- a/classes/rootfs_ipk.bbclass
+++ b/classes/rootfs_ipk.bbclass
@@ -9,33 +9,15 @@ DEPENDS_prepend="ipkg-native ipkg-utils-native fakeroot-native "
DEPENDS_append=" ${EXTRA_IMAGEDEPENDS}"
RDEPENDS += "ipkg ipkg-collateral"
-PACKAGES = ""
-
-do_rootfs[nostamp] = "1"
-do_rootfs[dirs] = "${TOPDIR}"
-do_build[nostamp] = "1"
-
IPKG_ARGS = "-f ${T}/ipkg.conf -o ${IMAGE_ROOTFS}"
PACKAGE_INSTALL += "ipkg ipkg-collateral"
-ROOTFS_POSTPROCESS_COMMAND ?= ""
-
-PID = "${@os.getpid()}"
-
-# some default locales
-IMAGE_LINGUAS ?= "de-de fr-fr en-gb"
-
-LINGUAS_INSTALL = "${@" ".join(map(lambda s: "locale-base-%s" % s, bb.data.getVar('IMAGE_LINGUAS', d, 1).split()))}"
-
-real_do_rootfs () {
+fakeroot rootfs_ipk_do_rootfs () {
set -x
mkdir -p ${IMAGE_ROOTFS}/dev
- #work around a build in ipkg-make-index
- touch ${DEPLOY_DIR_IPK}/Packages
-
if [ -z "${DEPLOY_KEEP_PACKAGES}" ]; then
touch ${DEPLOY_DIR_IPK}/Packages
ipkg-make-index -r ${DEPLOY_DIR_IPK}/Packages -p ${DEPLOY_DIR_IPK}/Packages -l ${DEPLOY_DIR_IPK}/Packages.filelist -m ${DEPLOY_DIR_IPK}
@@ -60,6 +42,7 @@ real_do_rootfs () {
fi
export D=${IMAGE_ROOTFS}
+ export OFFLINE_ROOT=${IMAGE_ROOTFS}
export IPKG_OFFLINE_ROOT=${IMAGE_ROOTFS}
mkdir -p ${IMAGE_ROOTFS}/etc/ipkg/
grep "^arch" ${T}/ipkg.conf >${IMAGE_ROOTFS}/etc/ipkg/arch.conf
@@ -83,75 +66,22 @@ real_do_rootfs () {
log_check rootfs
}
-log_check() {
- set +x
- for target in $*
- do
- lf_path="${WORKDIR}/temp/log.do_$target.${PID}"
-
- echo "log_check: Using $lf_path as logfile"
-
- if test -e "$lf_path"
+rootfs_ipk_log_check() {
+ target="$1"
+ lf_path="$2"
+
+ lf_txt="`cat $lf_path`"
+ for keyword_die in "Cannot find package" "exit 1" ERR Fail
+ do
+ if (echo "$lf_txt" | grep -v log_check | grep "$keyword_die") >/dev/null 2>&1
then
- lf_txt="`cat $lf_path`"
-
- for keyword_die in "Cannot find package" "exit 1" ERR Fail
- do
-
- if (echo "$lf_txt" | grep -v log_check | grep "$keyword_die") >/dev/null 2>&1
- then
- echo "log_check: There were error messages in the logfile"
- echo -e "log_check: Matched keyword: [$keyword_die]\n"
- echo "$lf_txt" | grep -v log_check | grep -i "$keyword_die" -C1
- echo ""
- do_exit=1
- fi
- done
- test "$do_exit" = 1 && exit 1
- else
- echo "Cannot find logfile [$lf_path]"
+ echo "log_check: There were error messages in the logfile"
+ echo -e "log_check: Matched keyword: [$keyword_die]\n"
+ echo "$lf_txt" | grep -v log_check | grep -i "$keyword_die" -C1
+ echo ""
+ do_exit=1
fi
- echo "Logfile is clean"
done
-
- set -x
-
+ test "$do_exit" = 1 && exit 1
+ true
}
-
-fakeroot do_rootfs () {
- rm -rf ${IMAGE_ROOTFS}
- real_do_rootfs
-}
-
-# set '*' as the rootpassword so the images
-# can decide if they want it or not
-
-zap_root_password () {
- sed 's%^root:[^:]*:%root:*:%' < ${IMAGE_ROOTFS}/etc/passwd >${IMAGE_ROOTFS}/etc/passwd.new
- mv ${IMAGE_ROOTFS}/etc/passwd.new ${IMAGE_ROOTFS}/etc/passwd
-}
-
-create_etc_timestamp() {
- date +%2m%2d%2H%2M%Y >${IMAGE_ROOTFS}/etc/timestamp
-}
-
-# Turn any symbolic /sbin/init link into a file
-remove_init_link () {
- if [ -h ${IMAGE_ROOTFS}/sbin/init ]; then
- LINKFILE=${IMAGE_ROOTFS}`readlink ${IMAGE_ROOTFS}/sbin/init`
- rm ${IMAGE_ROOTFS}/sbin/init
- cp $LINKFILE ${IMAGE_ROOTFS}/sbin/init
- fi
-}
-
-make_zimage_symlink_relative () {
- if [ -L ${IMAGE_ROOTFS}/boot/zImage ]; then
- (cd ${IMAGE_ROOTFS}/boot/ && for i in `ls zImage-* | sort`; do ln -sf $i zImage; done)
- fi
-}
-
-# export the zap_root_password, create_etc_timestamp and remote_init_link
-EXPORT_FUNCTIONS zap_root_password create_etc_timestamp remove_init_link make_zimage_symlink_relative
-
-
-addtask rootfs before do_build after do_install
diff --git a/classes/siteinfo.bbclass b/classes/siteinfo.bbclass
index 5a37768b52..94d25bf56f 100644
--- a/classes/siteinfo.bbclass
+++ b/classes/siteinfo.bbclass
@@ -49,6 +49,7 @@ def get_siteinfo_list(d):
if target in targetinfo:
info = targetinfo[target].split()
info.append(target)
+ info.append("common")
return info
else:
bb.error("Information not available for target '%s'" % target)
@@ -90,7 +91,7 @@ def siteinfo_get_files(d):
if os.path.exists(fname):
sitefiles += fname + " "
- bb.note("SITE files " + sitefiles);
+ bb.debug(1, "SITE files " + sitefiles);
return sitefiles
#