- Improve set_systemd_services_states logging - [IPU 7 -> 8] Fix detection of bootable device on RAID - Fix detection of valid sshd config with internal-sftp subsystem in Leapp - Handle a false positive GPG check error when TargetUserSpaceInfo is missing - Fix failing "update-ca-trust" command caused by missing util-linux package - Improve report when a system is unsupported - Fix handling of versions in RHUI configuration for ELS and SAP upgrades - Add missing RHUI GCP config info for RHEL for SAP - Resolves: RHEL-33902, RHEL-30573, RHEL-43978, RHEL-39046, RHEL-39047, RHEL-39049
121 lines
5.3 KiB
Diff
121 lines
5.3 KiB
Diff
From 10bda0186b680b56fc6b32ac8fcd099c37f4189c Mon Sep 17 00:00:00 2001
|
|
From: Michal Reznik <mreznik@redhat.com>
|
|
Date: Sat, 20 Apr 2024 10:46:43 +0200
|
|
Subject: [PATCH 84/92] IPU 9 -> 10: Migrate & rebuild RPM DB
|
|
|
|
The RPM DB has been moved from /var/lib/rpm to /usr/lib/sysimage/rpm
|
|
in RHEL 10. Apply the change and create symlink in the original
|
|
path to the new one as expected.
|
|
|
|
Also rebuild the RPM DB to ensure it's compatible with the new RPM
|
|
version. Previously the RPM DB was being rebuilt during IPU 8 -> 9.
|
|
However after discussion with RPM SMEs it has been decided that this
|
|
is actually very reasonable to do always. So applying for any upgrade
|
|
path but IPU 7 -> 8 (let's do not change this one so much when it's
|
|
kind of finished).
|
|
|
|
Co-authored-by: Matej Matuska <mmatuska@redhat.com>
|
|
---
|
|
.../common/libraries/dnfplugin.py | 4 +--
|
|
.../el9toel10/actors/migraterpmdb/actor.py | 30 +++++++++++++++++++
|
|
.../migraterpmdb/tests/test_migraterpmdb.py | 11 +++++++
|
|
repos/system_upgrade/el9toel10/tools/.gitkeep | 0
|
|
.../el9toel10/tools/migraterpmdb | 4 +++
|
|
5 files changed, 47 insertions(+), 2 deletions(-)
|
|
create mode 100644 repos/system_upgrade/el9toel10/actors/migraterpmdb/actor.py
|
|
create mode 100644 repos/system_upgrade/el9toel10/actors/migraterpmdb/tests/test_migraterpmdb.py
|
|
delete mode 100644 repos/system_upgrade/el9toel10/tools/.gitkeep
|
|
create mode 100755 repos/system_upgrade/el9toel10/tools/migraterpmdb
|
|
|
|
diff --git a/repos/system_upgrade/common/libraries/dnfplugin.py b/repos/system_upgrade/common/libraries/dnfplugin.py
|
|
index d09cb90a..4f0c3a99 100644
|
|
--- a/repos/system_upgrade/common/libraries/dnfplugin.py
|
|
+++ b/repos/system_upgrade/common/libraries/dnfplugin.py
|
|
@@ -357,7 +357,7 @@ def install_initramdisk_requirements(packages, target_userspace_info, used_repos
|
|
mount_binds = ['/:/installroot']
|
|
with _prepare_transaction(used_repos=used_repos, target_userspace_info=target_userspace_info,
|
|
binds=mount_binds) as (context, target_repoids, _unused):
|
|
- if get_target_major_version() == '9':
|
|
+ if int(get_target_major_version()) >= 9:
|
|
_rebuild_rpm_db(context)
|
|
repos_opt = [['--enablerepo', repo] for repo in target_repoids]
|
|
repos_opt = list(itertools.chain(*repos_opt))
|
|
@@ -446,7 +446,7 @@ def perform_transaction_install(target_userspace_info, storage_info, used_repos,
|
|
# set like that, however seatbelt is a good thing.
|
|
dnfconfig.exclude_leapp_rpms(context, disable_plugins)
|
|
|
|
- if get_target_major_version() == '9':
|
|
+ if int(get_target_major_version()) >= 9:
|
|
_rebuild_rpm_db(context, root='/installroot')
|
|
_transaction(
|
|
context=context, stage='upgrade', target_repoids=target_repoids, plugin_info=plugin_info,
|
|
diff --git a/repos/system_upgrade/el9toel10/actors/migraterpmdb/actor.py b/repos/system_upgrade/el9toel10/actors/migraterpmdb/actor.py
|
|
new file mode 100644
|
|
index 00000000..80adbeb3
|
|
--- /dev/null
|
|
+++ b/repos/system_upgrade/el9toel10/actors/migraterpmdb/actor.py
|
|
@@ -0,0 +1,30 @@
|
|
+from leapp.actors import Actor
|
|
+from leapp.models import DNFWorkaround
|
|
+from leapp.tags import FactsPhaseTag, IPUWorkflowTag
|
|
+
|
|
+
|
|
+class MigrateRPMDB(Actor):
|
|
+ """
|
|
+ Register a workaround to migrate RPM DB during the upgrade.
|
|
+
|
|
+ The RPM DB has been moved from /var/lib/rpm to /usr/lib/sysimage/rpm
|
|
+ in RHEL 10. So register "migraterpmdb" script to handle it during various
|
|
+ parts of the upgrade process. The script moves the dir and create symlink
|
|
+ /var/lib/rpm -> /usr/lib/sysimage/rpm.
|
|
+
|
|
+ Note that we realized we should also rebuild the RPM DB, however this is
|
|
+ handled already in common upgrade repository. So deal here just with paths.
|
|
+ """
|
|
+
|
|
+ name = 'migrate_rpm_db'
|
|
+ consumes = ()
|
|
+ produces = (DNFWorkaround,)
|
|
+ tags = (IPUWorkflowTag, FactsPhaseTag)
|
|
+
|
|
+ def process(self):
|
|
+ self.produce(
|
|
+ DNFWorkaround(
|
|
+ display_name="Migrate RPM DB",
|
|
+ script_path=self.get_tool_path("migraterpmdb"),
|
|
+ )
|
|
+ )
|
|
diff --git a/repos/system_upgrade/el9toel10/actors/migraterpmdb/tests/test_migraterpmdb.py b/repos/system_upgrade/el9toel10/actors/migraterpmdb/tests/test_migraterpmdb.py
|
|
new file mode 100644
|
|
index 00000000..c66ad68e
|
|
--- /dev/null
|
|
+++ b/repos/system_upgrade/el9toel10/actors/migraterpmdb/tests/test_migraterpmdb.py
|
|
@@ -0,0 +1,11 @@
|
|
+import os.path
|
|
+
|
|
+from leapp.models import DNFWorkaround
|
|
+
|
|
+
|
|
+def test_migraterpmdb(current_actor_context):
|
|
+ current_actor_context.run()
|
|
+ assert len(current_actor_context.consume(DNFWorkaround)) == 1
|
|
+ assert current_actor_context.consume(DNFWorkaround)[0].display_name == 'Migrate RPM DB'
|
|
+ assert os.path.basename(current_actor_context.consume(DNFWorkaround)[0].script_path) == 'migraterpmdb'
|
|
+ assert os.path.exists(current_actor_context.consume(DNFWorkaround)[0].script_path)
|
|
diff --git a/repos/system_upgrade/el9toel10/tools/.gitkeep b/repos/system_upgrade/el9toel10/tools/.gitkeep
|
|
deleted file mode 100644
|
|
index e69de29b..00000000
|
|
diff --git a/repos/system_upgrade/el9toel10/tools/migraterpmdb b/repos/system_upgrade/el9toel10/tools/migraterpmdb
|
|
new file mode 100755
|
|
index 00000000..16700645
|
|
--- /dev/null
|
|
+++ b/repos/system_upgrade/el9toel10/tools/migraterpmdb
|
|
@@ -0,0 +1,4 @@
|
|
+#!/usr/bin/bash
|
|
+
|
|
+mv /var/lib/rpm /usr/lib/sysimage/rpm
|
|
+ln -sfr /usr/lib/sysimage/rpm /var/lib/rpm
|
|
--
|
|
2.42.0
|
|
|