From 5325f9f295d897e40dbd275f0171c82aa6089697 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Petr=20Men=C5=A1=C3=ADk?= Date: Fri, 16 Aug 2024 22:37:46 +0200 Subject: [PATCH 1/5] Check and update Fedora Rawhide release version Requires fedora-repos-rawhide installed. Tests whether current Fedora rawhide points to correct release key. Creates also rawhide+1 and rawhide-1 links to preceding releases. Might be used by mock-core-configs package directly. --- check-fedora-rawhide.sh | 39 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) create mode 100755 check-fedora-rawhide.sh diff --git a/check-fedora-rawhide.sh b/check-fedora-rawhide.sh new file mode 100755 index 000000000..5526ac307 --- /dev/null +++ b/check-fedora-rawhide.sh @@ -0,0 +1,39 @@ +#!/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 +} + +PKG_VER=$(dnf --repo=rawhide repoquery -q fedora-gpg-keys) +if [ $? -ne 0 ]; then + echo "Failed to fetch keys" + exit 1 +fi +VER=$(echo "${PKG_VER#$PKG}" | cut -d- -f2 | cut -d: -f2) + +echo "Current Rawhide is release $VER" + +check_path rawhide $VER +check_path rawhide+1 $((VER+1)) +check_path rawhide-1 $((VER-1)) From 40f4c5419da1e3950447432f05b7d59b5c56fa05 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Petr=20Men=C5=A1=C3=ADk?= Date: Fri, 16 Aug 2024 22:40:44 +0200 Subject: [PATCH 2/5] Add new rawhide relative links Upcoming rawhide release key and previous release key is often required by various tools. Prepare symlinks, which can be updated by script on next Fedora branching. --- keys/fedora/RPM-GPG-KEY-fedora-rawhide+1-primary | 1 + keys/fedora/RPM-GPG-KEY-fedora-rawhide-1-primary | 1 + 2 files changed, 2 insertions(+) create mode 120000 keys/fedora/RPM-GPG-KEY-fedora-rawhide+1-primary create mode 120000 keys/fedora/RPM-GPG-KEY-fedora-rawhide-1-primary 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 From 18aa4d7a67a7fcf95813a7788368e030b3fcdff4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Petr=20Men=C5=A1=C3=ADk?= Date: Sat, 17 Aug 2024 15:08:17 +0200 Subject: [PATCH 3/5] Check rawhide key points to correct release key Obtain rawhide_release from spec file and check our rawhide key points to matching release. --- .github/workflows/fedora-repos.yml | 3 +++ 1 file changed, 3 insertions(+) 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) From f644b52da4b758c9c48ed24ce6a614b416001fb8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Petr=20Men=C5=A1=C3=ADk?= Date: Sat, 17 Aug 2024 15:28:28 +0200 Subject: [PATCH 4/5] Add also rawhide-2 for use in eln fedora-eln template uses rawhide+0, rawhide-1 and rawhide-2 keys. Unlike rawhide +1 and -1. Add additional managed link too. --- check-fedora-rawhide.sh | 1 + keys/fedora/RPM-GPG-KEY-fedora-rawhide-2-primary | 1 + 2 files changed, 2 insertions(+) create mode 120000 keys/fedora/RPM-GPG-KEY-fedora-rawhide-2-primary diff --git a/check-fedora-rawhide.sh b/check-fedora-rawhide.sh index 5526ac307..70f8abdcc 100755 --- a/check-fedora-rawhide.sh +++ b/check-fedora-rawhide.sh @@ -37,3 +37,4 @@ 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-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 From 83e902be56db231a5a17063bce5aeeffaa64e245 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Petr=20Men=C5=A1=C3=ADk?= Date: Sat, 17 Aug 2024 15:41:39 +0200 Subject: [PATCH 5/5] Switch to git fetching fedora-repos for rawhide release GitHub worflow already contains similar check. Use similar also for checking rawhide release here. It should work on any distribution having git and awk installed, for example ubuntu image. --- check-fedora-rawhide.sh | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/check-fedora-rawhide.sh b/check-fedora-rawhide.sh index 70f8abdcc..6ac62bc00 100755 --- a/check-fedora-rawhide.sh +++ b/check-fedora-rawhide.sh @@ -25,12 +25,24 @@ check_path() { fi } -PKG_VER=$(dnf --repo=rawhide repoquery -q fedora-gpg-keys) -if [ $? -ne 0 ]; then - echo "Failed to fetch keys" +# 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 -VER=$(echo "${PKG_VER#$PKG}" | cut -d- -f2 | cut -d: -f2) echo "Current Rawhide is release $VER"