diff --git a/.github/workflows/fedora-repos.yml b/.github/workflows/fedora-repos.yml index a95bd791d..2517ae741 100644 --- a/.github/workflows/fedora-repos.yml +++ b/.github/workflows/fedora-repos.yml @@ -18,3 +18,6 @@ jobs: # note: we only compare double digit keys not to be concerned with some of the historical cruft run: | diff -u <(ls -1 fedora-repos/RPM-GPG-KEY-fedora-??-primary | xargs -n 1 basename) <(ls -1 keys/fedora/RPM-GPG-KEY-fedora-??-primary | xargs -n 1 basename) + - name: Check rawhide key points to correct release key + run: | + diff -u <(awk '$1 == "%global" && $2 == "rawhide_release" { print "RPM-GPG-KEY-fedora-"$3"-primary" }' fedora-repos/fedora-repos.spec) <(readlink keys/fedora/RPM-GPG-KEY-fedora-rawhide-primary) diff --git a/check-fedora-rawhide.sh b/check-fedora-rawhide.sh new file mode 100755 index 000000000..6ac62bc00 --- /dev/null +++ b/check-fedora-rawhide.sh @@ -0,0 +1,52 @@ +#!/bin/sh +# +# Check and update Fedora Rawhide release version +# Requires fedora-repos-rawhide installed + +PKG=fedora-gpg-keys + +key_path() { + echo "keys/fedora/RPM-GPG-KEY-fedora-$1-primary" +} + +check_path() { + local NAME="$1" + local VERSION="$2" + + NAME_PATH="$(key_path $NAME)" + RELEASE_PATH="$(key_path $VERSION)" + + if [ "$(realpath "$NAME_PATH")" = "$(realpath "$RELEASE_PATH")" ]; then + echo "Fedora $NAME key is up-to-date" + else + rm -f "$NAME_PATH" + echo "Fedora $NAME key needs change: $RELEASE_PATH" + ln -vs "$(basename -- "$RELEASE_PATH")" "$NAME_PATH" + fi +} + +# Use the same algorithm as in github workflow +git_rawhide_release() { + local REPOSDIR="$(mktemp -d)" + git clone -q https://src.fedoraproject.org/rpms/fedora-repos.git --depth 1 --branch rawhide "$REPOSDIR" >/dev/null + awk '$1 == "%global" && $2 == "rawhide_release" { print $3 }' "$REPOSDIR/fedora-repos.spec" && rm -rf "$REPOSDIR" +} + +dnf_rawhide_release() { + PKG_VER=$(dnf --repo=rawhide repoquery -q fedora-gpg-keys) + echo "${PKG_VER#$PKG}" | cut -d- -f2 | cut -d: -f2 +} + +VER=$(git_rawhide_release) +echo "Release: $VER" +if ! [ "$VER" -gt 0 ]; then + echo "Failed to obtain rawhide release" + exit 1 +fi + +echo "Current Rawhide is release $VER" + +check_path rawhide $VER +check_path rawhide+1 $((VER+1)) +check_path rawhide-1 $((VER-1)) +check_path rawhide-2 $((VER-2)) diff --git a/keys/fedora/RPM-GPG-KEY-fedora-rawhide+1-primary b/keys/fedora/RPM-GPG-KEY-fedora-rawhide+1-primary new file mode 120000 index 000000000..3a3ce9f33 --- /dev/null +++ b/keys/fedora/RPM-GPG-KEY-fedora-rawhide+1-primary @@ -0,0 +1 @@ +RPM-GPG-KEY-fedora-43-primary \ No newline at end of file diff --git a/keys/fedora/RPM-GPG-KEY-fedora-rawhide-1-primary b/keys/fedora/RPM-GPG-KEY-fedora-rawhide-1-primary new file mode 120000 index 000000000..c8a161364 --- /dev/null +++ b/keys/fedora/RPM-GPG-KEY-fedora-rawhide-1-primary @@ -0,0 +1 @@ +RPM-GPG-KEY-fedora-41-primary \ No newline at end of file diff --git a/keys/fedora/RPM-GPG-KEY-fedora-rawhide-2-primary b/keys/fedora/RPM-GPG-KEY-fedora-rawhide-2-primary new file mode 120000 index 000000000..676f10b00 --- /dev/null +++ b/keys/fedora/RPM-GPG-KEY-fedora-rawhide-2-primary @@ -0,0 +1 @@ +RPM-GPG-KEY-fedora-40-primary \ No newline at end of file