Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fedora rawhide check #121

Open
wants to merge 5 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .github/workflows/fedora-repos.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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)
52 changes: 52 additions & 0 deletions check-fedora-rawhide.sh
Original file line number Diff line number Diff line change
@@ -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))
1 change: 1 addition & 0 deletions keys/fedora/RPM-GPG-KEY-fedora-rawhide+1-primary
1 change: 1 addition & 0 deletions keys/fedora/RPM-GPG-KEY-fedora-rawhide-1-primary
1 change: 1 addition & 0 deletions keys/fedora/RPM-GPG-KEY-fedora-rawhide-2-primary