summaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
authorMartin Jansa <martin.jansa@gmail.com>2012-09-03 17:05:07 +0200
committerSaul Wold <sgw@linux.intel.com>2012-09-03 22:52:56 -0700
commit97a6b51c776bbcde14101834fdf9e1d19ae19185 (patch)
tree391e4bb24bffc3bc77c4d0bd215b98a2b4d97c3b /scripts
parentfb6d838b1b80f26e9261acfd3893a7ef7f9e1940 (diff)
downloadopenembedded-core-97a6b51c776bbcde14101834fdf9e1d19ae19185.tar.gz
openembedded-core-97a6b51c776bbcde14101834fdf9e1d19ae19185.tar.bz2
openembedded-core-97a6b51c776bbcde14101834fdf9e1d19ae19185.zip
sstate-cache-management.sh: add option to enable debug output
Signed-off-by: Martin Jansa <Martin.Jansa@gmail.com> Signed-off-by: Saul Wold <sgw@linux.intel.com>
Diffstat (limited to 'scripts')
-rwxr-xr-xscripts/sstate-cache-management.sh15
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=
fsym=
total_deleted=0
verbose=
+debug=0
usage () {
cat << EOF
@@ -69,6 +70,9 @@ Options:
-v, --verbose
explain what is being done
+ -d, --debug
+ show debug info, repeat for more debug info
+
EOF
}
@@ -215,13 +219,16 @@ remove_duplicated () {
for arch in $ava_archs; do
grep -h "/$fn-$arch-" $list_suffix >>$fn_tmp
done
+ [ $debug -gt 1 ] && echo "Available files for $fn with suffix $suffix:" && cat $fn_tmp
# Use the modification time
to_del=$(ls -t $(cat $fn_tmp) | sed -n '1!p')
+ [ $debug -gt 2 ] && echo "Considering to delete: $to_del"
# The sstate file which is downloaded from the SSTATE_MIRROR is
# put in SSTATE_DIR, and there is a symlink in SSTATE_DIR/??/ to
# it, so filter it out from the remove list if it should not be
# removed.
to_keep=$(ls -t $(cat $fn_tmp) | sed -n '1p')
+ [ $debug -gt 2 ] && echo "Considering to keep: $to_keep"
for k in $to_keep; do
if [ -L "$k" ]; then
# The symlink's destination
@@ -235,9 +242,11 @@ remove_duplicated () {
fi
done
rm -f $fn_tmp
+ [ $debug -gt 2 ] && echo "Decided to delete: $to_del"
gen_rmlist $rm_list "$to_del"
done
[ ! -s "$rm_list" ] || deleted=`cat $rm_list | wc -l`
+ [ -s "$rm_list" -a $debug -gt 0 ] && cat $rm_list
echo "($deleted files will be removed)"
let total_deleted=$total_deleted+$deleted
done
@@ -306,6 +315,7 @@ rm_by_stamps (){
gen_rmlist $rm_list "$to_del"
let total_deleted=(`cat $rm_list | wc -w`)
if [ $total_deleted -gt 0 ]; then
+ [ $debug -gt 0 ] && cat $rm_list
read_confirm
if [ "$confirm" = "y" -o "$confirm" = "Y" ]; then
echo "Removing sstate cache files ... ($total_deleted files)"
@@ -374,6 +384,11 @@ while [ -n "$1" ]; do
verbose="-v"
shift
;;
+ --debug)
+ debug=`expr $debug + 1`
+ echo "Debug level $debug"
+ shift
+ ;;
--help|-h)
usage
exit 0