Skip to content

Commit 94dde8c

Browse files
committed
pacman-helper quick_add: verify that the old/new Pacman repos are in sync
Git for Windows' current Pacman repository is hosted on Azure Blobs. The intended new Pacman repository is actually a Git repository hosted on GitHub: https://github.com/git-for-windows/pacman-repo The `pacman-helper.sh` script was taught in the preceding commit to update both synchronously, not just the Azure Blobs one. To ensure that this is all working as intended, let's make extra certain that these two Pacman repositories have not diverged before making any changes. This uncovered a bug where the `sanitize_db` function would update the signature file even if that was not desired nor necessary. We fix that here because said "are we in sync?" check would otherwise fail. Signed-off-by: Johannes Schindelin <[email protected]>
1 parent 3fca5c7 commit 94dde8c

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

pacman-helper.sh

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -164,6 +164,10 @@ sanitize_db () { # <file>...
164164
then
165165
for path in "$@"
166166
do
167+
if test -f "$path.sig" && call_gpg --verify "$path.sig"
168+
then
169+
continue
170+
fi
167171
call_gpg --detach-sign --no-armor -u $GPGKEY "$path" ||
168172
die "Could not sign $path"
169173
done
@@ -340,7 +344,15 @@ quick_add () { # <file>...
340344
sanitize_db "$dir/$arch/${file%.tar.xz}" || return 1
341345
done
342346
done
347+
343348
(cd "$dir/$arch" &&
349+
# Verify that the package databases are synchronized
350+
git update-index --refresh &&
351+
git diff-files --quiet &&
352+
git diff-index --quiet HEAD -- ||
353+
die "The package databases in $arch differ between Azure Blobs and pacman-repo"
354+
355+
# Now add the files to the Pacman database
344356
repo_add $sign_option git-for-windows-$arch.db.tar.xz $msys $mingw &&
345357
{ test ! -h git-for-windows-$arch.db || rm git-for-windows-$arch.db; } &&
346358
cp git-for-windows-$arch.db.tar.xz git-for-windows-$arch.db && {

0 commit comments

Comments
 (0)