rhn-client-tools/SOURCES/104-Handle-dmidecode-dependencies-for-OL8-aarch64-builds.patch

69 lines
2.1 KiB
Diff

From 9093fca59d6bce1195df4eb53e8f75073970f59a Mon Sep 17 00:00:00 2001
From: Laurence Rochfort <laurence.rochfort@oracle.com>
Date: Tue, 9 Feb 2021 15:37:57 +0000
Subject: [PATCH] Handle dmidecode dependencies for OL8 aarch64 builds
Port patches from base OS rhn-client-tools to allow dmidecode build
for OL8 aarch64.
- Related: #1622145 - don't run dmi_warnings() if there's no dmidecode
(tkasparek@redhat.com)
- Related: #1622145 - split into arch package (tkasparek@redhat.com)
- Resolves: #1622145 - drop dmidecode dependency on non x86_64 arches
(tkasparek@redhat.com)
Orabug: 31414043
Signed-off-by: Laurence Rochfort <laurence.rochfort@oracle.com>
Reviewed-by: Anton Krylov <anton.krylov@oracle.com>
---
client/rhel/rhn-client-tools/src/up2date_client/hardware.py | 11 ++++++++---
1 file changed, 8 insertions(+), 3 deletions(-)
diff --git a/client/rhel/rhn-client-tools/src/up2date_client/hardware.py b/client/rhel/rhn-client-tools/src/up2date_client/hardware.py
index 62a0c2f..7cb1e65 100644
--- a/client/rhel/rhn-client-tools/src/up2date_client/hardware.py
+++ b/client/rhel/rhn-client-tools/src/up2date_client/hardware.py
@@ -46,6 +46,12 @@ try:
except ImportError:
netifaces_present = False
+try:
+ import dmidecode
+ dmidecode_present = True
+except ImportError:
+ dmidecode_present = False
+
import gettext
t = gettext.translation('rhn-client-tools', fallback=True)
# Python 3 translations don't have a ugettext method
@@ -54,7 +60,6 @@ if not hasattr(t, 'ugettext'):
_ = t.ugettext
import dbus
-import dmidecode
from up2date_client import up2dateLog
try:
@@ -83,7 +88,7 @@ except ImportError:
# this does not change, we can cache it
_dmi_data = None
-_dmi_not_available = 0
+_dmi_not_available = 0 if dmidecode_present else 1
def dmi_warnings():
if not hasattr(dmidecode, 'get_warnings'):
@@ -91,7 +96,7 @@ def dmi_warnings():
return dmidecode.get_warnings()
-dmi_warn = dmi_warnings()
+dmi_warn = None if _dmi_not_available else dmi_warnings()
if dmi_warn:
dmidecode.clear_warnings()
log = up2dateLog.initLog()
--
2.9.5