diff options
author | Allan McRae <allan@archlinux.org> | 2015-01-23 05:08:04 +0100 |
---|---|---|
committer | Allan McRae <allan@archlinux.org> | 2015-02-12 04:35:01 +0100 |
commit | b5b2f0b1bfdf52fb313d68a4134f46995166d4c4 (patch) | |
tree | 6b611d20062e47f555c0492f46cd07bd568ed655 /scripts | |
parent | 27e3125c8d65b169ac2e76c7f029ee3a4a170745 (diff) | |
download | pacman-b5b2f0b1bfdf52fb313d68a4134f46995166d4c4.tar.gz pacman-b5b2f0b1bfdf52fb313d68a4134f46995166d4c4.tar.xz |
repo-add: improve removing old packages
The -R/--remove option left the old package in place when delta packages
were to be generated. It was also removed before we ensure the generation
of the entry for the new package was generated without error.
Remove the old package at the end of database entry and delta generation. Also
improve the help message to clarify it is the old package that is removed.
Signed-off-by: Allan McRae <allan@archlinux.org>
Diffstat (limited to 'scripts')
-rw-r--r-- | scripts/repo-add.sh.in | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/scripts/repo-add.sh.in b/scripts/repo-add.sh.in index 5089f993..49b1c3e7 100644 --- a/scripts/repo-add.sh.in +++ b/scripts/repo-add.sh.in @@ -59,7 +59,7 @@ Multiple packages to add can be specified on the command line.\n")" printf -- "$(gettext "Options:\n")" printf -- "$(gettext " -d, --delta generate and add delta for package update\n")" printf -- "$(gettext " -n, --new only add packages that are not already in the database\n")" - printf -- "$(gettext " -R, --remove remove package file from disk when updating database entry\n")" + printf -- "$(gettext " -R, --remove remove old package file from disk after updating database\n")" printf -- "$(gettext " -f, --files update database's file list\n")" elif [[ $cmd == "repo-remove" ]] ; then printf -- "$(gettext "Usage: repo-remove [options] <path-to-db> <packagename|delta> ...\n")" @@ -306,14 +306,13 @@ db_write_entry() { local oldfilename=$(grep -A1 FILENAME "$pkgentry/desc" | tail -n1) local oldfile="$(dirname "$1")/$oldfilename" fi - elif (( RMEXISTING )); then - # only remove existing package if we're not doing deltas + fi + if (( RMEXISTING )); then + # gather information needed to remove old file pkgentry=$(find_pkgentry "$pkgname") if [[ -n $pkgentry ]]; then local oldfilename="$(sed -n '/^%FILENAME%$/ {n;p;q;}' "$pkgentry/desc")" local oldfile="$(dirname "$1")/$oldfilename" - msg2 "$(gettext "Removing existing package '%s'")" "$oldfilename" - rm -f ${oldfile} ${oldfile}.sig fi fi fi @@ -412,6 +411,11 @@ db_write_entry() { fi fi + if (( RMEXISTING )); then + msg2 "$(gettext "Removing old package file '%s'")" "$oldfilename" + rm -f ${oldfile} ${oldfile}.sig + fi + return 0 } # end db_write_entry |