diff options
-rwxr-xr-x | scripts/sstate-diff-machines.sh | 107 |
1 files changed, 107 insertions, 0 deletions
diff --git a/scripts/sstate-diff-machines.sh b/scripts/sstate-diff-machines.sh new file mode 100755 index 0000000000..931f9d7c00 --- /dev/null +++ b/scripts/sstate-diff-machines.sh | |||
@@ -0,0 +1,107 @@ | |||
1 | #!/bin/sh | ||
2 | |||
3 | # Used to compare sstate checksums between MACHINES | ||
4 | # Execute script and compare generated list.M files | ||
5 | |||
6 | # It's also usefull to keep older sstate checksums | ||
7 | # to be able to find out why something is rebuilding | ||
8 | # after updating metadata | ||
9 | |||
10 | # $ diff \ | ||
11 | # sstate-diff/1349348392/fake-cortexa8/list.M \ | ||
12 | # sstate-diff/1349348392/fake-cortexa9/list.M \ | ||
13 | # | wc -l | ||
14 | # 538 | ||
15 | |||
16 | # Then to compare sigdata use something like: | ||
17 | # $ ls sstate-diff/1349348392/*/armv7a-vfp-neon*/linux-libc-headers/*do_configure*sigdata* | ||
18 | # sstate-diff/1349348392/fake-cortexa8/armv7a-vfp-neon-oe-linux-gnueabi/linux-libc-headers/3.4.3-r0.do_configure.sigdata.cb73b3630a7b8191e72fc469c5137025 | ||
19 | # sstate-diff/1349348392/fake-cortexa9/armv7a-vfp-neon-oe-linux-gnueabi/linux-libc-headers/3.4.3-r0.do_configure.sigdata.f37ada177bf99ce8af85914df22b5a0b | ||
20 | # $ bitbake-diffsigs stamps.1349348392/*/armv7a-vfp-neon*/linux-libc-headers/*do_configure*sigdata* | ||
21 | # basehash changed from 8d0bd67bb1da6f68717760fc3ef43171 to e869fa61426e88e9c30726ba88a1216a | ||
22 | # Variable TUNE_CCARGS value changed from -march=armv7-a -mthumb-interwork -mfloat-abi=softfp -mfpu=neon -mtune=cortex-a8 to -march=armv7-a -mthumb-interwork -mfloat-abi=softfp -mfpu=neon -mtune=cortex-a9 | ||
23 | |||
24 | # Global vars | ||
25 | tmpdir= | ||
26 | machines= | ||
27 | targets= | ||
28 | default_machines="qemuarm qemux86 qemux86-64" | ||
29 | default_targets="core-image-base" | ||
30 | |||
31 | usage () { | ||
32 | cat << EOF | ||
33 | Welcome to utility to compare sstate checksums between different MACHINEs. | ||
34 | $0 <OPTION> | ||
35 | |||
36 | Options: | ||
37 | -h, --help | ||
38 | Display this help and exit. | ||
39 | |||
40 | --tmpdir=<tmpdir> | ||
41 | Specify tmpdir, will use the environment variable TMPDIR if it is not specified. | ||
42 | Something like /OE/oe-core/tmp-eglibc (no / at the end). | ||
43 | |||
44 | --machines=<machines> | ||
45 | List of MACHINEs separated by space, will use the environment variable MACHINES if it is not specified. | ||
46 | Default value is "qemuarm qemux86 qemux86-64". | ||
47 | |||
48 | --targets=<targets> | ||
49 | List of targets separated by space, will use the environment variable TARGETS if it is not specified. | ||
50 | Default value is "core-image-base". | ||
51 | EOF | ||
52 | } | ||
53 | |||
54 | # Print error information and exit. | ||
55 | echo_error () { | ||
56 | echo "ERROR: $1" >&2 | ||
57 | exit 1 | ||
58 | } | ||
59 | |||
60 | while [ -n "$1" ]; do | ||
61 | case $1 in | ||
62 | --tmpdir=*) | ||
63 | tmpdir=`echo $1 | sed -e 's#^--tmpdir=##' | xargs readlink -e` | ||
64 | [ -d "$tmpdir" ] || echo_error "Invalid argument to --tmpdir" | ||
65 | shift | ||
66 | ;; | ||
67 | --machines=*) | ||
68 | machines=`echo $1 | sed -e 's#^--machines="*\([^"]*\)"*#\1#'` | ||
69 | shift | ||
70 | ;; | ||
71 | --targets=*) | ||
72 | targets=`echo $1 | sed -e 's#^--targets="*\([^"]*\)"*#\1#'` | ||
73 | shift | ||
74 | ;; | ||
75 | --help|-h) | ||
76 | usage | ||
77 | exit 0 | ||
78 | ;; | ||
79 | *) | ||
80 | echo "Invalid arguments $*" | ||
81 | echo_error "Try '$0 -h' for more information." | ||
82 | ;; | ||
83 | esac | ||
84 | done | ||
85 | |||
86 | # tmpdir directory, use environment variable TMPDIR | ||
87 | # if it was not specified, otherwise, error. | ||
88 | [ -n "$tmpdir" ] || tmpdir=$TMPDIR | ||
89 | [ -n "$tmpdir" ] || echo_error "No tmpdir found!" | ||
90 | [ -d "$tmpdir" ] || echo_error "Invalid tmpdir \"$tmpdir\"" | ||
91 | [ -n "$machines" ] || machines=$MACHINES | ||
92 | [ -n "$machines" ] || machines=$default_machines | ||
93 | [ -n "$targets" ] || targets=$TARGETS | ||
94 | [ -n "$targets" ] || targets=$default_targets | ||
95 | |||
96 | OUTPUT=${tmpdir}/sstate-diff/`date "+%s"` | ||
97 | |||
98 | for M in ${machines}; do | ||
99 | find ${tmpdir}/stamps/ -name \*sigdata\* | xargs rm -f | ||
100 | mkdir -p ${OUTPUT}/${M} | ||
101 | export MACHINE=${M}; bitbake -S ${targets} | tee -a ${OUTPUT}/${M}/log; | ||
102 | cp -ra ${tmpdir}/stamps/* ${OUTPUT}/${M} | ||
103 | find ${OUTPUT}/${M} -name \*sigdata\* | sed "s#${OUTPUT}/${M}/##g" | sort > ${OUTPUT}/${M}/list | ||
104 | M_UNDERSCORE=`echo ${M} | sed 's/-/_/g'` | ||
105 | sed "s/${M_UNDERSCORE}/MACHINE/g; s/${M}/MACHINE/g" ${OUTPUT}/${M}/list | sort > ${OUTPUT}/${M}/list.M | ||
106 | find ${tmpdir}/stamps/ -name \*sigdata\* | xargs rm -f | ||
107 | done | ||