diff options
author | Martin Jansa <martin.jansa@gmail.com> | 2014-01-29 22:03:41 +0100 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2014-02-02 11:30:34 +0000 |
commit | 6d295ce0c5d2117b14e93626aff0f7c9364d337d (patch) | |
tree | 260e9e53152c27ef15085fce77419e64b8aab465 /scripts/sstate-cache-management.sh | |
parent | a397dec90bf968e281f9135e9e0683c1cb19b91c (diff) | |
download | poky-6d295ce0c5d2117b14e93626aff0f7c9364d337d.tar.gz |
sstate-cache-management.sh: Show total number of files when showing how many will be deleted
* it's good to see some the ratio of delted files until now it was
showing only when all or none files were to be removed
(From OE-Core rev: 54e6e25f1a369fa6c21ce0f9db3479b1a481825f)
Signed-off-by: Martin Jansa <Martin.Jansa@gmail.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'scripts/sstate-cache-management.sh')
-rwxr-xr-x | scripts/sstate-cache-management.sh | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/scripts/sstate-cache-management.sh b/scripts/sstate-cache-management.sh index 30ba8c6241..035bb25f89 100755 --- a/scripts/sstate-cache-management.sh +++ b/scripts/sstate-cache-management.sh | |||
@@ -95,7 +95,7 @@ do_nothing () { | |||
95 | 95 | ||
96 | # Read the input "y" | 96 | # Read the input "y" |
97 | read_confirm () { | 97 | read_confirm () { |
98 | echo -n "$total_deleted files will be removed! " | 98 | echo -n "$total_deleted from $total_files files will be removed! " |
99 | if [ "$confirm" != "y" ]; then | 99 | if [ "$confirm" != "y" ]; then |
100 | echo -n "Do you want to continue (y/n)? " | 100 | echo -n "Do you want to continue (y/n)? " |
101 | while read confirm; do | 101 | while read confirm; do |
@@ -186,6 +186,8 @@ remove_duplicated () { | |||
186 | | sed -e 's/-/_/g' -e 's/ /\n/g' | sort -u) | 186 | | sed -e 's/-/_/g' -e 's/ /\n/g' | sort -u) |
187 | echo "Done" | 187 | echo "Done" |
188 | 188 | ||
189 | # Total number of files including sstate-, sigdata and .done files | ||
190 | total_files=`find $cache_dir -name 'sstate*' | wc -l` | ||
189 | # Save all the sstate files in a file | 191 | # Save all the sstate files in a file |
190 | sstate_list=`mktemp` || exit 1 | 192 | sstate_list=`mktemp` || exit 1 |
191 | find $cache_dir -name 'sstate:*:*:*:*:*:*:*.tgz' >$sstate_list | 193 | find $cache_dir -name 'sstate:*:*:*:*:*:*:*.tgz' >$sstate_list |
@@ -212,6 +214,8 @@ remove_duplicated () { | |||
212 | local remove_listdir=`mktemp -d` || exit 1 | 214 | local remove_listdir=`mktemp -d` || exit 1 |
213 | 215 | ||
214 | for suffix in $sstate_suffixes; do | 216 | for suffix in $sstate_suffixes; do |
217 | # Total number of files including sigdata and .done files | ||
218 | total_files_suffix=`grep ".*/sstate:[^:]*:[^:]*:[^:]*:[^:]*:[^:]*:[^:]*:[^:_]*_$suffix.*" $sstate_list | wc -l 2>/dev/null` | ||
215 | # Save the file list to a file, some suffix's file may not exist | 219 | # Save the file list to a file, some suffix's file may not exist |
216 | grep ".*/sstate:[^:]*:[^:]*:[^:]*:[^:]*:[^:]*:[^:]*:[^:_]*_$suffix.tgz" $sstate_list >$list_suffix 2>/dev/null | 220 | grep ".*/sstate:[^:]*:[^:]*:[^:]*:[^:]*:[^:]*:[^:]*:[^:_]*_$suffix.tgz" $sstate_list >$list_suffix 2>/dev/null |
217 | local deleted=0 | 221 | local deleted=0 |
@@ -258,7 +262,7 @@ remove_duplicated () { | |||
258 | done | 262 | done |
259 | [ ! -s "$rm_list" ] || deleted=`cat $rm_list | wc -l` | 263 | [ ! -s "$rm_list" ] || deleted=`cat $rm_list | wc -l` |
260 | [ -s "$rm_list" -a $debug -gt 0 ] && cat $rm_list | 264 | [ -s "$rm_list" -a $debug -gt 0 ] && cat $rm_list |
261 | echo "($deleted files will be removed)" | 265 | echo "($deleted from $total_files_suffix files for $suffix suffix will be removed)" |
262 | let total_deleted=$total_deleted+$deleted | 266 | let total_deleted=$total_deleted+$deleted |
263 | done | 267 | done |
264 | deleted=0 | 268 | deleted=0 |
@@ -319,6 +323,8 @@ rm_by_stamps (){ | |||
319 | done | 323 | done |
320 | echo "Done" | 324 | echo "Done" |
321 | 325 | ||
326 | # Total number of files including sstate-, sigdata and .done files | ||
327 | total_files=`find $cache_dir -name 'sstate*' | wc -l` | ||
322 | # Save all the state file list to a file | 328 | # Save all the state file list to a file |
323 | find $cache_dir -name 'sstate*.tgz' | sort -u -o $cache_list | 329 | find $cache_dir -name 'sstate*.tgz' | sort -u -o $cache_list |
324 | 330 | ||