forked from rpms/leapp-repository
Update ELevate patch
This commit is contained in:
parent
a7c657c2b2
commit
3d5217f69d
@ -1,5 +1,5 @@
|
||||
diff --git a/README.md b/README.md
|
||||
index 4de458b..9975f06 100644
|
||||
index 4de458b..c82651d 100644
|
||||
--- a/README.md
|
||||
+++ b/README.md
|
||||
@@ -1,7 +1,61 @@
|
||||
@ -83,7 +83,7 @@ index 4de458b..9975f06 100644
|
||||
- When filing an issue, include:
|
||||
- Steps to reproduce the issue
|
||||
- *All files in /var/log/leapp*
|
||||
@@ -25,7 +88,613 @@
|
||||
@@ -25,7 +88,638 @@
|
||||
Then you may attach only the `leapp-logs.tgz` file.
|
||||
|
||||
### Where can I seek help?
|
||||
@ -191,14 +191,39 @@ index 4de458b..9975f06 100644
|
||||
+Required fields:
|
||||
+
|
||||
+- action: what action to perform on the listed package
|
||||
+- 0 - present
|
||||
+- 1 - removed
|
||||
+- 2 - deprecated
|
||||
+- 3 - replaced
|
||||
+- 4 - split
|
||||
+- 5 - merged
|
||||
+- 6 - moved to new repository
|
||||
+- 7 - renamed
|
||||
+ - 0 - present
|
||||
+ - keep the packages in `in_packageset` to make sure the repo they're in on the target system gets enabled
|
||||
+ - additional behaviour present, see below
|
||||
+ - 1 - removed
|
||||
+ - remove all packages in `in_packageset`
|
||||
+ - 2 - deprecated
|
||||
+ - keep the packages in `in_packageset` to make sure the repo they're in on the target system gets enabled
|
||||
+ - 3 - replaced
|
||||
+ - remove all packages in `in_packageset`
|
||||
+ - install parts of the `out_packageset` that are not present on the system
|
||||
+ - keep the packages from `out_packageset` that are already installed
|
||||
+ - 4 - split
|
||||
+ - install parts of the `out_packageset` that are not present on the system
|
||||
+ - keep the present `out_packageset`
|
||||
+ - remove packages from `in_packageset` that are not present in `out_packageset`
|
||||
+ - in case of package X being split to Y and Z, package X will be removed
|
||||
+ - in case of package X being split to X and Y, package X will **not** be removed
|
||||
+ - 5 - merged
|
||||
+ - same as `split`
|
||||
+ - additional behaviour present, see below
|
||||
+ - 6 - moved to new repository
|
||||
+ - keep the package to make sure the repo it's in on the target system gets enabled
|
||||
+ - nothing is done to `in_packageset` as it always contains one package - the same as the "out" package
|
||||
+ - 7 - renamed
|
||||
+ - remove the `in_packageset` and install the `out_packageset` if not installed
|
||||
+ - if already installed, keep the `out_packageset` as-is
|
||||
+ - 8 - reinstalled
|
||||
+ - reinstall the `in_packageset` package during the upgrade transaction
|
||||
+ - mostly useful for packages that have the same version string between major versions, and thus won't be upgraded automatically
|
||||
+ - Additional notes:
|
||||
+ - any event except `present` is ignored if any of packages in `in_packageset` are marked for removal
|
||||
+ - any event except `merged` is ignored if any of packages in `in_packageset` are neither installed nor marked for installation
|
||||
+ - for `merged` events it is sufficient to have at least one package from `in_packageset` are either installed or marked for installation
|
||||
+- arches: what system architectures the listed entry relates to
|
||||
+- id: entry ID, must be unique
|
||||
+- in_packageset: set of packages on the old system
|
||||
@ -835,6 +860,15 @@ index 75ffa6a..379d480 100644
|
||||
+ for position, report in enumerate(inhibitors, start=1):
|
||||
+ logger.error('{idx:5}. Inhibitor: {title}'.format(idx=position, title=report['title']))
|
||||
+ logger.info('Consult the pre-upgrade report for details and possible remediation.')
|
||||
diff --git a/etc/leapp/transaction/to_reinstall b/etc/leapp/transaction/to_reinstall
|
||||
new file mode 100644
|
||||
index 0000000..c6694a8
|
||||
--- /dev/null
|
||||
+++ b/etc/leapp/transaction/to_reinstall
|
||||
@@ -0,0 +1,3 @@
|
||||
+### List of packages (each on new line) to be reinstalled to the upgrade transaction
|
||||
+### Useful for packages that have identical version strings but contain binary changes between major OS versions
|
||||
+### Packages that aren't installed will be skipped
|
||||
diff --git a/packaging/leapp-repository.spec b/packaging/leapp-repository.spec
|
||||
index af4b31d..0d8f6c8 100644
|
||||
--- a/packaging/leapp-repository.spec
|
||||
@ -1752,10 +1786,10 @@ index 14bd6e3..f6adacf 100755
|
||||
# This should not happen as /etc/initrd-release is supposed to have API
|
||||
# stability, but check is better than broken system.
|
||||
diff --git a/repos/system_upgrade/common/actors/efibootorderfix/finalization/actor.py b/repos/system_upgrade/common/actors/efibootorderfix/finalization/actor.py
|
||||
index f42909f..171fdd2 100644
|
||||
index f42909f..2728cb4 100644
|
||||
--- a/repos/system_upgrade/common/actors/efibootorderfix/finalization/actor.py
|
||||
+++ b/repos/system_upgrade/common/actors/efibootorderfix/finalization/actor.py
|
||||
@@ -1,17 +1,101 @@
|
||||
@@ -1,17 +1,102 @@
|
||||
+import os
|
||||
+import re
|
||||
+
|
||||
@ -1793,6 +1827,7 @@ index f42909f..171fdd2 100644
|
||||
+ 'Oracle Linux Server': 'redhat',
|
||||
+ 'Red Hat Enterprise Linux': 'redhat',
|
||||
+ 'Rocky Linux': 'rocky',
|
||||
+ 'Scientific Linux': 'redhat',
|
||||
+ 'CloudLinux': 'centos',
|
||||
+ }
|
||||
+
|
||||
@ -1861,6 +1896,41 @@ index f42909f..171fdd2 100644
|
||||
+
|
||||
+ if not has_grub_cfg:
|
||||
+ run(['/sbin/grub2-mkconfig', '-o', grub_cfg_path])
|
||||
diff --git a/repos/system_upgrade/common/actors/filterrpmtransactionevents/actor.py b/repos/system_upgrade/common/actors/filterrpmtransactionevents/actor.py
|
||||
index e0d89d9..52f93ef 100644
|
||||
--- a/repos/system_upgrade/common/actors/filterrpmtransactionevents/actor.py
|
||||
+++ b/repos/system_upgrade/common/actors/filterrpmtransactionevents/actor.py
|
||||
@@ -32,6 +32,7 @@ class FilterRpmTransactionTasks(Actor):
|
||||
to_remove = set()
|
||||
to_keep = set()
|
||||
to_upgrade = set()
|
||||
+ to_reinstall = set()
|
||||
modules_to_enable = {}
|
||||
modules_to_reset = {}
|
||||
for event in self.consume(RpmTransactionTasks, PESRpmTransactionTasks):
|
||||
@@ -39,13 +40,14 @@ class FilterRpmTransactionTasks(Actor):
|
||||
to_install.update(event.to_install)
|
||||
to_remove.update(installed_pkgs.intersection(event.to_remove))
|
||||
to_keep.update(installed_pkgs.intersection(event.to_keep))
|
||||
+ to_reinstall.update(installed_pkgs.intersection(event.to_reinstall))
|
||||
modules_to_enable.update({'{}:{}'.format(m.name, m.stream): m for m in event.modules_to_enable})
|
||||
modules_to_reset.update({'{}:{}'.format(m.name, m.stream): m for m in event.modules_to_reset})
|
||||
|
||||
to_remove.difference_update(to_keep)
|
||||
|
||||
# run upgrade for the rest of RH signed pkgs which we do not have rule for
|
||||
- to_upgrade = installed_pkgs - (to_install | to_remove)
|
||||
+ to_upgrade = installed_pkgs - (to_install | to_remove | to_reinstall)
|
||||
|
||||
self.produce(FilteredRpmTransactionTasks(
|
||||
local_rpms=list(local_rpms),
|
||||
@@ -53,5 +55,6 @@ class FilterRpmTransactionTasks(Actor):
|
||||
to_remove=list(to_remove),
|
||||
to_keep=list(to_keep),
|
||||
to_upgrade=list(to_upgrade),
|
||||
+ to_reinstall=list(to_reinstall),
|
||||
modules_to_reset=list(modules_to_reset.values()),
|
||||
modules_to_enable=list(modules_to_enable.values())))
|
||||
diff --git a/repos/system_upgrade/common/actors/ipuworkflowconfig/libraries/ipuworkflowconfig.py b/repos/system_upgrade/common/actors/ipuworkflowconfig/libraries/ipuworkflowconfig.py
|
||||
index edf978f..7fea4ec 100644
|
||||
--- a/repos/system_upgrade/common/actors/ipuworkflowconfig/libraries/ipuworkflowconfig.py
|
||||
@ -1935,10 +2005,25 @@ index fadf76b..7ef2664 100644
|
||||
+ if pesfile[:-len(pes_json_suffix)] in active_vendors:
|
||||
+ pes_events_scanner(VENDORS_DIR, pesfile)
|
||||
diff --git a/repos/system_upgrade/common/actors/peseventsscanner/libraries/peseventsscanner.py b/repos/system_upgrade/common/actors/peseventsscanner/libraries/peseventsscanner.py
|
||||
index 1be2caa..072de17 100644
|
||||
index 1be2caa..aca8a72 100644
|
||||
--- a/repos/system_upgrade/common/actors/peseventsscanner/libraries/peseventsscanner.py
|
||||
+++ b/repos/system_upgrade/common/actors/peseventsscanner/libraries/peseventsscanner.py
|
||||
@@ -138,19 +138,26 @@ def _get_repositories_mapping(target_pesids):
|
||||
@@ -59,12 +59,14 @@ class Action(IntEnum):
|
||||
MERGED = 5
|
||||
MOVED = 6
|
||||
RENAMED = 7
|
||||
+ REINSTALLED = 8
|
||||
|
||||
|
||||
class Task(IntEnum):
|
||||
KEEP = 0
|
||||
INSTALL = 1
|
||||
REMOVE = 2
|
||||
+ REINSTALL = 3
|
||||
|
||||
def past(self):
|
||||
return ['kept', 'installed', 'removed'][self]
|
||||
@@ -138,19 +140,26 @@ def _get_repositories_mapping(target_pesids):
|
||||
:return: Dictionary with all repositories mapped.
|
||||
"""
|
||||
|
||||
@ -1975,7 +2060,15 @@ index 1be2caa..072de17 100644
|
||||
# NOTE: We have to calculate expected target repositories
|
||||
# like in the setuptargetrepos actor. It's planned to handle this in different
|
||||
# way in future...
|
||||
@@ -324,7 +331,7 @@ def parse_pes_events(json_data):
|
||||
@@ -233,6 +242,7 @@ def get_transaction_configuration():
|
||||
transaction_configuration.to_install.extend(tasks.to_install)
|
||||
transaction_configuration.to_remove.extend(tasks.to_remove)
|
||||
transaction_configuration.to_keep.extend(tasks.to_keep)
|
||||
+ transaction_configuration.to_reinstall.extend(tasks.to_reinstall)
|
||||
return transaction_configuration
|
||||
|
||||
|
||||
@@ -324,7 +334,7 @@ def parse_pes_events(json_data):
|
||||
:return: List of Event tuples, where each event contains event type and input/output pkgs
|
||||
"""
|
||||
data = json.loads(json_data)
|
||||
@ -1984,6 +2077,135 @@ index 1be2caa..072de17 100644
|
||||
raise ValueError('Found PES data with invalid structure')
|
||||
|
||||
return list(chain(*[parse_entry(entry) for entry in data['packageinfo']]))
|
||||
@@ -565,6 +575,13 @@ def process_events(releases, events, installed_pkgs):
|
||||
if event.action in [Action.RENAMED, Action.REPLACED, Action.REMOVED]:
|
||||
add_packages_to_tasks(current, event.in_pkgs, Task.REMOVE)
|
||||
|
||||
+ if event.action == Action.REINSTALLED:
|
||||
+ # These packages have the same version string but differ in contents.
|
||||
+ # noarch packages will most likely work fine after the upgrade, but
|
||||
+ # the others may break due to library/binary incompatibilities.
|
||||
+ # This is why we mark them for reinstallation.
|
||||
+ add_packages_to_tasks(current, event.in_pkgs, Task.REINSTALL)
|
||||
+
|
||||
do_not_remove = set()
|
||||
for package in current[Task.REMOVE]:
|
||||
if package in tasks[Task.KEEP]:
|
||||
@@ -572,6 +589,11 @@ def process_events(releases, events, installed_pkgs):
|
||||
'{p} :: {r} to be kept / currently removed - removing package'.format(
|
||||
p=package[0], r=current[Task.REMOVE][package]))
|
||||
del tasks[Task.KEEP][package]
|
||||
+ if package in tasks[Task.REINSTALL]:
|
||||
+ api.current_logger().warning(
|
||||
+ '{p} :: {r} to be reinstalled / currently removed - removing package'.format(
|
||||
+ p=package[0], r=current[Task.REMOVE][package]))
|
||||
+ del tasks[Task.REINSTALL][package]
|
||||
elif package in tasks[Task.INSTALL]:
|
||||
api.current_logger().warning(
|
||||
'{p} :: {r} to be installed / currently removed - ignoring tasks'.format(
|
||||
@@ -599,6 +621,11 @@ def process_events(releases, events, installed_pkgs):
|
||||
'{p} :: {r} to be removed / currently kept - keeping package'.format(
|
||||
p=package[0], r=current[Task.KEEP][package]))
|
||||
del tasks[Task.REMOVE][package]
|
||||
+ if package in tasks[Task.REINSTALL]:
|
||||
+ api.current_logger().warning(
|
||||
+ '{p} :: {r} to be reinstalled / currently kept - keeping package'.format(
|
||||
+ p=package[0], r=current[Task.KEEP][package]))
|
||||
+ del tasks[Task.REINSTALL][package]
|
||||
|
||||
for key in Task: # noqa: E1133; pylint: disable=not-an-iterable
|
||||
for package in current[key]:
|
||||
@@ -610,7 +637,9 @@ def process_events(releases, events, installed_pkgs):
|
||||
|
||||
map_repositories(tasks[Task.INSTALL])
|
||||
map_repositories(tasks[Task.KEEP])
|
||||
+ map_repositories(tasks[Task.REINSTALL])
|
||||
filter_out_pkgs_in_blacklisted_repos(tasks[Task.INSTALL])
|
||||
+ filter_out_pkgs_in_blacklisted_repos(tasks[Task.REINSTALL])
|
||||
resolve_conflicting_requests(tasks)
|
||||
|
||||
return tasks
|
||||
@@ -689,15 +718,24 @@ def resolve_conflicting_requests(tasks):
|
||||
-> without this function, sip would reside in both [Task.KEEP] and [Task.REMOVE], causing a dnf conflict
|
||||
"""
|
||||
pkgs_in_conflict = set()
|
||||
- for pkg in list(tasks[Task.INSTALL].keys()) + list(tasks[Task.KEEP].keys()):
|
||||
+ preserve_keys = (
|
||||
+ list(tasks[Task.INSTALL].keys())
|
||||
+ + list(tasks[Task.KEEP].keys())
|
||||
+ + list(tasks[Task.REINSTALL].keys())
|
||||
+ )
|
||||
+
|
||||
+ for pkg in preserve_keys:
|
||||
if pkg in tasks[Task.REMOVE]:
|
||||
pkgs_in_conflict.add(pkg)
|
||||
del tasks[Task.REMOVE][pkg]
|
||||
|
||||
if pkgs_in_conflict:
|
||||
- api.current_logger().debug('The following packages were marked to be kept/installed and removed at the same'
|
||||
- ' time. Leapp will upgrade them.\n{}'.format(
|
||||
- '\n'.join(sorted(pkg[0] for pkg in pkgs_in_conflict))))
|
||||
+ api.current_logger().debug(
|
||||
+ "The following packages were marked to be kept/installed/reinstalled"
|
||||
+ " and removed at the same time. Leapp will upgrade them.\n{}".format(
|
||||
+ "\n".join(sorted(pkg[0] for pkg in pkgs_in_conflict))
|
||||
+ )
|
||||
+ )
|
||||
|
||||
|
||||
def get_repositories_blacklisted():
|
||||
@@ -773,7 +811,7 @@ def add_output_pkgs_to_transaction_conf(transaction_configuration, events):
|
||||
message = 'The following target system packages will not be installed:\n'
|
||||
|
||||
for event in events:
|
||||
- if event.action in (Action.SPLIT, Action.MERGED, Action.REPLACED, Action.RENAMED):
|
||||
+ if event.action in (Action.SPLIT, Action.MERGED, Action.REPLACED, Action.RENAMED, Action.REINSTALLED):
|
||||
if all([pkg.name in transaction_configuration.to_remove for pkg in event.in_pkgs]):
|
||||
transaction_configuration.to_remove.extend(pkg.name for pkg in event.out_pkgs)
|
||||
message += (
|
||||
@@ -800,6 +838,7 @@ def filter_out_transaction_conf_pkgs(tasks, transaction_configuration):
|
||||
"""
|
||||
do_not_keep = [p for p in tasks[Task.KEEP] if p[0] in transaction_configuration.to_remove]
|
||||
do_not_install = [p for p in tasks[Task.INSTALL] if p[0] in transaction_configuration.to_remove]
|
||||
+ do_not_reinstall = [p for p in tasks[Task.REINSTALL] if p[0] in transaction_configuration.to_remove]
|
||||
do_not_remove = [p for p in tasks[Task.REMOVE] if p[0] in transaction_configuration.to_install
|
||||
or p[0] in transaction_configuration.to_keep]
|
||||
|
||||
@@ -813,6 +852,12 @@ def filter_out_transaction_conf_pkgs(tasks, transaction_configuration):
|
||||
api.current_logger().debug('The following packages will not be installed because of the'
|
||||
' /etc/leapp/transaction/to_remove transaction configuration file:'
|
||||
'\n- ' + '\n- '.join(p[0] for p in sorted(do_not_install)))
|
||||
+ if do_not_reinstall:
|
||||
+ for pkg in do_not_reinstall:
|
||||
+ tasks[Task.REINSTALL].pop(pkg)
|
||||
+ api.current_logger().debug('The following packages will not be reinstalled because of the'
|
||||
+ ' /etc/leapp/transaction/to_remove transaction configuration file:'
|
||||
+ '\n- ' + '\n- '.join(p[0] for p in sorted(do_not_reinstall)))
|
||||
if do_not_remove:
|
||||
for pkg in do_not_remove:
|
||||
tasks[Task.REMOVE].pop(pkg)
|
||||
@@ -837,17 +882,20 @@ def produce_messages(tasks):
|
||||
# Type casting to list to be Py2&Py3 compatible as on Py3 keys() returns dict_keys(), not a list
|
||||
to_install_pkgs = sorted(tasks[Task.INSTALL].keys())
|
||||
to_remove_pkgs = sorted(tasks[Task.REMOVE].keys())
|
||||
+ to_reinstall_pkgs = sorted(tasks[Task.REINSTALL].keys())
|
||||
to_enable_repos = sorted(set(tasks[Task.INSTALL].values()) | set(tasks[Task.KEEP].values()))
|
||||
|
||||
- if to_install_pkgs or to_remove_pkgs:
|
||||
+ if to_install_pkgs or to_remove_pkgs or to_reinstall_pkgs:
|
||||
enabled_modules = _get_enabled_modules()
|
||||
modules_to_enable = [Module(name=p[1][0], stream=p[1][1]) for p in to_install_pkgs if p[1]]
|
||||
modules_to_reset = enabled_modules
|
||||
to_install_pkg_names = [p[0] for p in to_install_pkgs]
|
||||
to_remove_pkg_names = [p[0] for p in to_remove_pkgs]
|
||||
+ to_reinstall_pkg_names = [p[0] for p in to_reinstall_pkgs]
|
||||
|
||||
api.produce(PESRpmTransactionTasks(to_install=to_install_pkg_names,
|
||||
to_remove=to_remove_pkg_names,
|
||||
+ to_reinstall=to_reinstall_pkg_names,
|
||||
modules_to_enable=modules_to_enable,
|
||||
modules_to_reset=modules_to_reset))
|
||||
|
||||
diff --git a/repos/system_upgrade/common/actors/peseventsscanner/tests/unit_test_peseventsscanner.py b/repos/system_upgrade/common/actors/peseventsscanner/tests/unit_test_peseventsscanner.py
|
||||
index f4b02e9..c22165e 100644
|
||||
--- a/repos/system_upgrade/common/actors/peseventsscanner/tests/unit_test_peseventsscanner.py
|
||||
@ -2000,7 +2222,7 @@ index f4b02e9..c22165e 100644
|
||||
def test_pes_data_not_found(monkeypatch):
|
||||
def read_or_fetch_mocked(filename, directory="/etc/leapp/files", service=None, allow_empty=False):
|
||||
diff --git a/repos/system_upgrade/common/actors/redhatsignedrpmscanner/actor.py b/repos/system_upgrade/common/actors/redhatsignedrpmscanner/actor.py
|
||||
index 01f6df3..badb888 100644
|
||||
index 01f6df3..9a4990e 100644
|
||||
--- a/repos/system_upgrade/common/actors/redhatsignedrpmscanner/actor.py
|
||||
+++ b/repos/system_upgrade/common/actors/redhatsignedrpmscanner/actor.py
|
||||
@@ -1,27 +1,67 @@
|
||||
@ -2096,7 +2318,7 @@ index 01f6df3..badb888 100644
|
||||
|
||||
def is_gpg_pubkey(pkg):
|
||||
"""Check if gpg-pubkey pkg exists or LEAPP_DEVEL_RPMS_ALL_SIGNED=1
|
||||
@@ -44,15 +84,15 @@ class RedHatSignedRpmScanner(Actor):
|
||||
@@ -44,15 +84,30 @@ class RedHatSignedRpmScanner(Actor):
|
||||
gpg-pubkey is not signed as it would require another package
|
||||
to verify its signature
|
||||
"""
|
||||
@ -2114,10 +2336,25 @@ index 01f6df3..badb888 100644
|
||||
"""Whitelist the katello package."""
|
||||
- return pkg.name.startswith('katello-ca-consumer')
|
||||
+ return pkg.name.startswith("katello-ca-consumer")
|
||||
+
|
||||
+ def has_cpanel_prefix(pkg):
|
||||
+ """
|
||||
+ Whitelist the cPanel packages.
|
||||
+ A side effect of the cPanel's deployment method is that its packages both have no
|
||||
+ PGP signature and aren't associated with any package repository.
|
||||
+ They do, however, have a specific naming scheme that can be used to include them into
|
||||
+ the upgrade process.
|
||||
+ """
|
||||
+
|
||||
+ # NOTE: if another case like this and the above katello occurs, consider adding a
|
||||
+ # mechanism (a third-party extension) to do this in a way that allows extending it to
|
||||
+ # other configurations.
|
||||
+ # A separate file for the "vendors.d" folder with package name wildcards?
|
||||
+ return pkg.name.startswith("cpanel-")
|
||||
|
||||
def is_azure_pkg(pkg):
|
||||
"""Whitelist Azure config package."""
|
||||
@@ -68,16 +108,24 @@ class RedHatSignedRpmScanner(Actor):
|
||||
@@ -68,16 +123,25 @@ class RedHatSignedRpmScanner(Actor):
|
||||
for pkg in rpm_pkgs.items:
|
||||
if any(
|
||||
[
|
||||
@ -2125,6 +2362,7 @@ index 01f6df3..badb888 100644
|
||||
+ has_vendorsig(pkg),
|
||||
is_gpg_pubkey(pkg),
|
||||
has_katello_prefix(pkg),
|
||||
+ has_cpanel_prefix(pkg),
|
||||
is_azure_pkg(pkg),
|
||||
]
|
||||
):
|
||||
@ -2335,6 +2573,54 @@ index 3c0b04b..3480432 100644
|
||||
@pytest.fixture
|
||||
def adjust_cwd():
|
||||
previous_cwd = os.getcwd()
|
||||
diff --git a/repos/system_upgrade/common/actors/rpmtransactionconfigtaskscollector/libraries/rpmtransactionconfigtaskscollector.py b/repos/system_upgrade/common/actors/rpmtransactionconfigtaskscollector/libraries/rpmtransactionconfigtaskscollector.py
|
||||
index 05797f5..e6f7803 100644
|
||||
--- a/repos/system_upgrade/common/actors/rpmtransactionconfigtaskscollector/libraries/rpmtransactionconfigtaskscollector.py
|
||||
+++ b/repos/system_upgrade/common/actors/rpmtransactionconfigtaskscollector/libraries/rpmtransactionconfigtaskscollector.py
|
||||
@@ -18,21 +18,37 @@ def load_tasks_file(path, logger):
|
||||
return []
|
||||
|
||||
|
||||
+def filter_out(installed_rpm_names, to_filter, debug_msg):
|
||||
+ # These are the packages that aren't installed on the system.
|
||||
+ filtered_ok = [pkg for pkg in to_filter if pkg not in installed_rpm_names]
|
||||
+
|
||||
+ # And these ones are the ones that are.
|
||||
+ filtered_out = list(set(to_filter) - set(filtered_ok))
|
||||
+ if filtered_out:
|
||||
+ api.current_logger().debug(
|
||||
+ debug_msg +
|
||||
+ '\n- ' + '\n- '.join(filtered_out)
|
||||
+ )
|
||||
+ # We may want to use either of the two sets.
|
||||
+ return filtered_ok, filtered_out
|
||||
+
|
||||
+
|
||||
def load_tasks(base_dir, logger):
|
||||
# Loads configuration files to_install, to_keep, and to_remove from the given base directory
|
||||
rpms = next(api.consume(InstalledRedHatSignedRPM))
|
||||
rpm_names = [rpm.name for rpm in rpms.items]
|
||||
+
|
||||
to_install = load_tasks_file(os.path.join(base_dir, 'to_install'), logger)
|
||||
+ install_debug_msg = 'The following packages from "to_install" file will be ignored as they are already installed:'
|
||||
# we do not want to put into rpm transaction what is already installed (it will go to "to_upgrade" bucket)
|
||||
- to_install_filtered = [pkg for pkg in to_install if pkg not in rpm_names]
|
||||
+ to_install_filtered, _ = filter_out(rpm_names, to_install, install_debug_msg)
|
||||
|
||||
- filtered = set(to_install) - set(to_install_filtered)
|
||||
- if filtered:
|
||||
- api.current_logger().debug(
|
||||
- 'The following packages from "to_install" file will be ignored as they are already installed:'
|
||||
- '\n- ' + '\n- '.join(filtered))
|
||||
+ to_reinstall = load_tasks_file(os.path.join(base_dir, 'to_reinstall'), logger)
|
||||
+ reinstall_debug_msg = 'The following packages from "to_reinstall" file will be ignored as they are not installed:'
|
||||
+ _, to_reinstall_filtered = filter_out(rpm_names, to_reinstall, reinstall_debug_msg)
|
||||
|
||||
return RpmTransactionTasks(
|
||||
to_install=to_install_filtered,
|
||||
+ to_reinstall=to_reinstall_filtered,
|
||||
to_keep=load_tasks_file(os.path.join(base_dir, 'to_keep'), logger),
|
||||
to_remove=load_tasks_file(os.path.join(base_dir, 'to_remove'), logger))
|
||||
diff --git a/repos/system_upgrade/common/actors/scancustomrepofile/actor.py b/repos/system_upgrade/common/actors/scancustomrepofile/actor.py
|
||||
index d46018f..bb49b4e 100644
|
||||
--- a/repos/system_upgrade/common/actors/scancustomrepofile/actor.py
|
||||
@ -3049,6 +3335,27 @@ index 0000000..ba27cbb
|
||||
+ # self.produce(vendor_repomap_collection)
|
||||
+ # for repomap in vendor_repomap_collection.maps:
|
||||
+ # self.produce(repomap)
|
||||
diff --git a/repos/system_upgrade/common/files/rhel_upgrade.py b/repos/system_upgrade/common/files/rhel_upgrade.py
|
||||
index 62221a7..f5b4c70 100644
|
||||
--- a/repos/system_upgrade/common/files/rhel_upgrade.py
|
||||
+++ b/repos/system_upgrade/common/files/rhel_upgrade.py
|
||||
@@ -171,6 +171,7 @@ class RhelUpgradeCommand(dnf.cli.Command):
|
||||
to_install = self.plugin_data['pkgs_info']['to_install']
|
||||
to_remove = self.plugin_data['pkgs_info']['to_remove']
|
||||
to_upgrade = self.plugin_data['pkgs_info']['to_upgrade']
|
||||
+ to_reinstall = self.plugin_data['pkgs_info']['to_reinstall']
|
||||
|
||||
# Modules to enable
|
||||
self._process_entities(entities=[modules_to_enable], op=module_base.enable, entity_name='Module stream')
|
||||
@@ -181,6 +182,8 @@ class RhelUpgradeCommand(dnf.cli.Command):
|
||||
self._process_entities(entities=to_install, op=self.base.install, entity_name='Package')
|
||||
# Packages to be upgraded
|
||||
self._process_entities(entities=to_upgrade, op=self.base.upgrade, entity_name='Package')
|
||||
+ # Packages to be reinstalled
|
||||
+ self._process_entities(entities=to_reinstall, op=self.base.reinstall, entity_name='Package')
|
||||
|
||||
self.base.distro_sync()
|
||||
|
||||
diff --git a/repos/system_upgrade/common/libraries/config/version.py b/repos/system_upgrade/common/libraries/config/version.py
|
||||
index 03f3cd4..2ab78ea 100644
|
||||
--- a/repos/system_upgrade/common/libraries/config/version.py
|
||||
@ -3065,7 +3372,7 @@ index 03f3cd4..2ab78ea 100644
|
||||
|
||||
|
||||
diff --git a/repos/system_upgrade/common/libraries/dnfplugin.py b/repos/system_upgrade/common/libraries/dnfplugin.py
|
||||
index 4010e9f..fdb8e66 100644
|
||||
index 4010e9f..09085c0 100644
|
||||
--- a/repos/system_upgrade/common/libraries/dnfplugin.py
|
||||
+++ b/repos/system_upgrade/common/libraries/dnfplugin.py
|
||||
@@ -4,6 +4,8 @@ import json
|
||||
@ -3077,7 +3384,15 @@ index 4010e9f..fdb8e66 100644
|
||||
from leapp.exceptions import StopActorExecutionError
|
||||
from leapp.libraries.common import dnfconfig, guards, mounting, overlaygen, rhsm, utils
|
||||
from leapp.libraries.common.config.version import get_target_major_version, get_target_version
|
||||
@@ -213,10 +215,17 @@ def _transaction(context, stage, target_repoids, tasks, plugin_info, test=False,
|
||||
@@ -85,6 +87,7 @@ def build_plugin_data(target_repoids, debug, test, tasks, on_aws):
|
||||
'to_install': tasks.to_install,
|
||||
'to_remove': tasks.to_remove,
|
||||
'to_upgrade': tasks.to_upgrade,
|
||||
+ 'to_reinstall': tasks.to_reinstall,
|
||||
'modules_to_enable': ['{}:{}'.format(m.name, m.stream) for m in tasks.modules_to_enable],
|
||||
},
|
||||
'dnf_conf': {
|
||||
@@ -213,10 +216,17 @@ def _transaction(context, stage, target_repoids, tasks, plugin_info, test=False,
|
||||
message='Failed to execute dnf. Reason: {}'.format(str(e))
|
||||
)
|
||||
except CalledProcessError as e:
|
||||
@ -3297,6 +3612,18 @@ index c187333..ea6a75d 100644
|
||||
mapping = fields.List(fields.Model(RepoMapEntry), default=[])
|
||||
repositories = fields.List(fields.Model(PESIDRepositoryEntry), default=[])
|
||||
+ vendor = fields.Nullable(fields.String())
|
||||
diff --git a/repos/system_upgrade/common/models/rpmtransactiontasks.py b/repos/system_upgrade/common/models/rpmtransactiontasks.py
|
||||
index 7e2870d..05d4e94 100644
|
||||
--- a/repos/system_upgrade/common/models/rpmtransactiontasks.py
|
||||
+++ b/repos/system_upgrade/common/models/rpmtransactiontasks.py
|
||||
@@ -10,6 +10,7 @@ class RpmTransactionTasks(Model):
|
||||
to_keep = fields.List(fields.String(), default=[])
|
||||
to_remove = fields.List(fields.String(), default=[])
|
||||
to_upgrade = fields.List(fields.String(), default=[])
|
||||
+ to_reinstall = fields.List(fields.String(), default=[])
|
||||
modules_to_enable = fields.List(fields.Model(Module), default=[])
|
||||
modules_to_reset = fields.List(fields.Model(Module), default=[])
|
||||
|
||||
diff --git a/repos/system_upgrade/common/models/targetrepositories.py b/repos/system_upgrade/common/models/targetrepositories.py
|
||||
index 3604772..33f5dc8 100644
|
||||
--- a/repos/system_upgrade/common/models/targetrepositories.py
|
||||
@ -3584,3 +3911,56 @@ index 0cb9081..7a962b7 100644
|
||||
+ error = 'Failed to open sshd_config: {}'.format(str(err))
|
||||
+ api.current_logger().error(error)
|
||||
+ return
|
||||
diff --git a/repos/system_upgrade/el7toel8/actors/updateyumvars/actor.py b/repos/system_upgrade/el7toel8/actors/updateyumvars/actor.py
|
||||
new file mode 100644
|
||||
index 0000000..6252fba
|
||||
--- /dev/null
|
||||
+++ b/repos/system_upgrade/el7toel8/actors/updateyumvars/actor.py
|
||||
@@ -0,0 +1,18 @@
|
||||
+from leapp.actors import Actor
|
||||
+from leapp.libraries.actor import updateyumvars
|
||||
+from leapp.tags import ThirdPartyApplicationsPhaseTag, IPUWorkflowTag
|
||||
+
|
||||
+
|
||||
+class UpdateYumVars(Actor):
|
||||
+ """
|
||||
+ Update the files corresponding to the current major
|
||||
+ OS version in the /etc/yum/vars folder.
|
||||
+ """
|
||||
+
|
||||
+ name = 'update_yum_vars'
|
||||
+ consumes = ()
|
||||
+ produces = ()
|
||||
+ tags = (ThirdPartyApplicationsPhaseTag, IPUWorkflowTag)
|
||||
+
|
||||
+ def process(self):
|
||||
+ updateyumvars.vars_update()
|
||||
diff --git a/repos/system_upgrade/el7toel8/actors/updateyumvars/libraries/updateyumvars.py b/repos/system_upgrade/el7toel8/actors/updateyumvars/libraries/updateyumvars.py
|
||||
new file mode 100644
|
||||
index 0000000..b77f784
|
||||
--- /dev/null
|
||||
+++ b/repos/system_upgrade/el7toel8/actors/updateyumvars/libraries/updateyumvars.py
|
||||
@@ -0,0 +1,23 @@
|
||||
+import os
|
||||
+
|
||||
+from leapp.libraries.stdlib import api
|
||||
+
|
||||
+VAR_FOLDER = "/etc/yum/vars"
|
||||
+
|
||||
+
|
||||
+def vars_update():
|
||||
+ """ Iterate through and modify the variables. """
|
||||
+ if not os.path.isdir(VAR_FOLDER):
|
||||
+ api.current_logger().debug(
|
||||
+ "The {} directory doesn't exist. Nothing to do.".format(VAR_FOLDER)
|
||||
+ )
|
||||
+ return
|
||||
+
|
||||
+ for varfile_name in os.listdir(VAR_FOLDER):
|
||||
+ # cp_centos_major_version contains the current OS' major version.
|
||||
+ if varfile_name == 'cp_centos_major_version':
|
||||
+ varfile_path = os.path.join(VAR_FOLDER, varfile_name)
|
||||
+
|
||||
+ with open(varfile_path, 'w') as varfile:
|
||||
+ # Overwrite the value from outdated "7".
|
||||
+ varfile.write('8')
|
||||
|
@ -43,7 +43,7 @@ py2_byte_compile "%1" "%2"}
|
||||
Epoch: 1
|
||||
Name: leapp-repository
|
||||
Version: 0.16.0
|
||||
Release: 6%{?dist}.elevate.5
|
||||
Release: 6%{?dist}.elevate.6
|
||||
Summary: Repositories for leapp
|
||||
|
||||
License: ASL 2.0
|
||||
|
Loading…
Reference in New Issue
Block a user