leapp-repository/0030-fix-lib-version-broken-_validate_version-on-RHEL-10.patch
Petr Stodulka cb46739ce0 IPU 9.7 -> 10.1: CTC 1 candidate 1
- Require leapp-framework >= 6.1
- Simplified use of the LiveMode experimental feature with additional enhancements
- Fix the check of deprecated PCI devices and drivers
- Add RHEL 10.1 product certificates
- Gracefully handle CentOS OS versioning style
- Ensure the leapp-upgrade-el9toel10 RPM is not touched during the upgrade transaction
- Create proper error message when swap of RHUI clients fails
- Introduced the --enable-experimental-feature to simplify use of experimental features
- Manage RPM GPG keys during the upgrade respecting used linux distributions
- Prevent a crach during post-upgrade phases when no custom SELinux modules needs to be migrated
- Update leapp upgrade data files
- Minor fixes in reports
- Resolves: RHEL-49402, RHEL-72544, RHEL-77175, RHEL-80334, RHEL-80335, RHEL-80336, RHEL-80550, RHEL-86689
2025-05-14 10:46:55 +02:00

41 lines
1.6 KiB
Diff

From 70557869df83660a1a0c31808cf9c97a2704aa9a Mon Sep 17 00:00:00 2001
From: Michal Hecko <mhecko@redhat.com>
Date: Mon, 21 Apr 2025 20:40:11 +0200
Subject: [PATCH 30/37] fix(lib/version): broken _validate_version on RHEL 10
The validate version used to split a given version on `.` and then
check that every fragment is a digit, which is false for RHEL 10
since `10` is not a digit.
---
repos/system_upgrade/common/libraries/config/version.py | 9 +++++----
1 file changed, 5 insertions(+), 4 deletions(-)
diff --git a/repos/system_upgrade/common/libraries/config/version.py b/repos/system_upgrade/common/libraries/config/version.py
index 24bb7729..2e837a61 100644
--- a/repos/system_upgrade/common/libraries/config/version.py
+++ b/repos/system_upgrade/common/libraries/config/version.py
@@ -1,4 +1,5 @@
import operator
+import re
import six
@@ -141,10 +142,10 @@ def _version_to_tuple(version):
def _validate_versions(versions):
- """Raise ``TypeError`` if provided versions are not strings in the form ``<integer>.<integer>``."""
- for ver in versions:
- split = ver.split('.')
- if not len(split) == 2 or not all(x.isdigit() for x in split):
+ """Raise ``ValueError`` if provided versions are not strings in the form ``<integer>.<integer>``."""
+ version_format_regex = re.compile(r'^([1-9]\d*)\.(\d+)$')
+ for version in versions:
+ if not re.match(version_format_regex, version):
raise ValueError("Versions have to be in the form of '<integer>.<integer>' "
"but provided was '{}'".format(versions))
--
2.49.0