Switch lsvmbus to Python3
Signed-off-by: Vitaly Kuznetsov <vkuznets@redhat.com>
This commit is contained in:
parent
a8c07a22d7
commit
d75d7b741d
@ -0,0 +1,48 @@
|
||||
From 1e2d32c6ee12b45823ba3cda0054a4bd843896fc Mon Sep 17 00:00:00 2001
|
||||
From: Olaf Hering <olaf@aepfle.de>
|
||||
Date: Tue, 5 Jun 2018 13:37:55 -0700
|
||||
Subject: [PATCH] tools: hv: update lsvmbus to be compatible with python3
|
||||
|
||||
Python3 changed the way how 'print' works.
|
||||
Adjust the code to a syntax that is understood by python2 and python3.
|
||||
|
||||
Signed-off-by: Olaf Hering <olaf@aepfle.de>
|
||||
Acked-by: Dexuan Cui <decui@microsoft.com>
|
||||
Signed-off-by: K. Y. Srinivasan <kys@microsoft.com>
|
||||
---
|
||||
tools/hv/lsvmbus | 12 ++++++------
|
||||
1 file changed, 6 insertions(+), 6 deletions(-)
|
||||
|
||||
diff --git a/tools/hv/lsvmbus b/tools/hv/lsvmbus
|
||||
index 353e56768df8..55e7374bade0 100644
|
||||
--- a/tools/hv/lsvmbus
|
||||
+++ b/tools/hv/lsvmbus
|
||||
@@ -17,7 +17,7 @@ if options.verbose is not None:
|
||||
|
||||
vmbus_sys_path = '/sys/bus/vmbus/devices'
|
||||
if not os.path.isdir(vmbus_sys_path):
|
||||
- print "%s doesn't exist: exiting..." % vmbus_sys_path
|
||||
+ print("%s doesn't exist: exiting..." % vmbus_sys_path)
|
||||
exit(-1)
|
||||
|
||||
vmbus_dev_dict = {
|
||||
@@ -93,11 +93,11 @@ format2 = '%2s: Class_ID = %s - %s\n\tDevice_ID = %s\n\tSysfs path: %s\n%s'
|
||||
|
||||
for d in vmbus_dev_list:
|
||||
if verbose == 0:
|
||||
- print ('VMBUS ID ' + format0) % (d.vmbus_id, d.dev_desc)
|
||||
+ print(('VMBUS ID ' + format0) % (d.vmbus_id, d.dev_desc))
|
||||
elif verbose == 1:
|
||||
- print ('VMBUS ID ' + format1) % \
|
||||
- (d.vmbus_id, d.class_id, d.dev_desc, d.chn_vp_mapping)
|
||||
+ print (('VMBUS ID ' + format1) % \
|
||||
+ (d.vmbus_id, d.class_id, d.dev_desc, d.chn_vp_mapping))
|
||||
else:
|
||||
- print ('VMBUS ID ' + format2) % \
|
||||
+ print (('VMBUS ID ' + format2) % \
|
||||
(d.vmbus_id, d.class_id, d.dev_desc, \
|
||||
- d.device_id, d.sysfs_path, d.chn_vp_mapping)
|
||||
+ d.device_id, d.sysfs_path, d.chn_vp_mapping))
|
||||
--
|
||||
2.14.4
|
||||
|
@ -13,7 +13,7 @@
|
||||
|
||||
Name: hyperv-daemons
|
||||
Version: 0
|
||||
Release: 0.24%{?snapver}%{?dist}
|
||||
Release: 0.25%{?snapver}%{?dist}
|
||||
Summary: Hyper-V daemons suite
|
||||
|
||||
Group: System Environment/Daemons
|
||||
@ -45,6 +45,9 @@ Source202: hypervfcopy.rules
|
||||
# HYPERV TOOLS
|
||||
Source301: lsvmbus
|
||||
|
||||
# Make lsvmbus Python3 compatible
|
||||
Patch0: 0001-tools-hv-update-lsvmbus-to-be-compatible-with-python.patch
|
||||
|
||||
# Hyper-V is available only on x86 architectures
|
||||
# The base empty (a.k.a. virtual) package can not be noarch
|
||||
# due to http://www.rpm.org/ticket/78
|
||||
@ -136,6 +139,9 @@ cp -pvL %{SOURCE1} hv_kvp_daemon.c
|
||||
cp -pvL %{SOURCE100} hv_vss_daemon.c
|
||||
cp -pvL %{SOURCE200} hv_fcopy_daemon.c
|
||||
|
||||
cp -pvL %{SOURCE301} lsvmbus
|
||||
%patch0 -p3 -b .lsvmbus_python3
|
||||
|
||||
%build
|
||||
# HYPERV KVP DAEMON
|
||||
gcc $RPM_OPT_FLAGS -c hv_kvp_daemon.c
|
||||
@ -175,7 +181,8 @@ install -p -m 0755 %{SOURCE4} %{buildroot}%{_libexecdir}/%{hv_kvp_daemon}/hv_set
|
||||
mkdir -p %{buildroot}%{_sharedstatedir}/hyperv
|
||||
|
||||
# Tools
|
||||
install -p -m 0755 %{SOURCE301} %{buildroot}%{_sbindir}/
|
||||
install -p -m 0755 lsvmbus %{buildroot}%{_sbindir}/
|
||||
sed -i 's,#!/usr/bin/env python,#!/usr/bin/python3,' %{buildroot}%{_sbindir}/lsvmbus
|
||||
|
||||
%post -n hypervkvpd
|
||||
if [ $1 -gt 1 ] ; then
|
||||
@ -249,6 +256,9 @@ fi
|
||||
%{_sbindir}/lsvmbus
|
||||
|
||||
%changelog
|
||||
* Mon Jun 11 2018 Vitaly Kuznetsov <vkuznets@redhat.com> - 0-0.25.20180415git
|
||||
- Switch lsvmbus to Python3
|
||||
|
||||
* Thu Apr 26 2018 Tomas Hozza <thozza@redhat.com> - 0-0.24.20180415git
|
||||
- Added gcc as an explicit BuildRequires
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user