tazpkg diff tazpkg @ rev 164

Add packages.equiv support
author Pascal Bellard <pascal.bellard@slitaz.org>
date Wed Oct 15 20:09:15 2008 +0000 (2008-10-15)
parents 105f46f3f623
children 9efce80882a7
line diff
     1.1 --- a/tazpkg	Wed Oct 15 17:27:44 2008 +0000
     1.2 +++ b/tazpkg	Wed Oct 15 20:09:15 2008 +0000
     1.3 @@ -392,6 +392,31 @@
     1.4  	done
     1.5  }
     1.6  
     1.7 +# get package from packages.equiv
     1.8 +equivalent_pkg()
     1.9 +{
    1.10 +	for i in $(grep -s "^$1=" $2$LOCALSTATE/packages.equiv | sed "s/^$1=//"); do
    1.11 +		if echo $i | grep -q : ; then
    1.12 +			# format 'alternative:newname'
    1.13 +			# if alternative is installed then substitute newname
    1.14 +			if [ -f $2$INSTALLED/${i%:*}/receipt ]; then
    1.15 +				# substitute package dependancy
    1.16 +				echo ${i#*:}
    1.17 +				return
    1.18 +			fi
    1.19 +		else
    1.20 +			# if alternative is installed then nothing to install
    1.21 +			if [ -f $2$INSTALLED/$i/receipt ]; then
    1.22 +				# substitute installed package
    1.23 +				echo $i
    1.24 +				return
    1.25 +			fi
    1.26 +		fi
    1.27 +	done
    1.28 +	# if not found in packages.equiv then no substitution
    1.29 +	echo $1
    1.30 +}
    1.31 +
    1.32  # Check for missing deps listed in a receipt packages.
    1.33  check_for_deps()
    1.34  {
    1.35 @@ -402,8 +427,9 @@
    1.36  	. $TMP_DIR/receipt
    1.37  	PACKAGE=$saved
    1.38  	rm -rf $TMP_DIR
    1.39 -	for i in $DEPENDS
    1.40 +	for pkgorg in $DEPENDS
    1.41  	do
    1.42 +		i=$(equivalent_pkg $pkgorg $1)
    1.43  		if [ ! -d "$1$INSTALLED/$i" ]; then
    1.44  			MISSING_PACKAGE=$i
    1.45  			deps=$(($deps+1))
    1.46 @@ -414,8 +440,9 @@
    1.47  	if [ ! "$MISSING_PACKAGE" = "" ]; then
    1.48  		echo -e "\033[1mTracking dependencies for :\033[0m $PACKAGE"
    1.49  		echo "================================================================================"
    1.50 -		for i in $DEPENDS
    1.51 +		for pkgorg in $DEPENDS
    1.52  		do
    1.53 +			i=$(equivalent_pkg $pkgorg $1)
    1.54  			if [ ! -d "$1$INSTALLED/$i" ]; then
    1.55  				MISSING_PACKAGE=$i
    1.56  				echo "Missing : $MISSING_PACKAGE"
    1.57 @@ -438,8 +465,9 @@
    1.58  	echo -n "Install all missing dependencies (y/N) ? "; read anser
    1.59  	echo ""
    1.60  	if [ "$anser" = "y" ]; then
    1.61 -		for pkg in $DEPENDS
    1.62 +		for pkgorg in $DEPENDS
    1.63  		do
    1.64 +			pkg=$(equivalent_pkg $pkgorg $1)
    1.65  			if [ ! -d "$1$INSTALLED/$pkg" ]; then
    1.66  				local list
    1.67  				list="$INSTALL_LIST"
    1.68 @@ -1361,12 +1389,14 @@
    1.69  			mv -f packages.desc packages.desc.bak 2>/dev/null
    1.70  			mv -f packages.txt packages.txt.bak 2>/dev/null
    1.71  			mv -f packages.list packages.list.bak 2>/dev/null
    1.72 +			mv -f packages.equiv packages.equiv.bak 2>/dev/null
    1.73  			mv -f files.list.lzma files.list.lzma.bak 2> /dev/nul
    1.74  			status
    1.75  		fi
    1.76  		download packages.desc
    1.77  		download packages.txt
    1.78  		download packages.list
    1.79 +		download packages.equiv
    1.80  		download files.list.lzma
    1.81  		if [ -f "$LOCALSTATE/packages.list.bak" ]; then
    1.82  			diff -u packages.list.bak packages.list | grep ^+[a-z] > packages.diff