summaryrefslogtreecommitdiffstats
path: root/meta-oe/classes
diff options
context:
space:
mode:
authorKoen Kooi <koen@dominion.thruhere.net>2011-05-16 20:57:45 +0200
committerKoen Kooi <koen@dominion.thruhere.net>2011-05-16 20:57:45 +0200
commit68c15845d087df0a6f66c58a9fd80548a9bb3a59 (patch)
tree1038d4cf44df840aab3008a452eef8ff5c094f43 /meta-oe/classes
parent9c5f5a80700cf57ecc70d0356979f1281fae0d61 (diff)
downloadmeta-openembedded-68c15845d087df0a6f66c58a9fd80548a9bb3a59.tar.gz
testlab, blacklist bbclass: import from meta-angstrom
These are good for general use since other distros (SHR, SlugOS) are copying them into their layers nowadays. Let's stop this duplication bu moving them here. Signed-off-by: Koen Kooi <koen@dominion.thruhere.net>
Diffstat (limited to 'meta-oe/classes')
-rw-r--r--meta-oe/classes/blacklist.bblass20
-rw-r--r--meta-oe/classes/kernel.bbclass3
-rw-r--r--meta-oe/classes/testlab.bbclass83
3 files changed, 105 insertions, 1 deletions
diff --git a/meta-oe/classes/blacklist.bblass b/meta-oe/classes/blacklist.bblass
new file mode 100644
index 000000000..7bf4a73a9
--- /dev/null
+++ b/meta-oe/classes/blacklist.bblass
@@ -0,0 +1,20 @@
1# anonymous support class from angstrom
2#
3# Features:
4#
5# * blacklist handling, set ANGSTROM_BLACKLIST_pn-blah = "message"
6#
7
8python () {
9 import bb
10
11 blacklist = bb.data.getVar("ANGSTROM_BLACKLIST", d, 1)
12 pkgnm = bb.data.getVar("PN", d, 1)
13 distro = bb.data.getVar("DISTRO", d, 1)
14
15 if blacklist:
16 bb.note("%s DOES NOT support %s because %s" % (distro,pkgnm, blacklist))
17 raise bb.parse.SkipPackage("%s DOES NOT support %s because %s" % (distro,pkgnm, blacklist))
18
19}
20
diff --git a/meta-oe/classes/kernel.bbclass b/meta-oe/classes/kernel.bbclass
index 9a80a1cf5..e1e8197cb 100644
--- a/meta-oe/classes/kernel.bbclass
+++ b/meta-oe/classes/kernel.bbclass
@@ -159,7 +159,8 @@ kernel_do_install() {
159 # we clean the scripts dir while leaving the generated config 159 # we clean the scripts dir while leaving the generated config
160 # and include files. 160 # and include files.
161 # 161 #
162 oe_runmake -C $kerneldir CC="${KERNEL_CC}" LD="${KERNEL_LD}" clean 162 find $kerneldir -name "*.o" -delete
163 #oe_runmake -C $kerneldir CC="${KERNEL_CC}" LD="${KERNEL_LD}" clean
163 make -C $kerneldir _mrproper_scripts 164 make -C $kerneldir _mrproper_scripts
164 find $kerneldir -path $kerneldir/scripts -prune -o -name "*.[csS]" -exec rm '{}' \; 165 find $kerneldir -path $kerneldir/scripts -prune -o -name "*.[csS]" -exec rm '{}' \;
165 find $kerneldir/Documentation -name "*.txt" -exec rm '{}' \; 166 find $kerneldir/Documentation -name "*.txt" -exec rm '{}' \;
diff --git a/meta-oe/classes/testlab.bbclass b/meta-oe/classes/testlab.bbclass
new file mode 100644
index 000000000..6581ec391
--- /dev/null
+++ b/meta-oe/classes/testlab.bbclass
@@ -0,0 +1,83 @@
1#
2# Performs various tests and analysises on images
3#
4# Copyright (C) 2007, 2008 Koen Kooi <koen@openembedded.org>
5
6# The current features are:
7# 1) dump a list of installed packages
8# 2) dump a list of sizes of installed packages
9# 3) dependency graphs of installed packages
10
11# See
12# * http://dominion.thruhere.net/koen/cms/the-testlab-strikes-again
13# * http://dominion.thruhere.net/koen/cms/package-relations-inside-images
14# for use cases
15
16# TODO:
17# * log information to a server for safekeeping
18# * use git notes to record this info into the scm
19# * add test suite to run on the target device
20
21
22# Needs 'dot', 'opkg-cl'
23
24do_testlab() {
25if [ -e ${IMAGE_ROOTFS}/etc/opkg ] && [ "${ONLINE_PACKAGE_MANAGEMENT}" = "full" ] ; then
26
27 IPKG_TMP_DIR="${IMAGE_ROOTFS}-tmp"
28 IPKG_ARGS="-f ${STAGING_ETCDIR_NATIVE}/opkg.conf -o ${IMAGE_ROOTFS} -t ${IPKG_TMP_DIR}"
29
30 TESTLAB_DIR="${DEPLOY_DIR_IMAGE}/${IMAGE_NAME}-testlab"
31 mkdir -p ${TESTLAB_DIR}/
32 mkdir -p ${IPKG_TMP_DIR}/
33 ls -laR ${IMAGE_ROOTFS} > ${TESTLAB_DIR}/files-in-image.txt
34
35 echo > ${TESTLAB_DIR}/installed-packages.txt
36 echo -e "digraph depends {\n node [shape=plaintext]" > ${TESTLAB_DIR}/depends.dot
37
38 for pkg in $(opkg-cl ${IPKG_ARGS} list_installed | awk '{print $1}') ; do
39 opkg-cl ${IPKG_ARGS} info $pkg | grep -B 7 -A 7 "^Status.* \(\(installed\)\|\(unpacked\)\)" | awk '/^Package/ {printf $2"_"} /^Version/ {printf $2"_"} /^Archi/ {print $2".ipk"}' >> ${TESTLAB_DIR}/installed-packages.txt
40
41 for depends in $(opkg-cl ${IPKG_ARGS} info $pkg | grep ^Depends) ; do
42 echo "$pkg OPP $depends;" | grep -v "(" | grep -v ")" | grep -v "$pkg OPP Depends" | sed -e 's:,::g' -e 's:-:_:g' -e 's:\.:_:g' -e 's:+::g' |sed 's:OPP:->:g' >> ${TESTLAB_DIR}/depends.dot
43 done
44
45 for recommends in $(opkg-cl ${IPKG_ARGS} info $pkg | grep ^Recom) ; do
46 echo "$pkg OPP $recommends [style=dotted];" | grep -v "(" | grep -v ")" | grep -v "$pkg OPP Recom" | sed -e 's:,::g' -e 's:-:_:g' -e 's:\.:_:g' -e 's:+::g' |sed 's:OPP:->:g' >> ${TESTLAB_DIR}/depends.dot
47 done
48 done
49
50 echo "}" >> ${TESTLAB_DIR}/depends.dot
51 rm -rf ${IPKG_TMP_DIR}
52
53 grep -v kernel_2 ${TESTLAB_DIR}/depends.dot | grep -v kernel_image > ${TESTLAB_DIR}/depends-nokernel.dot
54 grep -v libc6 ${TESTLAB_DIR}/depends-nokernel.dot | grep -v libgcc > ${TESTLAB_DIR}/depends-nokernel-nolibc.dot
55 grep -v update_ ${TESTLAB_DIR}/depends-nokernel-nolibc.dot > ${TESTLAB_DIR}/depends-nokernel-nolibc-noupdate.dot
56 grep -v kernel_module ${TESTLAB_DIR}/depends-nokernel-nolibc-noupdate.dot > ${TESTLAB_DIR}/depends-nokernel-nolibc-noupdate-nomodules.dot
57
58 #dot has some library troubles when run under fakeroot, uncomment at your own risk
59 #dot -Tpng -o ${TESTLAB_DIR}/image-dependencies.png ${TESTLAB_DIR}/depends.dot
60 #dot -Tpng -o ${TESTLAB_DIR}/image-dependencies-nokernel-nolibc.png ${TESTLAB_DIR}/depends-nokernel-nolibc.dot
61 #dot -Tpng -o ${TESTLAB_DIR}/image-dependencies-nokernel-nolibc-noupdate.png ${TESTLAB_DIR}/depends-nokernel-nolibc-noupdate.dot
62 #dot -Tpng -o ${TESTLAB_DIR}/image-dependencies-nokernel-nolibc-noupdate-nomodules.png ${TESTLAB_DIR}/depends-nokernel-nolibc-noupdate-nomodules.dot
63
64 for file in $(cat ${TESTLAB_DIR}/installed-packages.txt) ; do
65 du -k $(find ${DEPLOY_DIR_IPK} -name "$file") | head -n1
66 done | grep "\.ipk" | sed -e s:${DEPLOY_DIR_IPK}::g | sort -n -r | awk '{print $1 "\tKiB " $2}' > ${TESTLAB_DIR}/installed-package-sizes.txt
67
68 # Log results to a git controlled directory structure than can be pushed to a remote location
69 if [ "${TESTLABLOG}" = "remote" ] && [ -n "${TESTLABREMOTEDIR}" ] ; then
70 TESTLABLOGDIR="${MACHINE_ARCH}/${IMAGE_BASENAME}"
71 mkdir -p ${TESTLABREMOTEDIR}/${TESTLABLOGDIR}
72 cp ${TESTLAB_DIR}/*package* ${TESTLAB_DIR}/depends.dot ${TESTLABREMOTEDIR}/${TESTLABLOGDIR}
73 # force change to record builds where the testlab contents didn't change, but other things (e.g. git rev) did
74 echo "${MACHINE}: ${IMAGE_BASENAME} configured for ${DISTRO} ${DISTRO_VERSION} using branch ${METADATA_BRANCH} and revision ${METADATA_REVISION} " > ${TESTLABREMOTEDIR}/${TESTLABLOGDIR}/build-id
75 # This runs inside fakeroot, so the git author is listed as root (or whatever root configured it to be) :(
76 ( cd ${TESTLABREMOTEDIR}/
77 git add ${TESTLABLOGDIR}/*
78 git commit ${TESTLABLOGDIR}/ -m "${MACHINE}: ${IMAGE_BASENAME} configured for ${DISTRO} ${DISTRO_VERSION} using branch ${METADATA_BRANCH} and revision ${METADATA_REVISION}" --author "testlab <testlab@${DISTRO}>" || true)
79 fi
80fi
81}
82
83IMAGE_POSTPROCESS_COMMAND += " do_testlab ;"