Skip to content

Commit cf2842d

Browse files
committed
pacman-helper: add a command to upload missing .sig files
Now that the Git for Windows-specific GPG keys should have made it to every Git for Windows SDK, we need to make sure that all of the .sig files are uploaded properly. Let's automate that. Signed-off-by: Johannes Schindelin <[email protected]>
1 parent 32131b1 commit cf2842d

File tree

1 file changed

+89
-1
lines changed

1 file changed

+89
-1
lines changed

pacman-helper.sh

Lines changed: 89 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ export CURL_CA_BUNDLE
3737

3838
mode=
3939
case "$1" in
40-
fetch|add|remove|push|files|dirs|orphans)
40+
fetch|add|remove|push|files|dirs|orphans|push_missing_signatures)
4141
mode="$1"
4242
shift
4343
;;
@@ -368,6 +368,94 @@ push () {
368368
publish package-database $next_db_version
369369
}
370370
371+
file_exists () { # arch filename
372+
curl -sfI "$base_url/$1/$2" >/dev/null
373+
}
374+
375+
push_missing_signatures () {
376+
list="$((for arch in $architectures
377+
do
378+
dir="$(arch_dir $arch)"
379+
package_list "$dir/git-for-windows.db.tar.xz"
380+
done) |
381+
sort | uniq)"
382+
383+
db_version="$(db_version)"
384+
385+
for name in $list
386+
do
387+
count=0
388+
basename=${name%%-[0-9]*}
389+
version=${name#$basename-}
390+
for arch in $architectures sources
391+
do
392+
case "$name,$arch" in
393+
mingw-w64-i686,x86_64|mingw-w64-x86_64,i686)
394+
# wrong architecture
395+
continue
396+
;;
397+
mingw-w64-i686-*,sources)
398+
# sources are "included" in x86_64
399+
continue
400+
;;
401+
mingw-w64-x86_64-*,sources)
402+
# sources are "included" in x86_64
403+
filename=mingw-w64${name#*_64}.src.tar.gz
404+
;;
405+
*,sources)
406+
filename=$name.src.tar.gz
407+
;;
408+
mingw-w64-*)
409+
filename=$name-any.pkg.tar.xz
410+
;;
411+
*)
412+
filename=$name-$arch.pkg.tar.xz
413+
;;
414+
esac
415+
dir="$(arch_dir $arch)" &&
416+
if test ! -f "$dir"/$filename.sig ||
417+
file_exists $arch $filename.sig
418+
then
419+
continue
420+
fi &&
421+
(cd "$dir" &&
422+
echo "Uploading missing $arch/$filename.sig" &&
423+
upload $basename $version $arch $filename.sig) || exit
424+
count=$(($count+1))
425+
done
426+
test $count = 0 || {
427+
echo "Re-publishing $basename $version" &&
428+
publish $basename $version
429+
} ||
430+
die "Could not re-publish $basename $version"
431+
done
432+
433+
count=0
434+
for arch in $architectures
435+
do
436+
for suffix in db db.tar.xz files files.tar.xz
437+
do
438+
filename=git-for-windows.$suffix
439+
dir="$(arch_dir $arch)"
440+
if test ! -f "$dir"/$filename.sig ||
441+
file_exists $arch $filename.sig
442+
then
443+
continue
444+
fi
445+
(cd "$dir" &&
446+
echo "Uploading missing $arch/$filename.sig" &&
447+
upload package-database $db_version $arch \
448+
$filename.sig) || exit
449+
count=$(($count+1))
450+
done || exit
451+
done
452+
test $count = 0 || {
453+
echo "Re-publishing db $db_version" &&
454+
publish package-database $db_version
455+
} ||
456+
die "Could not re-publish db $db_version"
457+
}
458+
371459
reset_fifo_files () {
372460
rm -f "$fifo_find"
373461
rm -f "$fifo_pacman"

0 commit comments

Comments
 (0)