repo-add: do not recreate the database if nothing was changed
Signed-off-by: Ivan Shapovalov <intelfx@intelfx.name> Signed-off-by: Allan McRae <allan@archlinux.org>
This commit is contained in:
parent
b4f11d5496
commit
f91fa546f6
1 changed files with 7 additions and 2 deletions
|
@ -43,6 +43,7 @@ CLEAN_LOCK=0
|
|||
USE_COLOR='y'
|
||||
PREVENT_DOWNGRADE=0
|
||||
INCLUDE_SIGS=0
|
||||
DB_MODIFIED=0
|
||||
|
||||
# Import libmakepkg
|
||||
source "$LIBRARY"/util/compress.sh
|
||||
|
@ -341,6 +342,8 @@ db_write_entry() {
|
|||
rm -f ${oldfile} ${oldfile}.sig
|
||||
fi
|
||||
|
||||
DB_MODIFIED=1
|
||||
|
||||
return 0
|
||||
} # end db_write_entry
|
||||
|
||||
|
@ -361,6 +364,8 @@ db_remove_entry() {
|
|||
local filesentry=$(echo "$pkgentry" | sed 's/\(.*\)\/db\//\1\/files\//')
|
||||
rm -rf "$filesentry"
|
||||
|
||||
DB_MODIFIED=1
|
||||
|
||||
pkgentry=$(find_pkgentry "$pkgname")
|
||||
done
|
||||
return $notfound
|
||||
|
@ -695,13 +700,13 @@ for arg in "${args[@]:1}"; do
|
|||
done
|
||||
|
||||
# if the whole operation was a success, re-zip and rotate databases
|
||||
if (( !fail )); then
|
||||
if (( !fail )) && (( DB_MODIFIED )); then
|
||||
msg "$(gettext "Creating updated database file '%s'")" "$REPO_DB_FILE"
|
||||
create_db
|
||||
rotate_db
|
||||
else
|
||||
msg "$(gettext "No packages modified, nothing to do.")"
|
||||
exit 1
|
||||
exit $(( fail != 0 ))
|
||||
fi
|
||||
|
||||
exit 0
|
||||
|
|
Loading…
Add table
Reference in a new issue