makepkg: fix create_xdelta() and add warning

Signed-off-by: Dan McGee <dan@archlinux.org>
This commit is contained in:
Ash Milsted 2007-06-02 12:42:36 -04:00 committed by Dan McGee
parent 40af40da4c
commit 111c0f71c3

View file

@ -760,12 +760,12 @@ create_xdelta() {
local pkg_file=$1 local pkg_file=$1
local cache_dir="/var/cache/pacman/pkg" # TODO: autoconf me local cache_dir="/var/cache/pacman/pkg" # TODO: autoconf me
local old_versions=( $(ls {"$cache_dir","$PKGDEST"}/${pkgname}-*-${CARCH}.${PKGEXT} 2>/dev/null) ) 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 # Check to see if we have any old versions to create deltas with
local old_file old_version latest_version base_file local old_file old_version latest_version base_file
for old_file in "${old_versions[@]}"; do for old_file in "${old_versions[@]}"; do
old_version=$(basename "${old_file%-$CARCH.$PKGEXT}") old_version=$(basename "${old_file%-$CARCH$PKGEXT}")
old_version=${old_version#$pkgname-} old_version=${old_version#$pkgname-}
# old_version may include the target package, only use the old versions # old_version may include the target package, only use the old versions
@ -776,21 +776,22 @@ create_xdelta() {
done done
if [ "$base_file" != "" ]; then if [ "$base_file" != "" ]; then
msg "Making delta from version $latest_version" 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-${old_version}_to_$pkgver-$pkgrel-$CARCH.delta"
# xdelta will decompress base_file & pkg_file into TMP_DIR (or /tmp if TMP_DIR is unset) # xdelta will decompress base_file & pkg_file into TMP_DIR (or /tmp if
# then perform the delta on the resulting tars # TMP_DIR is unset) then perform the delta on the resulting tars
xdelta delta "$base_file" "$pkg_file" "$delta_file" xdelta delta "$base_file" "$pkg_file" "$delta_file"
# Generate the final gz using xdelta for compression. xdelta will be our common # Generate the final gz using xdelta for compression. xdelta will be our
# denominator compression utility between the packager and the users # common denominator compression utility between the packager and the users
# # makepkg and pacman must use the same compression algorithm or the delta
# makepkg and pacman must use the same compression algorithm or the delta generated # generated package may not match, producing md5 checksum errors.
# package may not match, producing md5 checksum errors. msg2 "$(gettext "Recreating package tarball from delta to match md5 signatures")"
msg2 "$(gettext "NOTE: the delta should ONLY be distributed with this tarball")"
xdelta patch "$delta_file" "$base_file" "$pkg_file" xdelta patch "$delta_file" "$base_file" "$pkg_file"
else else
msg "No previous version found, skipping xdelta" warning "$(gettext "No previous version found, skipping xdelta.")"
fi fi
} }