summaryrefslogtreecommitdiffstats
path: root/scripts/sstate-cache-management.sh
diff options
context:
space:
mode:
authorRobert Yang <liezhi.yang@windriver.com>2012-08-29 09:24:59 (GMT)
committerRichard Purdie <richard.purdie@linuxfoundation.org>2012-08-31 00:44:06 (GMT)
commit43a7c66113f557f762c10756e4cb2f29f0870e93 (patch)
treeb4171e9899e4839479bda140f4ada810f48cf0f8 /scripts/sstate-cache-management.sh
parent59260f952f8687ac67a17035307c6c0792728f1b (diff)
downloadpoky-43a7c66113f557f762c10756e4cb2f29f0870e93.tar.gz
sstate-cache-management.sh: fix it for downloaded file
Fix it for the downloaded sstate cache file * The downloaded sstate cache file is in SSTATE_DIR, and there is a symlink points to it, the sstate cache file should not be removed if the corresponding symlink is kept, it would be removed when the symlink is removed (with -L option). * Fix a comment line. [YOCTO #2897] (From OE-Core rev: 12ed7e6bb215e70b119d5ce123e36e2fd380ff1e) Signed-off-by: Robert Yang <liezhi.yang@windriver.com> Signed-off-by: Saul Wold <sgw@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'scripts/sstate-cache-management.sh')
-rwxr-xr-xscripts/sstate-cache-management.sh20
1 files changed, 19 insertions, 1 deletions
diff --git a/scripts/sstate-cache-management.sh b/scripts/sstate-cache-management.sh
index 3a5980c..a1f7c89 100755
--- a/scripts/sstate-cache-management.sh
+++ b/scripts/sstate-cache-management.sh
@@ -211,8 +211,25 @@ remove_duplicated () {
211 for arch in $ava_archs; do 211 for arch in $ava_archs; do
212 grep -h "/$fn-$arch-" $list_suffix >>$fn_tmp 212 grep -h "/$fn-$arch-" $list_suffix >>$fn_tmp
213 done 213 done
214 # Use the access time, also delete the .siginfo file 214 # Use the modification time
215 to_del=$(ls -t $(cat $fn_tmp) | sed -n '1!p') 215 to_del=$(ls -t $(cat $fn_tmp) | sed -n '1!p')
216 # The sstate file which is downloaded from the SSTATE_MIRROR is
217 # put in SSTATE_DIR, and there is a symlink in SSTATE_DIR/??/ to
218 # it, so filter it out from the remove list if it should not be
219 # removed.
220 to_keep=$(ls -t $(cat $fn_tmp) | sed -n '1p')
221 for k in $to_keep; do
222 if [ -L "$k" ]; then
223 # The symlink's destination
224 k_dest="`readlink -e $k`"
225 # Maybe it is the one in cache_dir
226 k_maybe="$cache_dir/${k##/*/}"
227 # Remove it from the remove list if they are the same.
228 if [ "$k_dest" = "$k_maybe" ]; then
229 to_del="`echo $to_del | sed 's#'\"$k_maybe\"'##g'`"
230 fi
231 fi
232 done
216 rm -f $fn_tmp 233 rm -f $fn_tmp
217 gen_rmlist $rm_list "$to_del" 234 gen_rmlist $rm_list "$to_del"
218 done 235 done
@@ -221,6 +238,7 @@ remove_duplicated () {
221 let total_deleted=$total_deleted+$deleted 238 let total_deleted=$total_deleted+$deleted
222 done 239 done
223 rm -f $list_suffix 240 rm -f $list_suffix
241 rm -f $sstate_list
224 if [ $total_deleted -gt 0 ]; then 242 if [ $total_deleted -gt 0 ]; then
225 read_confirm 243 read_confirm
226 if [ "$confirm" = "y" -o "$confirm" = "Y" ]; then 244 if [ "$confirm" = "y" -o "$confirm" = "Y" ]; then