forked from rpms/leapp-repository
41 lines
2.1 KiB
Diff
41 lines
2.1 KiB
Diff
From fbb7cda3ea9c41a42cce7e6f24c6baa66cd9f9e0 Mon Sep 17 00:00:00 2001
|
|
From: Matej Matuska <mmatuska@redhat.com>
|
|
Date: Thu, 18 Sep 2025 20:21:47 +0200
|
|
Subject: [PATCH 62/69] lib/version: Also peform version correction when target
|
|
is centos
|
|
|
|
Currently the version "autocorrection" is performed only when the source
|
|
system is centos, however we might get a major only version even when
|
|
the source doesn't use them and the target does. For example when
|
|
matching whether a version is between source and target version as is
|
|
done in peseventsscanner.
|
|
|
|
Jira: RHEL-110563
|
|
---
|
|
repos/system_upgrade/common/libraries/config/version.py | 9 ++++++---
|
|
1 file changed, 6 insertions(+), 3 deletions(-)
|
|
|
|
diff --git a/repos/system_upgrade/common/libraries/config/version.py b/repos/system_upgrade/common/libraries/config/version.py
|
|
index 5efa932d..84cbd753 100644
|
|
--- a/repos/system_upgrade/common/libraries/config/version.py
|
|
+++ b/repos/system_upgrade/common/libraries/config/version.py
|
|
@@ -198,9 +198,12 @@ def matches_version(match_list, detected):
|
|
raise TypeError("Detected version has to be a string "
|
|
"but provided was {}: '{}'".format(type(detected), detected))
|
|
|
|
- # If we are on CentOS, and we are provided with a version of the form MAJOR, try to correct
|
|
- # the version into MAJOR.MINOR using virtual versions
|
|
- if api.current_actor().configuration.os_release.release_id == 'centos':
|
|
+ # If we are on CentOS, or the target is CentOS and we are provided with a
|
|
+ # version of the form MAJOR, try to correct the version into MAJOR.MINOR
|
|
+ # using virtual versions
|
|
+ # Cannot use get_source_distro_id and get_target_distro_id here because of circular imports
|
|
+ distro_config = api.current_actor().configuration.distro
|
|
+ if distro_config.source == 'centos' or distro_config.target == 'centos':
|
|
new_detected = _autocorrect_centos_version(detected)
|
|
# We might have a matchlist ['> 8', '<= 9'] that, e.g., results from blindly using source/target versions
|
|
# to make a matchlist. Our `detected` version might be some fixed string, e.g., `9.1`. So we need to
|
|
--
|
|
2.51.1
|
|
|