# HG changeset patch # User Pascal Bellard # Date 1225293335 0 # Node ID f58f1abdbbe64a12376e51b150db665cc6466502 # Parent cf614e32ecb91c23b57bfe9c41a2331638a8094d Add build support for upgrade using package md5 diff -r cf614e32ecb9 -r f58f1abdbbe6 tazpkg --- a/tazpkg Tue Oct 28 19:35:11 2008 +0000 +++ b/tazpkg Wed Oct 29 15:15:35 2008 +0000 @@ -288,7 +288,7 @@ { local i for i in $(cat $MIRROR $LOCALSTATE/undigest/*/mirror 2> /dev/null); do - download_from "$i" "$@" + download_from "$i" "$@" && break done } @@ -319,6 +319,9 @@ # Make the installed package data dir to store # the receipt and the files list. mkdir -p $ROOT$INSTALLED/$PACKAGE + sed -i "/\/$(basename $PACKAGE_FILE)$/d" \ + $ROOT$LOCALSTATE/installed.md5 2> /dev/null + md5sum $PACKAGE_FILE >> $ROOT$LOCALSTATE/installed.md5 ) # Resolve package deps. check_for_deps $ROOT @@ -1568,7 +1571,14 @@ # Compare version. Upgrade are only available for official # packages, so we control de mirror and it should be ok if # we just check for egality. - if [ "$VERSION" != "$NEW_VERSION" ]; then + RELEASE="" + if [ -f installed.md5 -a -f packages.md5 ]; then + current_md5=$(grep -s "/$PACKAGE-$VERSION" installed.md5 | awk '{ print $1 }') + new_md5=$(grep -s " $PACKAGE-$VERSION" packages.md5 | awk '{ print $1 }') + [ -n "$current_md5" ] && [ -n "$new_md5" ] && + [ "$current_md5" != "$new_md5" ] && RELEASE=build + fi + if [ "$VERSION" != "$NEW_VERSION" -o -n "$RELEASE" ]; then # Version seems different. Check for major, minor or # revision PKG_MAJOR=`echo ${VERSION%_*} | cut -f1 -d"."` @@ -1646,8 +1656,8 @@ # If anser is yes (y). Install all new versions. cat upgradeable-packages.list >> upgradeable-packages.list$$ mv -f upgradeable-packages.list$$ upgradeable-packages.list - yes y | tazpkg get-install-list upgradeable-packages.list - #rm -f upgradeable-packages.list + yes y | tazpkg get-install-list upgradeable-packages.list --forced + rm -f upgradeable-packages.list ;; bugs) # Show known bugs in package(s)