spk rev 38

spk-add: we do check modified each time, no test needed and dont add pkg to modifiers if already in
author Christophe Lincoln <pankso@slitaz.org>
date Tue May 15 23:58:01 2012 +0200 (2012-05-15)
parents 70c2d1ac2887
children 8ed83db5a0be
files spk-add
line diff
     1.1 --- a/spk-add	Tue May 15 23:32:17 2012 +0200
     1.2 +++ b/spk-add	Tue May 15 23:58:01 2012 +0200
     1.3 @@ -125,44 +125,41 @@
     1.4  	fi
     1.5  	[ "$debug" ] && echo "DEBUG: file_to_remove: $files_to_remove"
     1.6  
     1.7 -	local check=false
     1.8 +	# Create list of all possibly modified files
     1.9  	local file_list
    1.10 -	# Create list of all possibly modified files
    1.11  	for i in $(fgrep -v [ $tmpdir/files.list); do
    1.12  		[ -e "${root}${i}" ] || continue
    1.13  		[ -d "${root}${i}" ] && continue
    1.14  		file_list="$file_list $i"
    1.15 -		check=true
    1.16  	done
    1.17  	[ "$debug" ] && echo "DEBUG: file_list is set"
    1.18  
    1.19  	# Check possibly modified files against other packages files.list
    1.20 -	if [ "$check" ]; then
    1.21 -		[ "$debug" ] && echo "DEBUG: check modified files"
    1.22 -		for file in $file_list
    1.23 -		do
    1.24 -			filegrep=$(egrep ^${file}$ $installed/*/files.list)
    1.25 -			if [ "$filegrep" ]; then
    1.26 -				local list=$(echo $filegrep | cut -d ":" -f 1)
    1.27 -				local name=$(basename $(dirname $list))
    1.28 -				[  "$package_name" == "$name" ] && continue
    1.29 -				echo -n "Modified package: $name"
    1.30 -				status
    1.31 +	[ "$debug" ] && echo "DEBUG: check modified files"
    1.32 +	for file in $file_list
    1.33 +	do
    1.34 +		filegrep=$(egrep ^${file}$ $installed/*/files.list)
    1.35 +		if [ "$filegrep" ]; then
    1.36 +			local list=$(echo $filegrep | cut -d ":" -f 1)
    1.37 +			local name=$(basename $(dirname $list))
    1.38 +			[  "$pkg" == "$name" ] && continue
    1.39 +			echo -n "Modified package: $name"
    1.40 +			# Tell $name that $pkg is going to overwrite some of its files
    1.41 +			if [ -s "$installed/$name/volatile.cpio.gz" ]; then
    1.42 +				# We can modify backed up files without notice
    1.43 +				zcat $installed/$name/volatile.cpio.gz | cpio -t --quiet | \
    1.44 +				grep -q "^${file#/}$" && continue
    1.45 +			fi
    1.46 +			# Add $pkg to the modifiers list og $name
    1.47 +			if ! egrep -q ^${package_name}$ $installed/$name/modifiers; then
    1.48 +				[ "$debug" ] && \
    1.49 +					echo -en "\nDEBUG: Added $pkg to: $name/modifiers"
    1.50 +				echo "$package_name" >> $installed/$name/modifiers
    1.51 +			fi
    1.52 +			status
    1.53 +		fi
    1.54 +	done
    1.55  
    1.56 -				# Tell $pkg that $package_name is going to overwrite some
    1.57 -				# of its files
    1.58 -				#if [ -s "$pkg/volatile.cpio.gz" ]; then
    1.59 -					## We can modify backed up files without notice
    1.60 -					#zcat $pkg/volatile.cpio.gz | cpio -t --quiet | \
    1.61 -					#grep -q "^${file#/}$" && continue
    1.62 -				#fi
    1.63 -
    1.64 -				[ "$debug" ] && \
    1.65 -					echo "DEBUG: Adding $pkg to: $name/modifiers"
    1.66 -				echo "$pkg" >> $installed/$name/modifiers
    1.67 -			fi
    1.68 -		done
    1.69 -	fi
    1.70  
    1.71  	cd $tmpdir || exit 1
    1.72  	cp receipt files.list $package_dir