spk rev 37
spk-add: handle modifiers faster
author | Christophe Lincoln <pankso@slitaz.org> |
---|---|
date | Tue May 15 23:32:17 2012 +0200 (2012-05-15) |
parents | becb0314c7e1 |
children | 80b6f3e3bb6d |
files | spk-add spk-rm |
line diff
1.1 --- a/spk-add Tue May 15 21:57:13 2012 +0200 1.2 +++ b/spk-add Tue May 15 23:32:17 2012 +0200 1.3 @@ -114,15 +114,16 @@ 1.4 if [ -f $package_dir/files.list ]; then 1.5 for file in $(cat $package_dir/files.list) 1.6 do 1.7 - grep -q "^$(echo $file | grepesc)$" $tmpdir/files.list && continue 1.8 + egrep -q "^$(echo $file | grepesc)$" $tmpdir/files.list && continue 1.9 local modifiers=$(cat $package_dir/modifiers 2> /dev/null; \ 1.10 - fgrep -sl $package_dir */modifiers | cut -d/ -f1) 1.11 + fgrep -sl $package_dir */modifiers | cut -d/ -f1) 1.12 for i in modifiers; do 1.13 - grep -qs "^$(echo $file | grepesc)$" $i/files.list && continue 2 1.14 + egrep -qs "^$(echo $file | grepesc)$" $i/files.list && continue 2 1.15 done 1.16 files_to_remove="$files_to_remove $file" 1.17 done 1.18 fi 1.19 + [ "$debug" ] && echo "DEBUG: file_to_remove: $files_to_remove" 1.20 1.21 local check=false 1.22 local file_list 1.23 @@ -133,33 +134,33 @@ 1.24 file_list="$file_list $i" 1.25 check=true 1.26 done 1.27 + [ "$debug" ] && echo "DEBUG: file_list is set" 1.28 1.29 - # Check possibly modified files against other packages file.list 1.30 - if $check; then 1.31 - for pkg in $installed/* 1.32 + # Check possibly modified files against other packages files.list 1.33 + if [ "$check" ]; then 1.34 + [ "$debug" ] && echo "DEBUG: check modified files" 1.35 + for file in $file_list 1.36 do 1.37 - [ "$pkg" == "$package_name" ] && continue 1.38 - [ -s $pkg/files.list ] || continue 1.39 + filegrep=$(egrep ^${file}$ $installed/*/files.list) 1.40 + if [ "$filegrep" ]; then 1.41 + local list=$(echo $filegrep | cut -d ":" -f 1) 1.42 + local name=$(basename $(dirname $list)) 1.43 + [ "$package_name" == "$name" ] && continue 1.44 + echo -n "Modified package: $name" 1.45 + status 1.46 1.47 - for file in $file_list; do 1.48 - # $package_name wants to install $file which is already 1.49 - # installed from $pkg 1.50 - if grep -q ^$file$ $pkg/files.list; then 1.51 - # Tell $pkg that $package_name is going to overwrite some 1.52 - # of its files 1.53 - if [ -s "$pkg/volatile.cpio.gz" ]; then 1.54 - # We can modify backed up files without notice 1.55 - zcat $pkg/volatile.cpio.gz | cpio -t --quiet | \ 1.56 - grep -q "^${file#/}$" && continue 1.57 - fi 1.58 - base_name=$(basename $pkg) 1.59 - if [ "$package_name" != "$base_name" ]; then 1.60 - [ "$debug" ] && \ 1.61 - echo "DEBUG: Adding $base_name to: $pkg/modifiers" 1.62 - echo "$package_name" >> $pkg/modifiers 1.63 - fi 1.64 - fi 1.65 - done 1.66 + # Tell $pkg that $package_name is going to overwrite some 1.67 + # of its files 1.68 + #if [ -s "$pkg/volatile.cpio.gz" ]; then 1.69 + ## We can modify backed up files without notice 1.70 + #zcat $pkg/volatile.cpio.gz | cpio -t --quiet | \ 1.71 + #grep -q "^${file#/}$" && continue 1.72 + #fi 1.73 + 1.74 + [ "$debug" ] && \ 1.75 + echo "DEBUG: Adding $pkg to: $name/modifiers" 1.76 + echo "$pkg" >> $installed/$name/modifiers 1.77 + fi 1.78 done 1.79 fi 1.80
2.1 --- a/spk-rm Tue May 15 21:57:13 2012 +0200 2.2 +++ b/spk-rm Tue May 15 23:32:17 2012 +0200 2.3 @@ -149,7 +149,6 @@ 2.4 gettext "For reinstallation check:"; echo " $installed/$i" 2.5 continue 2.6 fi 2.7 - # TODO: use spk-add 2.8 rm -r $installed/$i 2.9 spk-add ${i%/modifiers} --forced --root=$root 2.10 done