diff options
author | Andrew Fyfe <andrew@neptune-one.net> | 2007-06-03 13:43:44 +0100 |
---|---|---|
committer | Dan McGee <dan@archlinux.org> | 2007-06-04 22:00:35 -0400 |
commit | b757cc9414d88cf6889b7df152065b0930bca9e7 (patch) | |
tree | 57526543d46652a9ec35b6edbad2ace4c7fe18e5 /scripts | |
parent | 241832853c39c68070e787d2669454ef89a8955d (diff) | |
download | pacman-b757cc9414d88cf6889b7df152065b0930bca9e7.tar.xz |
scripts/makepkg.in: Fix version comparision in create_xdelta().
Signed-off-by: Andrew Fyfe <andrew@neptune-one.net>
Diffstat (limited to 'scripts')
-rw-r--r-- | scripts/makepkg.in | 32 |
1 files changed, 20 insertions, 12 deletions
diff --git a/scripts/makepkg.in b/scripts/makepkg.in index 6fedd8a6..424fd9c9 100644 --- a/scripts/makepkg.in +++ b/scripts/makepkg.in @@ -835,24 +835,32 @@ create_xdelta() { local pkg_file=$1 local cache_dir="/var/cache/pacman/pkg" # TODO: autoconf me - local old_versions=( $(ls {"$cache_dir","$PKGDEST"}/${pkgname}-*-${CARCH}${PKGEXT} 2>/dev/null) ) - - # Check to see if we have any old versions to create deltas with - local old_file old_version latest_version base_file - for old_file in "${old_versions[@]}"; do - old_version=$(basename "${old_file%-$CARCH$PKGEXT}") - old_version=${old_version#$pkgname-} - + + local old_file old_version + for old_file in $(ls {"$cache_dir","$PKGDEST"}/${pkgname}-*-*{,-$CARCH}$PKGEXT 2>/dev/null); do + if [[ "$old_file" =~ "$CARCH" ]]; then + old_version=${old_file%-$CARCH$PKGEXT} + else + old_version=${old_file%$PKGEXT} + fi + + old_version=$(echo $old_version | \ + sed "s|^.*/${pkgname}-\([[:alnum:]_\.]*-[[:alnum:]_\.]*\)$|\1|" | \ + grep -v -e "^$cache_dir" -e "^$PKGDEST") + + [ "$old_version" = "" ] && continue + # old_version may include the target package, only use the old versions - if [ "$old_version" != "$pkgver-$pkgrel" ] && [[ "$old_version" > "$latest_version" ]]; then - latest_version=$old_version - base_file=$old_file + local vercmp=$(vercmp "$old_version" "$latest_version") + if [ "$old_version" != "$pkgver-$pkgrel" -a $vercmp -gt 0 ]; then + local latest_version=$old_version + local base_file=$old_file fi done if [ "$base_file" != "" ]; then msg "$(gettext "Making delta from version %s...")" "$latest_version" - local delta_file="$PKGDEST/$pkgname-${old_version}_to_$pkgver-$pkgrel-$CARCH.delta" + local delta_file="$PKGDEST/$pkgname-${latest_version}_to_$pkgver-$pkgrel-$CARCH.delta" # xdelta will decompress base_file & pkg_file into TMP_DIR (or /tmp if # TMP_DIR is unset) then perform the delta on the resulting tars |