summaryrefslogtreecommitdiffstats
path: root/scripts/sstate-cache-management.sh
diff options
context:
space:
mode:
Diffstat (limited to 'scripts/sstate-cache-management.sh')
-rwxr-xr-xscripts/sstate-cache-management.sh40
1 files changed, 20 insertions, 20 deletions
diff --git a/scripts/sstate-cache-management.sh b/scripts/sstate-cache-management.sh
index f1706a2229..d39671f7c6 100755
--- a/scripts/sstate-cache-management.sh
+++ b/scripts/sstate-cache-management.sh
@@ -114,7 +114,7 @@ echo_error () {
114# * Add .done/.siginfo to the remove list 114# * Add .done/.siginfo to the remove list
115# * Add destination of symlink to the remove list 115# * Add destination of symlink to the remove list
116# 116#
117# $1: output file, others: sstate cache file (.tgz) 117# $1: output file, others: sstate cache file (.tar.zst)
118gen_rmlist (){ 118gen_rmlist (){
119 local rmlist_file="$1" 119 local rmlist_file="$1"
120 shift 120 shift
@@ -131,13 +131,13 @@ gen_rmlist (){
131 dest="`readlink -e $i`" 131 dest="`readlink -e $i`"
132 if [ -n "$dest" ]; then 132 if [ -n "$dest" ]; then
133 echo $dest >> $rmlist_file 133 echo $dest >> $rmlist_file
134 # Remove the .siginfo when .tgz is removed 134 # Remove the .siginfo when .tar.zst is removed
135 if [ -f "$dest.siginfo" ]; then 135 if [ -f "$dest.siginfo" ]; then
136 echo $dest.siginfo >> $rmlist_file 136 echo $dest.siginfo >> $rmlist_file
137 fi 137 fi
138 fi 138 fi
139 fi 139 fi
140 # Add the ".tgz.done" and ".siginfo.done" (may exist in the future) 140 # Add the ".tar.zst.done" and ".siginfo.done" (may exist in the future)
141 base_fn="${i##/*/}" 141 base_fn="${i##/*/}"
142 t_fn="$base_fn.done" 142 t_fn="$base_fn.done"
143 s_fn="$base_fn.siginfo.done" 143 s_fn="$base_fn.siginfo.done"
@@ -188,10 +188,10 @@ remove_duplicated () {
188 total_files=`find $cache_dir -name 'sstate*' | wc -l` 188 total_files=`find $cache_dir -name 'sstate*' | wc -l`
189 # Save all the sstate files in a file 189 # Save all the sstate files in a file
190 sstate_files_list=`mktemp` || exit 1 190 sstate_files_list=`mktemp` || exit 1
191 find $cache_dir -name 'sstate:*:*:*:*:*:*:*.tgz*' >$sstate_files_list 191 find $cache_dir -iname 'sstate:*:*:*:*:*:*:*.tar.zst*' >$sstate_files_list
192 192
193 echo "Figuring out the suffixes in the sstate cache dir ... " 193 echo "Figuring out the suffixes in the sstate cache dir ... "
194 sstate_suffixes="`sed 's%.*/sstate:[^:]*:[^:]*:[^:]*:[^:]*:[^:]*:[^:]*:[^_]*_\([^:]*\)\.tgz.*%\1%g' $sstate_files_list | sort -u`" 194 sstate_suffixes="`sed 's%.*/sstate:[^:]*:[^:]*:[^:]*:[^:]*:[^:]*:[^:]*:[^_]*_\([^:]*\)\.tar\.zst.*%\1%g' $sstate_files_list | sort -u`"
195 echo "Done" 195 echo "Done"
196 echo "The following suffixes have been found in the cache dir:" 196 echo "The following suffixes have been found in the cache dir:"
197 echo $sstate_suffixes 197 echo $sstate_suffixes
@@ -200,10 +200,10 @@ remove_duplicated () {
200 # Using this SSTATE_PKGSPEC definition it's 6th colon separated field 200 # Using this SSTATE_PKGSPEC definition it's 6th colon separated field
201 # SSTATE_PKGSPEC = "sstate:${PN}:${PACKAGE_ARCH}${TARGET_VENDOR}-${TARGET_OS}:${PV}:${PR}:${SSTATE_PKGARCH}:${SSTATE_VERSION}:" 201 # SSTATE_PKGSPEC = "sstate:${PN}:${PACKAGE_ARCH}${TARGET_VENDOR}-${TARGET_OS}:${PV}:${PR}:${SSTATE_PKGARCH}:${SSTATE_VERSION}:"
202 for arch in $all_archs; do 202 for arch in $all_archs; do
203 grep -q ".*/sstate:[^:]*:[^:]*:[^:]*:[^:]*:$arch:[^:]*:[^:]*\.tgz$" $sstate_files_list 203 grep -q ".*/sstate:[^:]*:[^:]*:[^:]*:[^:]*:$arch:[^:]*:[^:]*\.tar\.zst$" $sstate_files_list
204 [ $? -eq 0 ] && ava_archs="$ava_archs $arch" 204 [ $? -eq 0 ] && ava_archs="$ava_archs $arch"
205 # ${builder_arch}_$arch used by toolchain sstate 205 # ${builder_arch}_$arch used by toolchain sstate
206 grep -q ".*/sstate:[^:]*:[^:]*:[^:]*:[^:]*:${builder_arch}_$arch:[^:]*:[^:]*\.tgz$" $sstate_files_list 206 grep -q ".*/sstate:[^:]*:[^:]*:[^:]*:[^:]*:${builder_arch}_$arch:[^:]*:[^:]*\.tar\.zst$" $sstate_files_list
207 [ $? -eq 0 ] && ava_archs="$ava_archs ${builder_arch}_$arch" 207 [ $? -eq 0 ] && ava_archs="$ava_archs ${builder_arch}_$arch"
208 done 208 done
209 echo "Done" 209 echo "Done"
@@ -219,13 +219,13 @@ remove_duplicated () {
219 continue 219 continue
220 fi 220 fi
221 # Total number of files including .siginfo and .done files 221 # Total number of files including .siginfo and .done files
222 total_files_suffix=`grep ".*/sstate:[^:]*:[^:]*:[^:]*:[^:]*:[^:]*:[^:]*:[^:_]*_$suffix\.tgz.*" $sstate_files_list | wc -l 2>/dev/null` 222 total_files_suffix=`grep ".*/sstate:[^:]*:[^:]*:[^:]*:[^:]*:[^:]*:[^:]*:[^:_]*_$suffix\.tar\.zst.*" $sstate_files_list | wc -l 2>/dev/null`
223 total_tgz_suffix=`grep ".*/sstate:[^:]*:[^:]*:[^:]*:[^:]*:[^:]*:[^:]*:[^:_]*_$suffix\.tgz$" $sstate_files_list | wc -l 2>/dev/null` 223 total_archive_suffix=`grep ".*/sstate:[^:]*:[^:]*:[^:]*:[^:]*:[^:]*:[^:]*:[^:_]*_$suffix\.tar\.zst$" $sstate_files_list | wc -l 2>/dev/null`
224 # Save the file list to a file, some suffix's file may not exist 224 # Save the file list to a file, some suffix's file may not exist
225 grep ".*/sstate:[^:]*:[^:]*:[^:]*:[^:]*:[^:]*:[^:]*:[^:_]*_$suffix\.tgz.*" $sstate_files_list >$list_suffix 2>/dev/null 225 grep ".*/sstate:[^:]*:[^:]*:[^:]*:[^:]*:[^:]*:[^:]*:[^:_]*_$suffix\.tar\.zst.*" $sstate_files_list >$list_suffix 2>/dev/null
226 local deleted_tgz=0 226 local deleted_archives=0
227 local deleted_files=0 227 local deleted_files=0
228 for ext in tgz tgz.siginfo tgz.done; do 228 for ext in tar.zst tar.zst.siginfo tar.zst.done; do
229 echo "Figuring out the sstate:xxx_$suffix.$ext ... " 229 echo "Figuring out the sstate:xxx_$suffix.$ext ... "
230 # Uniq BPNs 230 # Uniq BPNs
231 file_names=`for arch in $ava_archs ""; do 231 file_names=`for arch in $ava_archs ""; do
@@ -268,19 +268,19 @@ remove_duplicated () {
268 done 268 done
269 done 269 done
270 done 270 done
271 deleted_tgz=`cat $rm_list.* 2>/dev/null | grep ".tgz$" | wc -l` 271 deleted_archives=`cat $rm_list.* 2>/dev/null | grep "\.tar\.zst$" | wc -l`
272 deleted_files=`cat $rm_list.* 2>/dev/null | wc -l` 272 deleted_files=`cat $rm_list.* 2>/dev/null | wc -l`
273 [ "$deleted_files" -gt 0 -a $debug -gt 0 ] && cat $rm_list.* 273 [ "$deleted_files" -gt 0 -a $debug -gt 0 ] && cat $rm_list.*
274 echo "($deleted_tgz out of $total_tgz_suffix .tgz files for $suffix suffix will be removed or $deleted_files out of $total_files_suffix when counting also .siginfo and .done files)" 274 echo "($deleted_archives out of $total_archives_suffix .tar.zst files for $suffix suffix will be removed or $deleted_files out of $total_files_suffix when counting also .siginfo and .done files)"
275 let total_deleted=$total_deleted+$deleted_files 275 let total_deleted=$total_deleted+$deleted_files
276 done 276 done
277 deleted_tgz=0 277 deleted_archives=0
278 rm_old_list=$remove_listdir/sstate-old-filenames 278 rm_old_list=$remove_listdir/sstate-old-filenames
279 find $cache_dir -name 'sstate-*.tgz' >$rm_old_list 279 find $cache_dir -name 'sstate-*.tar.zst' >$rm_old_list
280 [ -s "$rm_old_list" ] && deleted_tgz=`cat $rm_old_list | grep ".tgz$" | wc -l` 280 [ -s "$rm_old_list" ] && deleted_archives=`cat $rm_old_list | grep "\.tar\.zst$" | wc -l`
281 [ -s "$rm_old_list" ] && deleted_files=`cat $rm_old_list | wc -l` 281 [ -s "$rm_old_list" ] && deleted_files=`cat $rm_old_list | wc -l`
282 [ -s "$rm_old_list" -a $debug -gt 0 ] && cat $rm_old_list 282 [ -s "$rm_old_list" -a $debug -gt 0 ] && cat $rm_old_list
283 echo "($deleted_tgz .tgz files with old sstate-* filenames will be removed or $deleted_files when counting also .siginfo and .done files)" 283 echo "($deleted_archives or .tar.zst files with old sstate-* filenames will be removed or $deleted_files when counting also .siginfo and .done files)"
284 let total_deleted=$total_deleted+$deleted_files 284 let total_deleted=$total_deleted+$deleted_files
285 285
286 rm -f $list_suffix 286 rm -f $list_suffix
@@ -289,7 +289,7 @@ remove_duplicated () {
289 read_confirm 289 read_confirm
290 if [ "$confirm" = "y" -o "$confirm" = "Y" ]; then 290 if [ "$confirm" = "y" -o "$confirm" = "Y" ]; then
291 for list in `ls $remove_listdir/`; do 291 for list in `ls $remove_listdir/`; do
292 echo "Removing $list.tgz (`cat $remove_listdir/$list | wc -w` files) ... " 292 echo "Removing $list.tar.zst archive (`cat $remove_listdir/$list | wc -w` files) ... "
293 # Remove them one by one to avoid the argument list too long error 293 # Remove them one by one to avoid the argument list too long error
294 for i in `cat $remove_listdir/$list`; do 294 for i in `cat $remove_listdir/$list`; do
295 rm -f $verbose $i 295 rm -f $verbose $i
@@ -322,7 +322,7 @@ rm_by_stamps (){
322 find $cache_dir -type f -name 'sstate*' | sort -u -o $cache_list 322 find $cache_dir -type f -name 'sstate*' | sort -u -o $cache_list
323 323
324 echo "Figuring out the suffixes in the sstate cache dir ... " 324 echo "Figuring out the suffixes in the sstate cache dir ... "
325 local sstate_suffixes="`sed 's%.*/sstate:[^:]*:[^:]*:[^:]*:[^:]*:[^:]*:[^:]*:[^_]*_\([^:]*\)\.tgz.*%\1%g' $cache_list | sort -u`" 325 local sstate_suffixes="`sed 's%.*/sstate:[^:]*:[^:]*:[^:]*:[^:]*:[^:]*:[^:]*:[^_]*_\([^:]*\)\.tar\.zst.*%\1%g' $cache_list | sort -u`"
326 echo "Done" 326 echo "Done"
327 echo "The following suffixes have been found in the cache dir:" 327 echo "The following suffixes have been found in the cache dir:"
328 echo $sstate_suffixes 328 echo $sstate_suffixes