diff options
| author | Martin Jansa <martin.jansa@gmail.com> | 2012-09-03 17:05:07 +0200 |
|---|---|---|
| committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2012-09-04 12:53:09 +0100 |
| commit | 40b14022db6012ea911566a679c178ffd619259f (patch) | |
| tree | 570569516e72a7a2b59a152b96365bdc757ac0bd /scripts | |
| parent | 40d2cbe480142e8cde40b54388d4e6ea278dcfe4 (diff) | |
| download | poky-40b14022db6012ea911566a679c178ffd619259f.tar.gz | |
sstate-cache-management.sh: add option to enable debug output
(From OE-Core rev: 97a6b51c776bbcde14101834fdf9e1d19ae19185)
Signed-off-by: Martin Jansa <Martin.Jansa@gmail.com>
Signed-off-by: Saul Wold <sgw@linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'scripts')
| -rwxr-xr-x | scripts/sstate-cache-management.sh | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/scripts/sstate-cache-management.sh b/scripts/sstate-cache-management.sh index 491df5f3fe..0cfff77b18 100755 --- a/scripts/sstate-cache-management.sh +++ b/scripts/sstate-cache-management.sh | |||
| @@ -22,6 +22,7 @@ confirm= | |||
| 22 | fsym= | 22 | fsym= |
| 23 | total_deleted=0 | 23 | total_deleted=0 |
| 24 | verbose= | 24 | verbose= |
| 25 | debug=0 | ||
| 25 | 26 | ||
| 26 | usage () { | 27 | usage () { |
| 27 | cat << EOF | 28 | cat << EOF |
| @@ -69,6 +70,9 @@ Options: | |||
| 69 | -v, --verbose | 70 | -v, --verbose |
| 70 | explain what is being done | 71 | explain what is being done |
| 71 | 72 | ||
| 73 | -d, --debug | ||
| 74 | show debug info, repeat for more debug info | ||
| 75 | |||
| 72 | EOF | 76 | EOF |
| 73 | } | 77 | } |
| 74 | 78 | ||
| @@ -215,13 +219,16 @@ remove_duplicated () { | |||
| 215 | for arch in $ava_archs; do | 219 | for arch in $ava_archs; do |
| 216 | grep -h "/$fn-$arch-" $list_suffix >>$fn_tmp | 220 | grep -h "/$fn-$arch-" $list_suffix >>$fn_tmp |
| 217 | done | 221 | done |
| 222 | [ $debug -gt 1 ] && echo "Available files for $fn with suffix $suffix:" && cat $fn_tmp | ||
| 218 | # Use the modification time | 223 | # Use the modification time |
| 219 | to_del=$(ls -t $(cat $fn_tmp) | sed -n '1!p') | 224 | to_del=$(ls -t $(cat $fn_tmp) | sed -n '1!p') |
| 225 | [ $debug -gt 2 ] && echo "Considering to delete: $to_del" | ||
| 220 | # The sstate file which is downloaded from the SSTATE_MIRROR is | 226 | # The sstate file which is downloaded from the SSTATE_MIRROR is |
| 221 | # put in SSTATE_DIR, and there is a symlink in SSTATE_DIR/??/ to | 227 | # put in SSTATE_DIR, and there is a symlink in SSTATE_DIR/??/ to |
| 222 | # it, so filter it out from the remove list if it should not be | 228 | # it, so filter it out from the remove list if it should not be |
| 223 | # removed. | 229 | # removed. |
| 224 | to_keep=$(ls -t $(cat $fn_tmp) | sed -n '1p') | 230 | to_keep=$(ls -t $(cat $fn_tmp) | sed -n '1p') |
| 231 | [ $debug -gt 2 ] && echo "Considering to keep: $to_keep" | ||
| 225 | for k in $to_keep; do | 232 | for k in $to_keep; do |
| 226 | if [ -L "$k" ]; then | 233 | if [ -L "$k" ]; then |
| 227 | # The symlink's destination | 234 | # The symlink's destination |
| @@ -235,9 +242,11 @@ remove_duplicated () { | |||
| 235 | fi | 242 | fi |
| 236 | done | 243 | done |
| 237 | rm -f $fn_tmp | 244 | rm -f $fn_tmp |
| 245 | [ $debug -gt 2 ] && echo "Decided to delete: $to_del" | ||
| 238 | gen_rmlist $rm_list "$to_del" | 246 | gen_rmlist $rm_list "$to_del" |
| 239 | done | 247 | done |
| 240 | [ ! -s "$rm_list" ] || deleted=`cat $rm_list | wc -l` | 248 | [ ! -s "$rm_list" ] || deleted=`cat $rm_list | wc -l` |
| 249 | [ -s "$rm_list" -a $debug -gt 0 ] && cat $rm_list | ||
| 241 | echo "($deleted files will be removed)" | 250 | echo "($deleted files will be removed)" |
| 242 | let total_deleted=$total_deleted+$deleted | 251 | let total_deleted=$total_deleted+$deleted |
| 243 | done | 252 | done |
| @@ -306,6 +315,7 @@ rm_by_stamps (){ | |||
| 306 | gen_rmlist $rm_list "$to_del" | 315 | gen_rmlist $rm_list "$to_del" |
| 307 | let total_deleted=(`cat $rm_list | wc -w`) | 316 | let total_deleted=(`cat $rm_list | wc -w`) |
| 308 | if [ $total_deleted -gt 0 ]; then | 317 | if [ $total_deleted -gt 0 ]; then |
| 318 | [ $debug -gt 0 ] && cat $rm_list | ||
| 309 | read_confirm | 319 | read_confirm |
| 310 | if [ "$confirm" = "y" -o "$confirm" = "Y" ]; then | 320 | if [ "$confirm" = "y" -o "$confirm" = "Y" ]; then |
| 311 | echo "Removing sstate cache files ... ($total_deleted files)" | 321 | echo "Removing sstate cache files ... ($total_deleted files)" |
| @@ -374,6 +384,11 @@ while [ -n "$1" ]; do | |||
| 374 | verbose="-v" | 384 | verbose="-v" |
| 375 | shift | 385 | shift |
| 376 | ;; | 386 | ;; |
| 387 | --debug) | ||
| 388 | debug=`expr $debug + 1` | ||
| 389 | echo "Debug level $debug" | ||
| 390 | shift | ||
| 391 | ;; | ||
| 377 | --help|-h) | 392 | --help|-h) |
| 378 | usage | 393 | usage |
| 379 | exit 0 | 394 | exit 0 |
