diff options
author | Dale Ogilvie <pnyli0002@sneakemail.com> | 2007-05-30 11:50:42 +0100 |
---|---|---|
committer | Aaron Griffin <aaronmgriffin@gmail.com> | 2007-05-30 23:58:22 -0500 |
commit | cad44221c811af0c528589bd087531f8ece6257e (patch) | |
tree | 89b3dde0d9f040d2209fdd3cbcb782ed2ca6a76a /scripts | |
parent | a8c552d4770b50da1ed6248000392ac28fe17950 (diff) |
Clean up variable usage in create_xdelta() and add a check for the xdelta program.
Signed-off-by: Andrew Fyfe <andrew@neptune-one.net>
Diffstat (limited to 'scripts')
-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 |