summaryrefslogtreecommitdiffstats
path: root/scripts/sstate-cache-management.sh
diff options
context:
space:
mode:
authorMartin Jansa <martin.jansa@gmail.com>2014-03-01 21:52:01 +0100
committerRichard Purdie <richard.purdie@linuxfoundation.org>2014-03-05 15:50:19 +0000
commit99183f9c450a56f8d2fa7485902b48a993bf551c (patch)
tree1c6ae29bc9d4b928206f13641d78e9200a7652f3 /scripts/sstate-cache-management.sh
parent6bfa52afee2eb439ac049b7cf573b515cd74871e (diff)
downloadpoky-99183f9c450a56f8d2fa7485902b48a993bf551c.tar.gz
sstate-cache-management.sh: Allow to remove old .siginfo and .done files for all tasks
* this allows to remove them even for tasks without sstate archives (e.g. rm_work, multilib_install, ..) whole list of tasks found in one of my sstate-cache directories: sstate:xxx_boostconfig.tgz ... 6 sstate:xxx_bundle_initramfs.tgz ... 31 sstate:xxx_compile.tgz ... 47894 sstate:xxx_compile_kernelmodules.tgz ... 31 sstate:xxx_compile_ptest_base.tgz ... 68 sstate:xxx_configure.tgz ... 48247 sstate:xxx_configure_ptest_base.tgz ... 68 sstate:xxx_deploy.tgz ... 8 sstate:xxx_evacuate_scripts.tgz ... 58 sstate:xxx_fetch.tgz ... 7045 sstate:xxx_generate.tgz ... 812 sstate:xxx_generate_qt_config_file.tgz ... 576 sstate:xxx_generate_toolchain_file.tgz ... 219 sstate:xxx_install.tgz ... 48273 sstate:xxx_install_locale.tgz ... 58 sstate:xxx_install_ptest_base.tgz ... 68 sstate:xxx_kernel_checkout.tgz ... 14 sstate:xxx_kernel_configcheck.tgz ... 34 sstate:xxx_kernel_configme.tgz ... 17 sstate:xxx_kernel_link_vmlinux.tgz ... 30 sstate:xxx_make_scripts.tgz ... 42 sstate:xxx_multilib_install.tgz ... 29 sstate:xxx_package.tgz ... 13848 sstate:xxx_package_write_ipk.tgz ... 4615 sstate:xxx_packagedata.tgz ... 4613 sstate:xxx_pam_sanity.tgz ... 3 sstate:xxx_patch.tgz ... 7883 sstate:xxx_populate_adt.tgz ... 28 sstate:xxx_populate_ide_support.tgz ... 33 sstate:xxx_populate_lic.tgz ... 1718 sstate:xxx_populate_sysroot.tgz ... 5094 sstate:xxx_prepare_qmake_symlink.tgz ... 6 sstate:xxx_prepsources.tgz ... 168 sstate:xxx_rm_work.tgz ... 107630 sstate:xxx_rm_work_all.tgz ... 52563 sstate:xxx_rootfs.tgz ... 13 sstate:xxx_sanitize_sources.tgz ... 8 sstate:xxx_sizecheck.tgz ... 31 sstate:xxx_strip.tgz ... 31 sstate:xxx_uboot_mkimage.tgz ... 31 sstate:xxx_unpack.tgz ... 7857 sstate:xxx_unpack_extra.tgz ... 6 sstate:xxx_validate_branches.tgz ... 14 * with this patches most of these files are removed as well Figuring out the sstate:xxx_compile ... (0 from 0 .tgz files for compile suffix will be removed or 42310 from 47795 when counting also .siginfo and .done files) (From OE-Core rev: 66c6505e7ee0ea2efa13d1257982f721b26d83ae) 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-xscripts/sstate-cache-management.sh91
1 files changed, 46 insertions, 45 deletions
diff --git a/scripts/sstate-cache-management.sh b/scripts/sstate-cache-management.sh
index a4f66115e3..e55eb239f2 100755
--- a/scripts/sstate-cache-management.sh
+++ b/scripts/sstate-cache-management.sh
@@ -224,59 +224,60 @@ remove_duplicated () {
224 224
225 # Save the file list which needs to be removed 225 # Save the file list which needs to be removed
226 local remove_listdir=`mktemp -d` || exit 1 226 local remove_listdir=`mktemp -d` || exit 1
227
228 for suffix in $sstate_suffixes; do 227 for suffix in $sstate_suffixes; do
229 # Total number of files including .siginfo and .done files 228 # Total number of files including .siginfo and .done files
230 total_files_suffix=`grep ".*/sstate:[^:]*:[^:]*:[^:]*:[^:]*:[^:]*:[^:]*:[^:_]*_$suffix.*" $sstate_files_list | wc -l 2>/dev/null` 229 total_files_suffix=`grep ".*/sstate:[^:]*:[^:]*:[^:]*:[^:]*:[^:]*:[^:]*:[^:_]*_$suffix\.tgz.*" $sstate_files_list | wc -l 2>/dev/null`
231 total_tgz_suffix=`grep ".*/sstate:[^:]*:[^:]*:[^:]*:[^:]*:[^:]*:[^:]*:[^:_]*_$suffix.*.tgz$" $sstate_files_list | wc -l 2>/dev/null` 230 total_tgz_suffix=`grep ".*/sstate:[^:]*:[^:]*:[^:]*:[^:]*:[^:]*:[^:]*:[^:_]*_$suffix\.tgz$" $sstate_files_list | wc -l 2>/dev/null`
232 # Save the file list to a file, some suffix's file may not exist 231 # Save the file list to a file, some suffix's file may not exist
233 grep ".*/sstate:[^:]*:[^:]*:[^:]*:[^:]*:[^:]*:[^:]*:[^:_]*_$suffix.tgz$" $sstate_files_list >$list_suffix 2>/dev/null 232 grep ".*/sstate:[^:]*:[^:]*:[^:]*:[^:]*:[^:]*:[^:]*:[^:_]*_$suffix\.tgz.*" $sstate_files_list >$list_suffix 2>/dev/null
234 local deleted_tgz=0 233 local deleted_tgz=0
235 local deleted_files=0 234 local deleted_files=0
236 echo -n "Figuring out the sstate:xxx_$suffix.tgz ... " 235 for ext in tgz tgz.siginfo tgz.done; do
237 # Uniq BPNs 236 echo "Figuring out the sstate:xxx_$suffix.$ext ... "
238 file_names=`for arch in $ava_archs ""; do 237 # Uniq BPNs
239 sed -ne "s%.*/sstate:\([^:]*\):[^:]*:[^:]*:[^:]*:$arch:[^:]*:[^:]*\.tgz$%\1%p" $list_suffix 238 file_names=`for arch in $ava_archs ""; do
240 done | sort -u` 239 sed -ne "s%.*/sstate:\([^:]*\):[^:]*:[^:]*:[^:]*:$arch:[^:]*:[^:]*\.${ext}$%\1%p" $list_suffix
241 240 done | sort -u`
242 fn_tmp=`mktemp` || exit 1 241
243 rm_list="$remove_listdir/sstate:xxx_$suffix" 242 fn_tmp=`mktemp` || exit 1
244 for fn in $file_names; do 243 rm_list="$remove_listdir/sstate:xxx_$suffix"
245 [ -z "$verbose" ] || echo "Analyzing sstate:$fn-xxx_$suffix.tgz" 244 for fn in $file_names; do
246 for arch in $ava_archs ""; do 245 [ -z "$verbose" ] || echo "Analyzing sstate:$fn-xxx_$suffix.${ext}"
247 grep -h ".*/sstate:$fn:[^:]*:[^:]*:[^:]*:$arch:[^:]*:[^:]*\.tgz$" $list_suffix >$fn_tmp 246 for arch in $ava_archs ""; do
248 if [ -s $fn_tmp ] ; then 247 grep -h ".*/sstate:$fn:[^:]*:[^:]*:[^:]*:$arch:[^:]*:[^:]*\.${ext}$" $list_suffix >$fn_tmp
249 [ $debug -gt 1 ] && echo "Available files for $fn-$arch- with suffix $suffix:" && cat $fn_tmp 248 if [ -s $fn_tmp ] ; then
250 # Use the modification time 249 [ $debug -gt 1 ] && echo "Available files for $fn-$arch- with suffix $suffix.${ext}:" && cat $fn_tmp
251 to_del=$(ls -t $(cat $fn_tmp) | sed -n '1!p') 250 # Use the modification time
252 [ $debug -gt 2 ] && echo "Considering to delete: $to_del" 251 to_del=$(ls -t $(cat $fn_tmp) | sed -n '1!p')
253 # The sstate file which is downloaded from the SSTATE_MIRROR is 252 [ $debug -gt 2 ] && echo "Considering to delete: $to_del"
254 # put in SSTATE_DIR, and there is a symlink in SSTATE_DIR/??/ to 253 # The sstate file which is downloaded from the SSTATE_MIRROR is
255 # it, so filter it out from the remove list if it should not be 254 # put in SSTATE_DIR, and there is a symlink in SSTATE_DIR/??/ to
256 # removed. 255 # it, so filter it out from the remove list if it should not be
257 to_keep=$(ls -t $(cat $fn_tmp) | sed -n '1p') 256 # removed.
258 [ $debug -gt 2 ] && echo "Considering to keep: $to_keep" 257 to_keep=$(ls -t $(cat $fn_tmp) | sed -n '1p')
259 for k in $to_keep; do 258 [ $debug -gt 2 ] && echo "Considering to keep: $to_keep"
260 if [ -L "$k" ]; then 259 for k in $to_keep; do
261 # The symlink's destination 260 if [ -L "$k" ]; then
262 k_dest="`readlink -e $k`" 261 # The symlink's destination
263 # Maybe it is the one in cache_dir 262 k_dest="`readlink -e $k`"
264 k_maybe="$cache_dir/${k##/*/}" 263 # Maybe it is the one in cache_dir
265 # Remove it from the remove list if they are the same. 264 k_maybe="$cache_dir/${k##/*/}"
266 if [ "$k_dest" = "$k_maybe" ]; then 265 # Remove it from the remove list if they are the same.
267 to_del="`echo $to_del | sed 's#'\"$k_maybe\"'##g'`" 266 if [ "$k_dest" = "$k_maybe" ]; then
267 to_del="`echo $to_del | sed 's#'\"$k_maybe\"'##g'`"
268 fi
268 fi 269 fi
269 fi 270 done
270 done 271 rm -f $fn_tmp
271 rm -f $fn_tmp 272 [ $debug -gt 2 ] && echo "Decided to delete: $to_del"
272 [ $debug -gt 2 ] && echo "Decided to delete: $to_del" 273 gen_rmlist $rm_list.$ext "$to_del"
273 gen_rmlist $rm_list "$to_del" 274 fi
274 fi 275 done
275 done 276 done
276 done 277 done
277 [ -s "$rm_list" ] && deleted_tgz=`cat $rm_list | grep ".tgz$" | wc -l` 278 deleted_tgz=`cat $rm_list.* 2>/dev/null | grep ".tgz$" | wc -l`
278 [ -s "$rm_list" ] && deleted_files=`cat $rm_list | wc -l` 279 deleted_files=`cat $rm_list.* 2>/dev/null | wc -l`
279 [ -s "$rm_list" -a $debug -gt 0 ] && cat $rm_list 280 [ "$deleted_files" -gt 0 -a $debug -gt 0 ] && cat $rm_list.*
280 echo "($deleted_tgz from $total_tgz_suffix .tgz files for $suffix suffix will be removed or $deleted_files from $total_files_suffix when counting also .siginfo and .done files)" 281 echo "($deleted_tgz from $total_tgz_suffix .tgz files for $suffix suffix will be removed or $deleted_files from $total_files_suffix when counting also .siginfo and .done files)"
281 let total_deleted=$total_deleted+$deleted_files 282 let total_deleted=$total_deleted+$deleted_files
282 done 283 done