diff options
Diffstat (limited to 'scripts/sstate-cache-management.sh')
-rwxr-xr-x | scripts/sstate-cache-management.sh | 49 |
1 files changed, 33 insertions, 16 deletions
diff --git a/scripts/sstate-cache-management.sh b/scripts/sstate-cache-management.sh index 035bb25f89..0d71bfe622 100755 --- a/scripts/sstate-cache-management.sh +++ b/scripts/sstate-cache-management.sh | |||
@@ -37,13 +37,19 @@ Options: | |||
37 | Specify sstate cache directory, will use the environment | 37 | Specify sstate cache directory, will use the environment |
38 | variable SSTATE_CACHE_DIR if it is not specified. | 38 | variable SSTATE_CACHE_DIR if it is not specified. |
39 | 39 | ||
40 | --extra-archs=<arch1>,<arch2>...<archn> | ||
41 | Specify list of architectures which should be tested, this list | ||
42 | will be extended with native arch, allarch and empty arch. The | ||
43 | script won't be trying to generate list of available archs from | ||
44 | AVAILTUNES in tune files. | ||
45 | |||
40 | --extra-layer=<layer1>,<layer2>...<layern> | 46 | --extra-layer=<layer1>,<layer2>...<layern> |
41 | Specify the layer which will be used for searching the archs, | 47 | Specify the layer which will be used for searching the archs, |
42 | it will search the meta and meta-* layers in the top dir by | 48 | it will search the meta and meta-* layers in the top dir by |
43 | default, and will search meta, meta-*, <layer1>, <layer2>, | 49 | default, and will search meta, meta-*, <layer1>, <layer2>, |
44 | ...<layern> when specified. Use "," as the separator. | 50 | ...<layern> when specified. Use "," as the separator. |
45 | 51 | ||
46 | This is useless for --stamps-dir. | 52 | This is useless for --stamps-dir or when --extra-archs is used. |
47 | 53 | ||
48 | -d, --remove-duplicated | 54 | -d, --remove-duplicated |
49 | Remove the duplicated sstate cache files of one package, only | 55 | Remove the duplicated sstate cache files of one package, only |
@@ -170,20 +176,23 @@ remove_duplicated () { | |||
170 | local fn_tmp | 176 | local fn_tmp |
171 | local list_suffix=`mktemp` || exit 1 | 177 | local list_suffix=`mktemp` || exit 1 |
172 | 178 | ||
173 | # Find out the archs in all the layers | 179 | if [ -z "$extra_archs" ] ; then |
174 | echo -n "Figuring out the archs in the layers ... " | 180 | # Find out the archs in all the layers |
175 | oe_core_dir=$(dirname $(dirname $(readlink -e $0))) | 181 | echo -n "Figuring out the archs in the layers ... " |
176 | topdir=$(dirname $oe_core_dir) | 182 | oe_core_dir=$(dirname $(dirname $(readlink -e $0))) |
177 | tunedirs="`find $topdir/meta* ${oe_core_dir}/meta* $layers -path '*/meta*/conf/machine/include' 2>/dev/null`" | 183 | topdir=$(dirname $oe_core_dir) |
178 | [ -n "$tunedirs" ] || echo_error "Can't find the tune directory" | 184 | tunedirs="`find $topdir/meta* ${oe_core_dir}/meta* $layers -path '*/meta*/conf/machine/include' 2>/dev/null`" |
179 | all_machines="`find $topdir/meta* ${oe_core_dir}/meta* $layers -path '*/meta*/conf/machine/*' -name '*.conf' 2>/dev/null | sed -e 's/.*\///' -e 's/.conf$//'`" | 185 | [ -n "$tunedirs" ] || echo_error "Can't find the tune directory" |
180 | all_archs=`grep -r -h "^AVAILTUNES .*=" $tunedirs | sed -e 's/.*=//' -e 's/\"//g'` | 186 | all_machines="`find $topdir/meta* ${oe_core_dir}/meta* $layers -path '*/meta*/conf/machine/*' -name '*.conf' 2>/dev/null | sed -e 's/.*\///' -e 's/.conf$//'`" |
181 | # Add the qemu and native archs | 187 | all_archs=`grep -r -h "^AVAILTUNES .*=" $tunedirs | sed -e 's/.*=//' -e 's/\"//g'` |
182 | # Use the "_" to substitute "-", e.g., x86-64 to x86_64 | 188 | fi |
189 | |||
190 | # Use the "_" to substitute "-", e.g., x86-64 to x86_64, but not for extra_archs which can be something like cortexa9t2-vfp-neon | ||
183 | # Sort to remove the duplicated ones | 191 | # Sort to remove the duplicated ones |
184 | # Add allarch | 192 | # Add allarch and builder arch (native) |
185 | all_archs=$(echo allarch $all_archs $all_machines $(uname -m) \ | 193 | builder_arch=$(uname -m) |
186 | | sed -e 's/-/_/g' -e 's/ /\n/g' | sort -u) | 194 | all_archs="$(echo allarch $all_archs $all_machines $builder_arch \ |
195 | | sed -e 's/-/_/g' -e 's/ /\n/g' | sort -u) $extra_archs" | ||
187 | echo "Done" | 196 | echo "Done" |
188 | 197 | ||
189 | # Total number of files including sstate-, sigdata and .done files | 198 | # Total number of files including sstate-, sigdata and .done files |
@@ -204,6 +213,9 @@ remove_duplicated () { | |||
204 | for arch in $all_archs; do | 213 | for arch in $all_archs; do |
205 | grep -q ".*/sstate:[^:]*:[^:]*:[^:]*:[^:]*:$arch:[^:]*:[^:]*\.tgz$" $sstate_list | 214 | grep -q ".*/sstate:[^:]*:[^:]*:[^:]*:[^:]*:$arch:[^:]*:[^:]*\.tgz$" $sstate_list |
206 | [ $? -eq 0 ] && ava_archs="$ava_archs $arch" | 215 | [ $? -eq 0 ] && ava_archs="$ava_archs $arch" |
216 | # ${builder_arch}_$arch used by toolchain sstate | ||
217 | grep -q ".*/sstate:[^:]*:[^:]*:[^:]*:[^:]*:${builder_arch}_$arch:[^:]*:[^:]*\.tgz$" $sstate_list | ||
218 | [ $? -eq 0 ] && ava_archs="$ava_archs ${builder_arch}_$arch" | ||
207 | done | 219 | done |
208 | echo "Done" | 220 | echo "Done" |
209 | echo "The following archs have been found in the cache dir:" | 221 | echo "The following archs have been found in the cache dir:" |
@@ -229,7 +241,7 @@ remove_duplicated () { | |||
229 | rm_list="$remove_listdir/sstate:xxx_$suffix" | 241 | rm_list="$remove_listdir/sstate:xxx_$suffix" |
230 | for fn in $file_names; do | 242 | for fn in $file_names; do |
231 | [ -z "$verbose" ] || echo "Analyzing sstate:$fn-xxx_$suffix.tgz" | 243 | [ -z "$verbose" ] || echo "Analyzing sstate:$fn-xxx_$suffix.tgz" |
232 | for arch in $ava_archs; do | 244 | for arch in $ava_archs ""; do |
233 | grep -h ".*/sstate:$fn:[^:]*:[^:]*:[^:]*:$arch:[^:]*:[^:]*\.tgz$" $list_suffix >$fn_tmp | 245 | grep -h ".*/sstate:$fn:[^:]*:[^:]*:[^:]*:$arch:[^:]*:[^:]*\.tgz$" $list_suffix >$fn_tmp |
234 | if [ -s $fn_tmp ] ; then | 246 | if [ -s $fn_tmp ] ; then |
235 | [ $debug -gt 1 ] && echo "Available files for $fn-$arch- with suffix $suffix:" && cat $fn_tmp | 247 | [ $debug -gt 1 ] && echo "Available files for $fn-$arch- with suffix $suffix:" && cat $fn_tmp |
@@ -384,9 +396,14 @@ while [ -n "$1" ]; do | |||
384 | fsym="y" | 396 | fsym="y" |
385 | shift | 397 | shift |
386 | ;; | 398 | ;; |
399 | --extra-archs=*) | ||
400 | extra_archs=`echo $1 | sed -e 's#^--extra-archs=##' -e 's#,# #g'` | ||
401 | [ -n "$extra_archs" ] || echo_error "Invalid extra arch parameter" | ||
402 | shift | ||
403 | ;; | ||
387 | --extra-layer=*) | 404 | --extra-layer=*) |
388 | extra_layers=`echo $1 | sed -e 's#^--extra-layer=##' -e 's#,# #g'` | 405 | extra_layers=`echo $1 | sed -e 's#^--extra-layer=##' -e 's#,# #g'` |
389 | [ -n "$extra_layers" ] || echo_error "Invalid extra layer $i" | 406 | [ -n "$extra_layers" ] || echo_error "Invalid extra layer parameter" |
390 | for i in $extra_layers; do | 407 | for i in $extra_layers; do |
391 | l=`readlink -e $i` | 408 | l=`readlink -e $i` |
392 | if [ -d "$l" ]; then | 409 | if [ -d "$l" ]; then |