Skip to content

Commit

Permalink
repo-add: unconditionally create the database if it is missing
Browse files Browse the repository at this point in the history
In f91fa54 (repo-add: do not recreate the database if nothing was changed),
repo-add was made to skip database write-out if there were no changes to
the database. However, this breaks the usage of repo-add to create a new
empty database: `repo-add /path/to/mydb/mydb.db.tar.xz`.

Bring back support for this use-case by always writing the database if
it is missing.

Fixes: f91fa54
  • Loading branch information
intelfx authored and lazka committed May 9, 2024
1 parent c6ffd04 commit 761a878
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion scripts/repo-add.sh.in
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ USE_COLOR='y'
PREVENT_DOWNGRADE=0
INCLUDE_SIGS=0
DB_MODIFIED=0
DB_MISSING=0

# Import libmakepkg
source "$MAKEPKG_LIBRARY"/util/compress.sh
Expand Down Expand Up @@ -440,6 +441,8 @@ prepare_repo_db() {
exit 1
fi
rm -f "$dbfile"
# mark the db for unconditional update
DB_MISSING=1
;;
esac
fi
Expand Down Expand Up @@ -710,7 +713,7 @@ if (( fail )); then
exit 1
fi

if (( DB_MODIFIED )); then
if (( DB_MODIFIED || DB_MISSING )); then
msg "$(gettext "Creating updated database file '%s'")" "$REPO_DB_FILE"
create_db
rotate_db
Expand Down

0 comments on commit 761a878

Please sign in to comment.