public inbox for git-commits@fedoraproject.org
help / color / mirror / Atom feed
From: Lumir Balhar <lbalhar@redhat.com>
To: git-commits@fedoraproject.org
Subject: [tests/python] master: Make sure the downgrade operation is always reverted
Date: Wed, 08 Jul 2026 10:18:35 GMT	[thread overview]
Message-ID: <178350591571.1.6687024675822736046.tests-python-3bc0535c27d7@fedoraproject.org> (raw)

A new commit has been pushed.

Repo   : tests/python
Branch : master
Commit : 3bc0535c27d7f3e1e33d75035ae065fc5200040c
Author : Lumir Balhar <lbalhar@redhat.com>
Date   : 2026-07-07T08:32:41+02:00
Stats  : +15/-8 in 1 file(s)
URL    : https://src.fedoraproject.org/tests/python/c/3bc0535c27d7f3e1e33d75035ae065fc5200040c?branch=master

Log:
Make sure the downgrade operation is always reverted

---
diff --git a/required-symbols/check.sh b/required-symbols/check.sh
index ae328ca..f0727f9 100755
--- a/required-symbols/check.sh
+++ b/required-symbols/check.sh
@@ -19,6 +19,19 @@ set -eo pipefail
 PYVER=${VERSION}
 SCRIPT_DIR="$(dirname "$(realpath "${BASH_SOURCE[0]}")")"
 
+WORK_DIR=""
+DOWNGRADED=false
+
+cleanup() {
+    if [[ "$DOWNGRADED" == true ]]; then
+        echo ""
+        echo "=== Reverting package downgrade ==="
+        dnf history undo last -y 2>&1 || echo "WARNING: dnf history undo failed" >&2
+    fi
+    [[ -n "$WORK_DIR" ]] && rm -rf "$WORK_DIR"
+}
+trap cleanup EXIT
+
 # Directories containing compiled extension modules
 SCAN_DIRS=()
 for d in "/usr/lib64/python${PYVER}" "/usr/lib64/python${PYVER}t"; do
@@ -36,7 +49,6 @@ for f in /usr/lib64/libpython${PYVER}*.so.*; do
 done
 
 WORK_DIR=$(mktemp -d)
-trap 'rm -rf "$WORK_DIR"' EXIT
 
 echo "=== Collecting PR build symbols ==="
 python${PYVER} "$SCRIPT_DIR/collect_symbols.py" "${SCAN_ARGS[@]}" > "$WORK_DIR/new.json"
@@ -62,6 +74,7 @@ if ! dnf downgrade -y "${PKGS[@]}" 2>&1; then
     echo "INFO: dnf downgrade failed or no stable version available; skipping comparison." >&2
     exit 0
 fi
+DOWNGRADED=true
 
 echo ""
 echo "=== Collecting stable version symbols ==="
@@ -69,10 +82,4 @@ python${PYVER} "$SCRIPT_DIR/collect_symbols.py" "${SCAN_ARGS[@]}" > "$WORK_DIR/o
 
 echo ""
 echo "=== Comparing PR build against stable ==="
-python${PYVER} "$SCRIPT_DIR/compare_symbols.py" "$WORK_DIR/old.json" "$WORK_DIR/new.json" || COMPARE_RC=$?
-
-echo ""
-echo "=== Reverting package downgrade ==="
-dnf history undo last -y 2>&1
-
-exit ${COMPARE_RC:-0}
+python${PYVER} "$SCRIPT_DIR/compare_symbols.py" "$WORK_DIR/old.json" "$WORK_DIR/new.json"

                 reply	other threads:[~2026-07-08 10:18 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=178350591571.1.6687024675822736046.tests-python-3bc0535c27d7@fedoraproject.org \
    --to=lbalhar@redhat.com \
    --cc=git-commits@fedoraproject.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox