tazpkg rev 191

Add build support for upgrade using package md5
author Pascal Bellard <pascal.bellard@slitaz.org>
date Wed Oct 29 15:15:35 2008 +0000 (2008-10-29)
parents cf614e32ecb9
children 86f8433a56bf
files tazpkg
line diff
     1.1 --- a/tazpkg	Tue Oct 28 19:35:11 2008 +0000
     1.2 +++ b/tazpkg	Wed Oct 29 15:15:35 2008 +0000
     1.3 @@ -288,7 +288,7 @@
     1.4  {
     1.5  	local i
     1.6  	for i in $(cat $MIRROR $LOCALSTATE/undigest/*/mirror 2> /dev/null); do
     1.7 -		download_from "$i" "$@"
     1.8 +		download_from "$i" "$@" && break
     1.9  	done
    1.10  }
    1.11  
    1.12 @@ -319,6 +319,9 @@
    1.13  		# Make the installed package data dir to store
    1.14  		# the receipt and the files list.
    1.15  		mkdir -p $ROOT$INSTALLED/$PACKAGE
    1.16 +		sed -i "/\/$(basename $PACKAGE_FILE)$/d" \
    1.17 +			$ROOT$LOCALSTATE/installed.md5 2> /dev/null
    1.18 +		md5sum $PACKAGE_FILE >> $ROOT$LOCALSTATE/installed.md5
    1.19  	)
    1.20  	# Resolve package deps.
    1.21  	check_for_deps $ROOT
    1.22 @@ -1568,7 +1571,14 @@
    1.23  					# Compare version. Upgrade are only available for official
    1.24  					# packages, so we control de mirror and it should be ok if
    1.25  					# we just check for egality.
    1.26 -					if [ "$VERSION" != "$NEW_VERSION" ]; then
    1.27 +					RELEASE=""
    1.28 +					if [ -f installed.md5 -a -f packages.md5 ]; then
    1.29 +						current_md5=$(grep -s "/$PACKAGE-$VERSION" installed.md5 | awk '{ print $1 }')
    1.30 +						new_md5=$(grep -s "  $PACKAGE-$VERSION" packages.md5 | awk '{ print $1 }')
    1.31 +						[ -n "$current_md5" ] && [ -n "$new_md5" ] &&
    1.32 +						[ "$current_md5" != "$new_md5" ] && RELEASE=build
    1.33 +					fi
    1.34 +					if [ "$VERSION" != "$NEW_VERSION" -o -n "$RELEASE" ]; then
    1.35  						# Version seems different. Check for major, minor or 
    1.36  						# revision
    1.37  						PKG_MAJOR=`echo ${VERSION%_*} | cut -f1 -d"."`
    1.38 @@ -1646,8 +1656,8 @@
    1.39  		# If anser is yes (y). Install all new versions.
    1.40  		cat upgradeable-packages.list >> upgradeable-packages.list$$
    1.41  		mv -f upgradeable-packages.list$$ upgradeable-packages.list
    1.42 -		yes y | tazpkg get-install-list upgradeable-packages.list
    1.43 -		#rm -f upgradeable-packages.list
    1.44 +		yes y | tazpkg get-install-list upgradeable-packages.list --forced
    1.45 +		rm -f upgradeable-packages.list
    1.46  		;;
    1.47  	bugs)
    1.48  		# Show known bugs in package(s)