Skip to content

Commit

Permalink
Use library functions for getting leapp packages
Browse files Browse the repository at this point in the history
Instead of harcoded list of leapp packages let's rely on
native leapp library functions that were introduced a few
commits ago.

OAMG-5645
  • Loading branch information
fernflower committed Jan 11, 2024
1 parent e4ff608 commit ea22bff
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
from leapp.exceptions import StopActorExecutionError
from leapp.libraries.actor import peseventsscanner_repomap
from leapp.libraries.actor.pes_event_parsing import Action, get_pes_events, Package
from leapp.libraries.common import rpms
from leapp.libraries.common.config import version
from leapp.libraries.stdlib import api
from leapp.libraries.stdlib.config import is_verbose
Expand Down Expand Up @@ -481,11 +482,8 @@ def apply_transaction_configuration(source_pkgs):


def remove_leapp_related_events(events):
leapp_pkgs = [
'leapp', 'leapp-deps', 'leapp-upgrade-el7toel8', 'leapp-upgrade-el8toel9',
'leapp-upgrade-el7toel8-deps', 'leapp-upgrade-el8toel9-deps', 'python2-leapp',
'python3-leapp', 'snactor'
]
leapp_pkgs = rpms.get_leapp_dep_packages(
major_version=['7', '8']) + rpms.get_leapp_packages(major_version=['7', '8'])
res = []
for event in events:
if not any(pkg.name in leapp_pkgs for pkg in event.in_pkgs):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -404,7 +404,10 @@ def test_pkgs_are_demodularized_when_crossing_major_version(monkeypatch):
assert target_pkgs == expected_target_pkgs


def test_remove_leapp_related_events():
def test_remove_leapp_related_events(monkeypatch):
# NOTE(ivasilev) That's required to use leapp library functions that rely on calls to
# get_source/target_system_version functions
monkeypatch.setattr(api, 'current_actor', CurrentActorMocked(arch='x86_64', src_ver='7.9', dst_ver='8.8'))
# these are just hypothetical and not necessarily correct
package_set_two_leapp = {Package('leapp-upgrade-el7toel8', 'repoid-rhel7', None),
Package('leapp-upgrade-el7toel8-deps', 'repoid-rhel7', None)}
Expand Down

0 comments on commit ea22bff

Please sign in to comment.