spk rev 40

Better modifiers and rdeps handler in spk-rm and fixes
author Christophe Lincoln <pankso@slitaz.org>
date Wed May 16 02:32:22 2012 +0200 (2012-05-16)
parents 8ed83db5a0be
children 4a7b284956e1
files spk-add spk-archive spk-rm
line diff
     1.1 --- a/spk-add	Wed May 16 01:19:38 2012 +0200
     1.2 +++ b/spk-add	Wed May 16 02:32:22 2012 +0200
     1.3 @@ -27,6 +27,7 @@
     1.4  $(boldify $(gettext "Options:"))
     1.5    --forced    $(gettext "Force package reinstallation")
     1.6    --root=     $(gettext "Set the root file system path")
     1.7 +  --debug     $(gettext "Display some usefull debug information")
     1.8  
     1.9  $(boldify $(gettext "Examples:"))
    1.10    $name package1 package2 packageN
     2.1 --- a/spk-archive	Wed May 16 01:19:38 2012 +0200
     2.2 +++ b/spk-archive	Wed May 16 02:32:22 2012 +0200
     2.3 @@ -250,7 +250,7 @@
     2.4  		done < files.list > $CHECKSUM
     2.5  		status
     2.6  		UNPACKED_SIZE=$(du -chs fs receipt files.list $CHECKSUM \
     2.7 -			description.txt 2> /dev/null | awk \
     2.8 +			description.txt 2> /dev/null | busybox awk \
     2.9  			'{ sz=$1 } END { print sz }')
    2.10  		# Build cpio archives.
    2.11  		gettext "Compressing the fs... "
    2.12 @@ -258,7 +258,7 @@
    2.13  		rm -rf fs
    2.14  		status
    2.15  		PACKED_SIZE=$(du -chs fs.cpio.lzma receipt files.list \
    2.16 -			$CHECKSUM description.txt 2> /dev/null | awk \
    2.17 +			$CHECKSUM description.txt 2> /dev/null | busybox awk \
    2.18  			'{ sz=$1 } END { print sz }')
    2.19  		gettext "Updating receipt sizes..."
    2.20  		sed -i s/^PACKED_SIZE.*$// receipt
     3.1 --- a/spk-rm	Wed May 16 01:19:38 2012 +0200
     3.2 +++ b/spk-rm	Wed May 16 02:32:22 2012 +0200
     3.3 @@ -64,9 +64,9 @@
     3.4  
     3.5  	# Reverse dep.
     3.6  	if [ "$altered" ]; then
     3.7 -		gettext "The following packages depend on"; boldify " $PACKAGE"
     3.8 +		gettext "The following packages depend on"; colorize " $pkg" 31
     3.9  		for i in $altered; do
    3.10 -			echo "    $i"
    3.11 +			echo "    $(colorize "$i" 32)"
    3.12  		done
    3.13  	fi
    3.14  
    3.15 @@ -87,28 +87,14 @@
    3.16  	# Remove all files
    3.17  	gettext "Removing all installed files..."
    3.18  	[ "$verbose" ] && newline
    3.19 -	if [ -f $installed/$PACKAGE/modifiers ]; then
    3.20 -	    for file in $(cat $installed/$PACKAGE/files.list)
    3.21 -	    do
    3.22 -			for mod in $(cat $installed/$PACKAGE/modifiers)
    3.23 -			do
    3.24 -				[ -f $installed/$mod/files.list ] && \
    3.25 -					[ $(grep "^$(echo $file | grepesc)$" $installed/$mod/files.list | wc -l) -gt 1 ] \
    3.26 -					&& continue 2
    3.27 -			done
    3.28 -			[ "$verbose" ] && (gettext "Removing:"; echo -n " ${root}${file}")
    3.29 -			remove_file ${root}${file}
    3.30 -	    done
    3.31 -	else
    3.32 -		for file in $(cat $installed/$PACKAGE/files.list)
    3.33 -		do
    3.34 -			if [ "$verbose" ]; then
    3.35 -				gettext "Removing:"; echo -n " ${root}${file}"
    3.36 -			fi
    3.37 -			remove_file ${root}${file}
    3.38 -			[ "$verbose" ] && status
    3.39 -		done
    3.40 -	fi
    3.41 +	for file in $(cat $installed/$PACKAGE/files.list)
    3.42 +	do
    3.43 +		if [ "$verbose" ]; then
    3.44 +			gettext "Removing:"; echo -n " ${root}${file}"
    3.45 +		fi
    3.46 +		remove_file ${root}${file}
    3.47 +		[ "$verbose" ] && status
    3.48 +	done
    3.49  	[ ! "$verbose" ] && status
    3.50  
    3.51  	# Handle post_remove
    3.52 @@ -119,17 +105,17 @@
    3.53  	# Remove package receipt.
    3.54  	gettext "Removing package receipt..."
    3.55  	rm -rf $installed/$PACKAGE
    3.56 +	sed -i "/ $PACKAGE-${VERSION}${EXTRAVERSION}$/d" $pkgsmd5
    3.57  	status
    3.58 -	sed -i "/ $PACKAGE-${VERSION}${EXTRAVERSION}$/d" $pkgsmd5 2> /dev/null
    3.59  
    3.60  	separator && newline
    3.61  
    3.62  	# Do we have packages depending on $pkg to remove ?
    3.63  	if [ "$altered" ]; then
    3.64  		if [ "$confirm" ]; then
    3.65 -			gettext "Remove packages depending on:"; echo -n " $PACKAGE"
    3.66 +			gettext "Remove packages depending on:"; echo -n " $pkg"
    3.67  			if ! confirm; then
    3.68 -				gettext "Keeping packages depending on:"; echo " $PACKAGE"
    3.69 +				gettext "Keeping packages..."; newline
    3.70  				newline && continue
    3.71  			fi
    3.72  		fi
    3.73 @@ -140,24 +126,26 @@
    3.74  		done
    3.75  	fi
    3.76  
    3.77 -	# Handle mofified packages
    3.78 +	# Handle modified packages
    3.79  	modified=$(cd $installed; grep -sl ^$pkg$ */modifiers)
    3.80  	if [ "$modified" ]; then
    3.81 -		gettext "Following packages was modified by"; boldify " $pkg"
    3.82 -		for i in $modified; do
    3.83 -			echo "  ${i%/modifiers}"
    3.84 +		for i in $modified
    3.85 +		do
    3.86 +			gettext "Removed package  :"; boldify " $pkg"
    3.87 +			gettext "Modified package :"; colorize " ${i%/modifiers}" 31
    3.88  			# Remove package from the modifiers list
    3.89  			sed -i "/^${pkg}$/"d $installed/$i
    3.90 -		done
    3.91 -		if [ "$confirm" ]; then
    3.92 -			gettext "Reinstall packages modified by:"; echo -n " $PACKAGE"
    3.93 -			if ! confirm; then
    3.94 -				gettext "Keeping packages modified by:"; echo " $PACKAGE"
    3.95 -				newline && continue
    3.96 +			# Reinstall modified packages
    3.97 +			if [ "$confirm" ]; then
    3.98 +				gettext "Confirm reinstallation of:"
    3.99 +				echo -n " ${i%/modifiers}"
   3.100 +				if ! confirm; then
   3.101 +					gettext "Reinstallation cancelled"; newline
   3.102 +					newline && continue
   3.103 +				else
   3.104 +					gettext "Reinsalling modified package..."; newline
   3.105 +				fi
   3.106  			fi
   3.107 -		fi
   3.108 -		# Reinstall modified packages
   3.109 -		for i in $modified; do
   3.110  			spk-add ${i%/modifiers} --forced --root=$root
   3.111  		done
   3.112  	fi