MSYS2-packages/pacman/0031-repo-add-unconditionally-create-the-database-if-it-i.patch
Christoph Reiter 1915a138c0 pacman: Update to 6.1.0 (v2)
Same as #4584 but with an additional backport:
https://github.com/msys2/msys2-pacman/pull/49

Old message:

See msys2/msys2-pacman#45

makepkg.conf synced with the upstream version:
https://gitlab.archlinux.org/pacman/pacman/-/blob/v6.1.0/etc/makepkg.conf.in

Skip patches only changing CI configs
2024-05-09 09:45:39 +02:00

50 lines
1.4 KiB
Diff

From 761a878373f16db3c1825d1e8eea4c5167c36057 Mon Sep 17 00:00:00 2001
From: Ivan Shapovalov <intelfx@intelfx.name>
Date: Wed, 21 Feb 2024 09:35:57 +0100
Subject: [PATCH 31/N] repo-add: unconditionally create the database if it is
missing
In f91fa546 (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: f91fa546f65af9ca7cdbe2b419c181df609969b7
---
scripts/repo-add.sh.in | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/scripts/repo-add.sh.in b/scripts/repo-add.sh.in
index 5d37307..0efc17c 100644
--- a/scripts/repo-add.sh.in
+++ b/scripts/repo-add.sh.in
@@ -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
@@ -440,6 +441,8 @@ prepare_repo_db() {
exit 1
fi
rm -f "$dbfile"
+ # mark the db for unconditional update
+ DB_MISSING=1
;;
esac
fi
@@ -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