diff options
author | Robert Yang <liezhi.yang@windriver.com> | 2012-08-29 09:24:59 +0000 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2012-08-30 17:30:11 -0700 |
commit | 12ed7e6bb215e70b119d5ce123e36e2fd380ff1e (patch) | |
tree | 0fd2a8289ccf848256cb043b6a01cf278c4a4338 /scripts | |
parent | 1f1b6f93d6b7aa8c9bd9bb5b1826997812e36932 (diff) | |
download | openembedded-core-12ed7e6bb215e70b119d5ce123e36e2fd380ff1e.tar.gz openembedded-core-12ed7e6bb215e70b119d5ce123e36e2fd380ff1e.tar.bz2 openembedded-core-12ed7e6bb215e70b119d5ce123e36e2fd380ff1e.zip |
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]
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')
-rwxr-xr-x | scripts/sstate-cache-management.sh | 20 |
1 files changed, 19 insertions, 1 deletions
diff --git a/scripts/sstate-cache-management.sh b/scripts/sstate-cache-management.sh index 3a5980c1e4..a1f7c8973d 100755 --- a/scripts/sstate-cache-management.sh +++ b/scripts/sstate-cache-management.sh @@ -211,8 +211,25 @@ remove_duplicated () { for arch in $ava_archs; do grep -h "/$fn-$arch-" $list_suffix >>$fn_tmp done - # Use the access time, also delete the .siginfo file + # Use the modification time to_del=$(ls -t $(cat $fn_tmp) | sed -n '1!p') + # 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') + for k in $to_keep; do + if [ -L "$k" ]; then + # The symlink's destination + k_dest="`readlink -e $k`" + # Maybe it is the one in cache_dir + k_maybe="$cache_dir/${k##/*/}" + # Remove it from the remove list if they are the same. + if [ "$k_dest" = "$k_maybe" ]; then + to_del="`echo $to_del | sed 's#'\"$k_maybe\"'##g'`" + fi + fi + done rm -f $fn_tmp gen_rmlist $rm_list "$to_del" done @@ -221,6 +238,7 @@ remove_duplicated () { let total_deleted=$total_deleted+$deleted done rm -f $list_suffix + rm -f $sstate_list if [ $total_deleted -gt 0 ]; then read_confirm if [ "$confirm" = "y" -o "$confirm" = "Y" ]; then |