79ca77ccf4
- Do not terminate the upgrade dracut module execution if /sysroot/root/tmp_leapp_py3/.leapp_upgrade_failed exists - Several minor improvements in messages printed in console output - Several minor improvements in report and error messages - Fix the parsing of the lscpu output - Fix evaluation of PES data - Target by default always "GA" channel repositories unless a different channel is specified for the leapp execution - Fix creation of the post upgrade report about changes in states of systemd services - Update the device driver deprecation data, fixing invalid fields for some AMD CPUs - Update the default kernel cmdline - Wait for the storage initialization when /usr is on separate file system - covering SAN - Resolves: RHEL-27847, RHEL-35240
73 lines
4.1 KiB
Diff
73 lines
4.1 KiB
Diff
From 82070789813ae64f8fadc31a5096bf8df4124f75 Mon Sep 17 00:00:00 2001
|
|
From: mhecko <mhecko@redhat.com>
|
|
Date: Tue, 2 Apr 2024 11:24:49 +0200
|
|
Subject: [PATCH 08/34] pes_events_scanner: overwrite repositories when
|
|
applying an event
|
|
|
|
The Package class has custom __hash__ and __eq__ methods in order to
|
|
achieve a straightforward presentation via set manipulation. However,
|
|
this causes problems, e.g., when applying split events. For example:
|
|
Applying the event Split(in={(A, repo1)}, out={(A, repo2), (B, repo2)})
|
|
to the package state {(A, repo1), (B, repo1)} results in the following:
|
|
{(A, repo1), (B, repo1)} --apply--> {(A, repo2), (B, repo1)}
|
|
which is undesired as repo1 is a source system repository. Such
|
|
a package will get reported to the user as potentially removed during
|
|
the upgrade. This patch addresses this unwanted behavior.
|
|
---
|
|
.../peseventsscanner/libraries/pes_events_scanner.py | 9 ++++++++-
|
|
.../peseventsscanner/tests/test_pes_event_scanner.py | 9 +++++++++
|
|
2 files changed, 17 insertions(+), 1 deletion(-)
|
|
|
|
diff --git a/repos/system_upgrade/common/actors/peseventsscanner/libraries/pes_events_scanner.py b/repos/system_upgrade/common/actors/peseventsscanner/libraries/pes_events_scanner.py
|
|
index f9411dfe..f5cb2613 100644
|
|
--- a/repos/system_upgrade/common/actors/peseventsscanner/libraries/pes_events_scanner.py
|
|
+++ b/repos/system_upgrade/common/actors/peseventsscanner/libraries/pes_events_scanner.py
|
|
@@ -139,8 +139,11 @@ def compute_pkg_changes_between_consequent_releases(source_installed_pkgs,
|
|
if event.action == Action.PRESENT:
|
|
for pkg in event.in_pkgs:
|
|
if pkg in seen_pkgs:
|
|
+ # First remove the package with the old repository and add it back, but now with the new
|
|
+ # repository. As the Package class has a custom __hash__ and __eq__ comparing only name
|
|
+ # and modulestream, the pkg.repository field is ignore and therefore the add() call
|
|
+ # does not update the entry.
|
|
if pkg in target_pkgs:
|
|
- # Remove the package with the old repository, add the one with the new one
|
|
target_pkgs.remove(pkg)
|
|
target_pkgs.add(pkg)
|
|
elif event.action == Action.DEPRECATED:
|
|
@@ -163,7 +166,11 @@ def compute_pkg_changes_between_consequent_releases(source_installed_pkgs,
|
|
event.id, event.action, removed_pkgs_str, added_pkgs_str)
|
|
|
|
# In pkgs are present, event can be applied
|
|
+ # Note: We do a .difference(event.out_packages) followed by an .union(event.out_packages) to overwrite
|
|
+ # # repositories of the packages (Package has overwritten __hash__ and __eq__, ignoring
|
|
+ # # the repository field)
|
|
target_pkgs = target_pkgs.difference(event.in_pkgs)
|
|
+ target_pkgs = target_pkgs.difference(event.out_pkgs)
|
|
target_pkgs = target_pkgs.union(event.out_pkgs)
|
|
|
|
pkgs_to_demodularize = pkgs_to_demodularize.difference(event.in_pkgs)
|
|
diff --git a/repos/system_upgrade/common/actors/peseventsscanner/tests/test_pes_event_scanner.py b/repos/system_upgrade/common/actors/peseventsscanner/tests/test_pes_event_scanner.py
|
|
index 7cdcf820..80ece770 100644
|
|
--- a/repos/system_upgrade/common/actors/peseventsscanner/tests/test_pes_event_scanner.py
|
|
+++ b/repos/system_upgrade/common/actors/peseventsscanner/tests/test_pes_event_scanner.py
|
|
@@ -123,6 +123,15 @@ def pkgs_into_tuples(pkgs):
|
|
[(8, 0)],
|
|
{Package('renamed-out', 'rhel8-repo', None)}
|
|
),
|
|
+ (
|
|
+ {Package('A', 'rhel7-repo', None), Package('B', 'rhel7-repo', None)},
|
|
+ [
|
|
+ Event(1, Action.SPLIT, {Package('A', 'rhel7-repo', None)},
|
|
+ {Package('A', 'rhel8-repo', None), Package('B', 'rhel8-repo', None)}, (7, 6), (8, 0), [])
|
|
+ ],
|
|
+ [(8, 0)],
|
|
+ {Package('A', 'rhel8-repo', None), Package('B', 'rhel8-repo', None)}
|
|
+ ),
|
|
)
|
|
)
|
|
def test_event_application_fundamentals(monkeypatch, installed_pkgs, events, releases, expected_target_pkgs):
|
|
--
|
|
2.42.0
|
|
|