public inbox for git-commits@fedoraproject.org
help / color / mirror / Atom feed
* [tests/python] master: Make sure the downgrade operation is always reverted
@ 2026-07-08 10:18 Lumir Balhar
  0 siblings, 0 replies; only message in thread
From: Lumir Balhar @ 2026-07-08 10:18 UTC (permalink / raw)
  To: git-commits

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"

^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2026-07-08 10:18 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-07-08 10:18 [tests/python] master: Make sure the downgrade operation is always reverted Lumir Balhar

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox