summaryrefslogtreecommitdiffstats
path: root/scripts
diff options
context:
space:
mode:
Diffstat (limited to 'scripts')
-rwxr-xr-xscripts/sstate-sysroot-cruft.sh78
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
6tmpdir=
7
8usage () {
9 cat << EOF
10Welcome to sysroot cruft finding utility.
11$0 <OPTION>
12
13Options:
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).
20EOF
21}
22
23# Print error information and exit.
24echo_error () {
25 echo "ERROR: $1" >&2
26 exit 1
27}
28
29while [ -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
45done
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
53OUTPUT=${tmpdir}/sysroot.cruft.`date "+%s"`
54WHITELIST="\/var\/pseudo\($\|\/[^\/]*$\) \/shlibs$ \.pyc$ \.pyo$"
55
56mkdir ${OUTPUT}
57find ${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
61sort -u ${OUTPUT}/master.list.all > ${OUTPUT}/master.list # -u because some directories are listed for more recipes
62find ${tmpdir}/sysroots/ | \
63 sort > ${OUTPUT}/sysroot.list
64
65diff ${OUTPUT}/master.list.all ${OUTPUT}/master.list > ${OUTPUT}/duplicates
66diff ${OUTPUT}/master.list ${OUTPUT}/sysroot.list > ${OUTPUT}/diff.all
67
68cp ${OUTPUT}/diff.all ${OUTPUT}/diff
69for item in ${WHITELIST}; do
70 sed -i "/${item}/d" ${OUTPUT}/diff;
71done
72
73# too many false positives for directories
74# echo "Following files are installed in sysroot at least twice"
75# cat ${OUTPUT}/duplicates
76
77echo "Following files are installed in sysroot, but not tracked by sstate"
78cat ${OUTPUT}/diff