summaryrefslogtreecommitdiffstats
path: root/meta/classes
diff options
context:
space:
mode:
Diffstat (limited to 'meta/classes')
-rw-r--r--meta/classes/image-swab.bbclass83
1 files changed, 83 insertions, 0 deletions
diff --git a/meta/classes/image-swab.bbclass b/meta/classes/image-swab.bbclass
new file mode 100644
index 0000000000..7dd83f8c81
--- /dev/null
+++ b/meta/classes/image-swab.bbclass
@@ -0,0 +1,83 @@
1HOST_DATA ?= "${TMPDIR}/host-contamination-data/"
2SWABBER_REPORT ?= "${LOG_DIR}/swabber/"
3SWABBER_LOGS ?= "${LOG_DIR}/contamination-logs"
4TRACE_LOGDIR ?= "${SWABBER_LOGS}/${PACKAGE_ARCH}"
5export TRACE_LOGFILE = "${TRACE_LOGDIR}/${PN}-${PV}"
6
7SWAB_ORIG_TASK := "${BB_DEFAULT_TASK}"
8BB_DEFAULT_TASK = "generate_swabber_report"
9
10# Several recipes don't build with parallel make when run under strace
11# Ideally these should be fixed but as a temporary measure disable parallel
12# builds for troublesome recipes
13PARALLEL_MAKE_pn-openssl = ""
14PARALLEL_MAKE_pn-eglibc = ""
15PARALLEL_MAKE_pn-glib-2.0 = ""
16PARALLEL_MAKE_pn-libxml2 = ""
17PARALLEL_MAKE_pn-readline = ""
18PARALLEL_MAKE_pn-util-linux = ""
19PARALLEL_MAKE_pn-binutils = ""
20PARALLEL_MAKE_pn-bison = ""
21PARALLEL_MAKE_pn-cmake = ""
22PARALLEL_MAKE_pn-elfutils = ""
23PARALLEL_MAKE_pn-gcc = ""
24PARALLEL_MAKE_pn-gcc-runtime = ""
25PARALLEL_MAKE_pn-m4 = ""
26PARALLEL_MAKE_pn-opkg = ""
27PARALLEL_MAKE_pn-pkgconfig = ""
28PARALLEL_MAKE_pn-prelink = ""
29PARALLEL_MAKE_pn-qemugl = ""
30PARALLEL_MAKE_pn-rpm = ""
31PARALLEL_MAKE_pn-tcl = ""
32PARALLEL_MAKE_pn-beecrypt = ""
33PARALLEL_MAKE_pn-curl = ""
34PARALELL_MAKE_pn-gmp = ""
35PARALLEL_MAKE_pn-libmpc = ""
36PARALLEL_MAKE_pn-libxslt = ""
37PARALLEL_MAKE_pn-lzo = ""
38PARALLEL_MAKE_pn-popt = ""
39PARALLEL_MAKE_pn-linux-wrs = ""
40PARALLEL_MAKE_pn-libgcrypt = ""
41PARALLEL_MAKE_pn-gpgme = ""
42PARALLEL_MAKE_pn-udev = ""
43PARALLEL_MAKE_pn-gnutls = ""
44PARALLEL_MAKE_pn-sat-solver = ""
45PARALLEL_MAKE_pn-libzypp = ""
46PARALLEL_MAKE_pn-zypper = ""
47
48python() {
49 # NOTE: It might be useful to detect host infection on native and cross
50 # packages but as it turns out to be pretty hard to do this for all native
51 # and cross packages which aren't swabber-native or one of its dependencies
52 # I have ignored them for now...
53 if not bb.data.inherits_class('native', d) and not bb.data.inherits_class('nativesdk', d) and not bb.data.inherits_class('cross', d):
54 deps = (bb.data.getVarFlag('do_setscene', 'depends', d) or "").split()
55 deps.append('strace-native:do_populate_sysroot')
56 bb.data.setVarFlag('do_setscene', 'depends', " ".join(deps), d)
57 logdir = bb.data.expand("${TRACE_LOGDIR}", d)
58 bb.utils.mkdirhier(logdir)
59 bb.data.setVar('BB_RUNTASK', 'bitbake-runtask-strace', d)
60}
61
62do_generate_swabber_report () {
63 echo "Updating host data"
64
65 # Ensure we have the very latest host information
66 if [ "${NOSWABBERUPDATE}" != "1" ]; then
67 update_distro ${HOST_DATA}
68 fi
69
70 # Swabber can't create the directory for us
71 mkdir -p ${SWABBER_REPORT}
72
73 REPORTSTAMP=${SWAB_ORIG_TASK}-`date +%2m%2d%2H%2M%Y`
74
75 if [ "$(ls -A ${HOST_DATA})" ]; then
76 echo "Generating swabber report"
77 swabber -d ${HOST_DATA} -l ${SWABBER_LOGS} -o ${SWABBER_REPORT}/report-${REPORTSTAMP}.txt -r ${SWABBER_REPORT}/extra_report-${REPORTSTAMP}.txt
78 else
79 echo "No host data, cannot generate swabber report."
80 fi
81}
82addtask generate_swabber_report after do_${SWAB_ORIG_TASK}
83do_generate_swabber_report[depends] = "swabber-native:do_populate_sysroot"