[pacman-dev] [PATCH] 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> --- scripts/repo-add.sh.in | 20 +++++++++++--------- 1 files changed, 11 insertions(+), 9 deletions(-) diff --git a/scripts/repo-add.sh.in b/scripts/repo-add.sh.in index 2929c96..9b79022 100644 --- a/scripts/repo-add.sh.in +++ b/scripts/repo-add.sh.in @@ -234,9 +234,9 @@ db_write_entry() if [[ -d $pkgname-$pkgver ]]; then warning "$(gettext "An entry for '%s' already existed")" "$pkgname-$pkgver" else - if [ $DELTA -eq 1 ]; then + if (( DELTA )); then pkgentry=$(find_pkgentry $pkgname) - if [ -n "$pkgentry" ]; then + if [[ -n $pkgentry ]]; then local oldfilename=$(grep -A1 FILENAME $pkgentry/desc | tail -n1) local oldfile="$(dirname $1)/$oldfilename" fi @@ -296,14 +296,16 @@ db_write_entry() fi # create a delta file - if [ -n "$oldfilename" ]; then - if [ -f "$oldfile" ]; then - delta=$(pkgdelta -q $oldfile $1) - if [ -f "$delta" ]; then - db_write_delta $delta + if (( DELTA )); then + if [[ -n $oldfilename ]]; then + if [[ -f $oldfile ]]; then + delta=$(pkgdelta -q $oldfile $1) + if [[ -f $delta ]]; then + db_write_delta $delta + fi + else + warning "$(gettext "Old package file not found: %s")" "$oldfilename" fi - else - warning "$(gettext "Old package file not found: %s")" "$oldfilename" fi fi -- 1.7.3.5
participants (1)
-
Allan McRae