tazpkg diff tazpkg @ rev 536

Fix: make tazpkg up works fine with multiple repositories (please test it); Update translations according to this.
author Antoine Bodin <gokhlayeh@slitaz.org>
date Tue Jan 03 19:16:23 2012 +0100 (2012-01-03)
parents e4e3fa540004
children 73e376e7e6b5
line diff
     1.1 --- a/tazpkg	Sun Nov 06 06:24:13 2011 +0000
     1.2 +++ b/tazpkg	Tue Jan 03 19:16:23 2012 +0100
     1.3 @@ -2375,23 +2375,20 @@
     1.4  			esac
     1.5  		done
     1.6  		installed_md5=$LOCALSTATE/installed.md5
     1.7 -		pkg_desc=$LOCALSTATE/packages.desc
     1.8 -		pkg_list=$LOCALSTATE/packages.list
     1.9 -		pkg_md5=$LOCALSTATE/packages.md5
    1.10 -		if [ -f $LOCALSTATE/priority ]; then
    1.11 -			for i in $(cat $LOCALSTATE/priority); do
    1.12 -				if [ -f $LOCALSTATE/undigest/$i/mirror ]; then
    1.13 -					pkg_desc=$LOCALSTATE/undigest/$i/packages.desc
    1.14 -					pkg_list=$LOCALSTATE/undigest/$i/packages.list
    1.15 -					pkg_md5=$LOCALSTATE/undigest/$i/packages.md5
    1.16 +		look_for_priority
    1.17 +		for repo in $priority; do
    1.18 +			pkg_list=$repo/packages.list
    1.19 +			mtime=`find $pkg_list -mtime +7`
    1.20 +			if [ "$mtime" ]; then
    1.21 +				if [ "$repo" = "$LOCALSTATE" ]; then
    1.22 +					repo_name=main
    1.23 +				else
    1.24 +					repo_name="${repo##*/}"
    1.25  				fi
    1.26 -			done
    1.27 -		fi
    1.28 -		mtime=`find $pkg_list -mtime +7`
    1.29 -		if [ "$mtime" ]; then
    1.30 -			gettext "Your packages list is older than one week... recharging"
    1.31 -			tazpkg recharge
    1.32 -		fi
    1.33 +				eval_gettext "\$pkg_list is older than one week... recharging"; echo
    1.34 +				tazpkg recharge $repo_name
    1.35 +			fi
    1.36 +		done
    1.37  		echo -en "\n\033[1m"
    1.38  		gettext "Package"
    1.39  		echo -en "\033[26G " && gettext "Update type"
    1.40 @@ -2406,14 +2403,23 @@
    1.41  			. $pkg/receipt
    1.42  			md5=$(fgrep "  $PACKAGE-${VERSION}$EXTRAVERSION.tazpkg" \
    1.43  				$installed_md5 | awk '{print $1}')
    1.44 -			if ! fgrep -q "$md5  $PACKAGE-" $pkg_md5; then
    1.45 -				# Skip when not found on mirror (local package)
    1.46 -				grep -q ^$PACKAGE- $pkg_list || continue
    1.47 -				new=$(grep "^$PACKAGE |" $pkg_desc | awk '{print $3}')
    1.48 -				if $(grep -qs "^$PACKAGE" $BLOCKED); then
    1.49 +			for repo in $priority; do
    1.50 +				pkg_desc=$repo/packages.desc
    1.51 +				pkg_list=$repo/packages.list
    1.52 +				pkg_md5=$repo/packages.md5
    1.53 +
    1.54 +				if ! fgrep -q "$md5  $PACKAGE-" $pkg_md5; then
    1.55 +					# Jump to next repository in priority if pkg doesn't exists
    1.56 +					# in this one.
    1.57 +					grep -q ^$PACKAGE- $pkg_list || continue
    1.58 +
    1.59  					# Skip pkgs listed in $LOCALSTATE/blocked-packages.list
    1.60 -					blocked_count=$(($blocked_count+1))
    1.61 -				else
    1.62 +					if $(grep -qs "^$PACKAGE" $BLOCKED); then
    1.63 +						blocked_count=$(($blocked_count+1))
    1.64 +						break
    1.65 +					fi
    1.66 +					
    1.67 +					new=$(grep "^$PACKAGE |" $pkg_desc | awk '{print $3}')
    1.68  					if [ "$VERSION" == "$new" ]; then
    1.69  						echo -n "$PACKAGE"
    1.70  						echo -e "\\033[26G `gettext \"New build   :\"` $md5"
    1.71 @@ -2422,8 +2428,9 @@
    1.72  						echo -e "\\033[26G `gettext \"New version :\"` $new"
    1.73  					fi
    1.74  					echo "$PACKAGE" >> $UP_LIST
    1.75 +					break
    1.76  				fi
    1.77 -			fi
    1.78 +			done
    1.79  		done
    1.80  		sed -i /^$/d $UP_LIST
    1.81  		upnb=$(cat $UP_LIST | wc -l)