Skip to content

Commit

Permalink
repo-add: do not recreate the database if nothing was changed
Browse files Browse the repository at this point in the history
Signed-off-by: Ivan Shapovalov <[email protected]>
Signed-off-by: Allan McRae <[email protected]>
  • Loading branch information
intelfx authored and allanmcrae committed Sep 30, 2023
1 parent b4f11d5 commit f91fa54
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions scripts/repo-add.sh.in
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -341,6 +342,8 @@ db_write_entry() {
rm -f ${oldfile} ${oldfile}.sig
fi

DB_MODIFIED=1

return 0
} # end db_write_entry

Expand All @@ -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
Expand Down Expand Up @@ -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

0 comments on commit f91fa54

Please sign in to comment.