diff options
-rw-r--r-- | scripts/makepkg.in | 33 |
1 files changed, 16 insertions, 17 deletions
diff --git a/scripts/makepkg.in b/scripts/makepkg.in index 8c573461..1bc6f3cc 100644 --- a/scripts/makepkg.in +++ b/scripts/makepkg.in @@ -601,43 +601,42 @@ create_package() { create_xdelta() { if [ "$(check_buildenv xdelta)" != "y" ]; then return + elif [ ! "$(type -p xdelta)" ]; then + error "$(gettext "Cannot find the xdelta binary! Is xdelta installed?")" + return fi - # Check to see if we have any old versions to create deltas with local pkg_file=$1 - local base_file="" - local delta_file="" - local cache_dir="/var/cache/pacman/pkg" - local latest_version="" - local old_versions=( $(ls ${cache_dir}/${pkgname}-*-${CARCH}.${PKGEXT} 2>/dev/null; ls ${PKGDEST}/${pkgname}-*-${CARCH}.${PKGEXT} 2>/dev/null) ) + 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_file dirname filename namend old_version + # 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 - dirname=$(dirname $old_file) - filename=$(basename $old_file) - namend=${filename#"$pkgname-"} - old_version=${namend%-"${CARCH}.${PKGEXT}"} - + old_version=$(basename "${old_file%-$CARCH.$PKGEXT}") + old_version=${old_version#$pkgname-} + # 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 - delta_file=$PKGDEST/$pkgname-${old_version}_to_$pkgver-$pkgrel-${CARCH}.delta fi done - if [ "$delta_file" != "" ]; then + if [ "$base_file" != "" ]; then msg "Making delta from version $latest_version" + 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) # 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 # denominator compression utility between the packager and the users # # makepkg and pacman must use the same compression algorithm or the delta generated # package may not match, producing md5 checksum errors. - # - xdelta patch $delta_file $base_file $pkg_file + xdelta patch "$delta_file" "$base_file" "$pkg_file" else msg "No previous version found, skipping xdelta" fi |