diff options
author | Martin Jansa <martin.jansa@gmail.com> | 2012-12-15 00:40:40 +0100 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2013-01-07 12:06:27 +0000 |
commit | 6852800701be4b9d2cbc9fe4a80bd78314dcc3fa (patch) | |
tree | 3e668e818470acd8d185ad5936b1840cfcf27b4c | |
parent | 6882eb56675f3c4665710d41ceacb32614d8b80e (diff) | |
download | poky-6852800701be4b9d2cbc9fe4a80bd78314dcc3fa.tar.gz |
scripts/sstate-sysroot-cruft.sh: add simple script to find files in sysroots not tracked by sstate
(From OE-Core rev: 18bf0b4e14a74a91dff1a282c946cab37678b2fe)
Signed-off-by: Martin Jansa <Martin.Jansa@gmail.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
-rwxr-xr-x | scripts/sstate-sysroot-cruft.sh | 78 |
1 files changed, 78 insertions, 0 deletions
diff --git a/scripts/sstate-sysroot-cruft.sh b/scripts/sstate-sysroot-cruft.sh new file mode 100755 index 0000000000..ca2316cdcc --- /dev/null +++ b/scripts/sstate-sysroot-cruft.sh | |||
@@ -0,0 +1,78 @@ | |||
1 | #!/bin/sh | ||
2 | |||
3 | # Used to find files installed in sysroot which are not tracked by sstate manifest | ||
4 | |||
5 | # Global vars | ||
6 | tmpdir= | ||
7 | |||
8 | usage () { | ||
9 | cat << EOF | ||
10 | Welcome to sysroot cruft finding utility. | ||
11 | $0 <OPTION> | ||
12 | |||
13 | Options: | ||
14 | -h, --help | ||
15 | Display this help and exit. | ||
16 | |||
17 | --tmpdir=<tmpdir> | ||
18 | Specify tmpdir, will use the environment variable TMPDIR if it is not specified. | ||
19 | Something like /OE/oe-core/tmp-eglibc (no / at the end). | ||
20 | EOF | ||
21 | } | ||
22 | |||
23 | # Print error information and exit. | ||
24 | echo_error () { | ||
25 | echo "ERROR: $1" >&2 | ||
26 | exit 1 | ||
27 | } | ||
28 | |||
29 | while [ -n "$1" ]; do | ||
30 | case $1 in | ||
31 | --tmpdir=*) | ||
32 | tmpdir=`echo $1 | sed -e 's#^--tmpdir=##' | xargs readlink -e` | ||
33 | [ -d "$tmpdir" ] || echo_error "Invalid argument to --tmpdir" | ||
34 | shift | ||
35 | ;; | ||
36 | --help|-h) | ||
37 | usage | ||
38 | exit 0 | ||
39 | ;; | ||
40 | *) | ||
41 | echo "Invalid arguments $*" | ||
42 | echo_error "Try '$0 -h' for more information." | ||
43 | ;; | ||
44 | esac | ||
45 | done | ||
46 | |||
47 | # sstate cache directory, use environment variable TMPDIR | ||
48 | # if it was not specified, otherwise, error. | ||
49 | [ -n "$tmpdir" ] || tmpdir=$TMPDIR | ||
50 | [ -n "$tmpdir" ] || echo_error "No tmpdir found!" | ||
51 | [ -d "$tmpdir" ] || echo_error "Invalid tmpdir \"$tmpdir\"" | ||
52 | |||
53 | OUTPUT=${tmpdir}/sysroot.cruft.`date "+%s"` | ||
54 | WHITELIST="\/var\/pseudo\($\|\/[^\/]*$\) \/shlibs$ \.pyc$ \.pyo$" | ||
55 | |||
56 | mkdir ${OUTPUT} | ||
57 | find ${tmpdir}/sstate-control -name \*.populate-sysroot\* -o -name \*.package\* | xargs cat | grep sysroots | \ | ||
58 | sed 's#/$##g; s#///*#/#g' | \ | ||
59 | # work around for paths ending with / for directories and multiplied // (e.g. paths to native sysroot) | ||
60 | sort > ${OUTPUT}/master.list.all | ||
61 | sort -u ${OUTPUT}/master.list.all > ${OUTPUT}/master.list # -u because some directories are listed for more recipes | ||
62 | find ${tmpdir}/sysroots/ | \ | ||
63 | sort > ${OUTPUT}/sysroot.list | ||
64 | |||
65 | diff ${OUTPUT}/master.list.all ${OUTPUT}/master.list > ${OUTPUT}/duplicates | ||
66 | diff ${OUTPUT}/master.list ${OUTPUT}/sysroot.list > ${OUTPUT}/diff.all | ||
67 | |||
68 | cp ${OUTPUT}/diff.all ${OUTPUT}/diff | ||
69 | for item in ${WHITELIST}; do | ||
70 | sed -i "/${item}/d" ${OUTPUT}/diff; | ||
71 | done | ||
72 | |||
73 | # too many false positives for directories | ||
74 | # echo "Following files are installed in sysroot at least twice" | ||
75 | # cat ${OUTPUT}/duplicates | ||
76 | |||
77 | echo "Following files are installed in sysroot, but not tracked by sstate" | ||
78 | cat ${OUTPUT}/diff | ||