cookutils rev 921

cooker: try to handle removing stuff after syncing wok with wok-hg.
author Aleksej Bobylev <al.bobylev@gmail.com>
date Thu Jun 08 23:51:29 2017 +0300 (2017-06-08)
parents 1caffc190057
children 4dbff8522396
files cooker
line diff
     1.1 --- a/cooker	Thu Jun 08 19:47:40 2017 +0300
     1.2 +++ b/cooker	Thu Jun 08 23:51:29 2017 +0300
     1.3 @@ -528,7 +528,7 @@
     1.4  		# clean DB as well as log file.
     1.5  		cd $wok
     1.6  		for pkg in *; do
     1.7 -			if [ ! -d "${wok}-hg/$pkg" ]; then
     1.8 +			if [ ! -d "$wok-hg/$pkg" ]; then
     1.9  				echo "Removing package: $pkg" | log_commits
    1.10  				if [ -s $wok/$pkg/receipt ]; then
    1.11  					. $wok/$pkg/receipt
    1.12 @@ -537,6 +537,21 @@
    1.13  				rm -rf $wok/$pkg $LOGS/$pkg.log
    1.14  				sed -i "/^${pkg}$/"d $blocked $broken $commits.tmp
    1.15  			fi
    1.16 +			if [ -d "$wok/$pkg/stuff" ]; then
    1.17 +				if [ ! -d "$wok-hg/$pkg/stuff" ]; then
    1.18 +					echo "Removing stuff: $pkg/stuff" | log_commits
    1.19 +					echo "rm -rf $wok/$pkg/stuff" | log_commits			# just for test now
    1.20 +				else
    1.21 +					for stuff_file in $(cd $wok/$pkg/stuff; find \( -type f -o -type l \) ); do
    1.22 +						if [ ! -f "$wok-hg/$pkg/stuff/$stuff_file" -a \
    1.23 +							 ! -h "$wok-hg/$pkg/stuff/$stuff_file" ]; then
    1.24 +							echo "Removing file from stuff: $wok/$pkg/stuff/$stuff_file" | log_commits
    1.25 +							echo "rm -f $wok/$pkg/stuff/$stuff_file" | log_commits			# just for test now
    1.26 +							echo "rmdir --parents --ignore-fail-on-non-empty $(dirname "$wok/$pkg/stuff/$stuff_file")" | log_commits			# just for test now
    1.27 +						fi
    1.28 +					done
    1.29 +				fi
    1.30 +			fi
    1.31  		done
    1.32  
    1.33  		# Keep previous commit and discard duplicate lines