1
0
mirror of https://github.com/moparisthebest/pacman synced 2024-12-23 00:08:50 -05:00

repo-add: only attempt to create deltas when asked

repo-add should only attempt to create the delta file when using the -d
option.

Also adjust a couple of tests to use the "double bracket" syntax.

Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
This commit is contained in:
Allan McRae 2011-01-23 00:13:24 +10:00 committed by Dan McGee
parent 3863e48788
commit b947db040c

View File

@ -234,9 +234,9 @@ db_write_entry()
if [[ -d $pkgname-$pkgver ]]; then if [[ -d $pkgname-$pkgver ]]; then
warning "$(gettext "An entry for '%s' already existed")" "$pkgname-$pkgver" warning "$(gettext "An entry for '%s' already existed")" "$pkgname-$pkgver"
else else
if [ $DELTA -eq 1 ]; then if (( DELTA )); then
pkgentry=$(find_pkgentry $pkgname) pkgentry=$(find_pkgentry $pkgname)
if [ -n "$pkgentry" ]; then if [[ -n $pkgentry ]]; then
local oldfilename=$(grep -A1 FILENAME $pkgentry/desc | tail -n1) local oldfilename=$(grep -A1 FILENAME $pkgentry/desc | tail -n1)
local oldfile="$(dirname $1)/$oldfilename" local oldfile="$(dirname $1)/$oldfilename"
fi fi
@ -302,16 +302,18 @@ db_write_entry()
fi fi
# create a delta file # create a delta file
if [ -n "$oldfilename" ]; then if (( DELTA )); then
if [ -f "$oldfile" ]; then if [[ -n $oldfilename ]]; then
if [[ -f $oldfile ]]; then
delta=$(pkgdelta -q $oldfile $1) delta=$(pkgdelta -q $oldfile $1)
if [ -f "$delta" ]; then if [[ -f $delta ]]; then
db_write_delta $delta db_write_delta $delta
fi fi
else else
warning "$(gettext "Old package file not found: %s")" "$oldfilename" warning "$(gettext "Old package file not found: %s")" "$oldfilename"
fi fi
fi fi
fi
return 0 return 0
} # end db_write_entry } # end db_write_entry