diff options
author | Joshua Lock <josh@linux.intel.com> | 2010-10-08 16:56:51 +0100 |
---|---|---|
committer | Saul Wold <sgw@linux.intel.com> | 2010-11-14 21:08:27 -0800 |
commit | d77e755574f79065540c3417213d9fe8cffbe0a8 (patch) | |
tree | 0dee1eb82875254317e6a24ceea3faf45c45d6ef /meta | |
parent | 954513057655afe50616f9d206ba69912208b6d4 (diff) | |
download | poky-d77e755574f79065540c3417213d9fe8cffbe0a8.tar.gz |
image-swab: introduce a class for generating swabber reports
Add a postprocess command to rootfs generation which generates a swabber
report.
Signed-off-by: Joshua Lock <josh@linux.intel.com>
Diffstat (limited to 'meta')
-rw-r--r-- | meta/classes/image-swab.bbclass | 83 | ||||
-rw-r--r-- | meta/conf/local.conf.sample | 1 |
2 files changed, 84 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 @@ | |||
1 | HOST_DATA ?= "${TMPDIR}/host-contamination-data/" | ||
2 | SWABBER_REPORT ?= "${LOG_DIR}/swabber/" | ||
3 | SWABBER_LOGS ?= "${LOG_DIR}/contamination-logs" | ||
4 | TRACE_LOGDIR ?= "${SWABBER_LOGS}/${PACKAGE_ARCH}" | ||
5 | export TRACE_LOGFILE = "${TRACE_LOGDIR}/${PN}-${PV}" | ||
6 | |||
7 | SWAB_ORIG_TASK := "${BB_DEFAULT_TASK}" | ||
8 | BB_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 | ||
13 | PARALLEL_MAKE_pn-openssl = "" | ||
14 | PARALLEL_MAKE_pn-eglibc = "" | ||
15 | PARALLEL_MAKE_pn-glib-2.0 = "" | ||
16 | PARALLEL_MAKE_pn-libxml2 = "" | ||
17 | PARALLEL_MAKE_pn-readline = "" | ||
18 | PARALLEL_MAKE_pn-util-linux = "" | ||
19 | PARALLEL_MAKE_pn-binutils = "" | ||
20 | PARALLEL_MAKE_pn-bison = "" | ||
21 | PARALLEL_MAKE_pn-cmake = "" | ||
22 | PARALLEL_MAKE_pn-elfutils = "" | ||
23 | PARALLEL_MAKE_pn-gcc = "" | ||
24 | PARALLEL_MAKE_pn-gcc-runtime = "" | ||
25 | PARALLEL_MAKE_pn-m4 = "" | ||
26 | PARALLEL_MAKE_pn-opkg = "" | ||
27 | PARALLEL_MAKE_pn-pkgconfig = "" | ||
28 | PARALLEL_MAKE_pn-prelink = "" | ||
29 | PARALLEL_MAKE_pn-qemugl = "" | ||
30 | PARALLEL_MAKE_pn-rpm = "" | ||
31 | PARALLEL_MAKE_pn-tcl = "" | ||
32 | PARALLEL_MAKE_pn-beecrypt = "" | ||
33 | PARALLEL_MAKE_pn-curl = "" | ||
34 | PARALELL_MAKE_pn-gmp = "" | ||
35 | PARALLEL_MAKE_pn-libmpc = "" | ||
36 | PARALLEL_MAKE_pn-libxslt = "" | ||
37 | PARALLEL_MAKE_pn-lzo = "" | ||
38 | PARALLEL_MAKE_pn-popt = "" | ||
39 | PARALLEL_MAKE_pn-linux-wrs = "" | ||
40 | PARALLEL_MAKE_pn-libgcrypt = "" | ||
41 | PARALLEL_MAKE_pn-gpgme = "" | ||
42 | PARALLEL_MAKE_pn-udev = "" | ||
43 | PARALLEL_MAKE_pn-gnutls = "" | ||
44 | PARALLEL_MAKE_pn-sat-solver = "" | ||
45 | PARALLEL_MAKE_pn-libzypp = "" | ||
46 | PARALLEL_MAKE_pn-zypper = "" | ||
47 | |||
48 | python() { | ||
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 | |||
62 | do_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 | } | ||
82 | addtask generate_swabber_report after do_${SWAB_ORIG_TASK} | ||
83 | do_generate_swabber_report[depends] = "swabber-native:do_populate_sysroot" | ||
diff --git a/meta/conf/local.conf.sample b/meta/conf/local.conf.sample index a2e1374118..fae949c56b 100644 --- a/meta/conf/local.conf.sample +++ b/meta/conf/local.conf.sample | |||
@@ -79,6 +79,7 @@ PACKAGE_CLASSES ?= "package_rpm package_ipk" | |||
79 | 79 | ||
80 | # A list of additional classes to use when building the system | 80 | # A list of additional classes to use when building the system |
81 | # include 'image-prelink' in order to prelink the filesystem image | 81 | # include 'image-prelink' in order to prelink the filesystem image |
82 | # include 'image-swab' to perform host system intrusion detection | ||
82 | USER_CLASSES ?= "image-prelink" | 83 | USER_CLASSES ?= "image-prelink" |
83 | 84 | ||
84 | # POKYMODE controls the characteristics of the generated packages/images by | 85 | # POKYMODE controls the characteristics of the generated packages/images by |