[v2] iotop: Update to work with python3

Message ID 20210510170308.1889765-1-adolf.belka@ipfire.org
State Accepted
Commit aef8d2a708c0bc14728bf9405ab724114b614b95
Headers
Series [v2] iotop: Update to work with python3 |

Commit Message

Adolf Belka May 10, 2021, 5:03 p.m. UTC
  - v2 version has updated rootfile. One line was accidentally missed out of
   original patch submission.
- Change from building with python2 to python3
- iotop setup.py used "itervalues" which is no longer used by python3
   In python3 this has been changed to "values". Patch created to update
   this in the source tarball setup.py
- Update lfs file with patch application and use of python3
- Update of rootfile
- Installed updated version into vm testbed and iotop confirmed working

Signed-off-by: Adolf Belka <adolf.belka@ipfire.org>
---
 config/rootfiles/packages/iotop               | 28 +++++++------------
 lfs/iotop                                     |  5 ++--
 ...e-itervalues-with-values-in-setup.py.patch | 11 ++++++++
 3 files changed, 24 insertions(+), 20 deletions(-)
 create mode 100644 src/patches/iotop-0.6-replace-itervalues-with-values-in-setup.py.patch
  

Patch

diff --git a/config/rootfiles/packages/iotop b/config/rootfiles/packages/iotop
index 5ebe221ef..541d6b3ee 100644
--- a/config/rootfiles/packages/iotop
+++ b/config/rootfiles/packages/iotop
@@ -1,20 +1,12 @@ 
-usr/lib/python2.7/site-packages/iotop
-#usr/lib/python2.7/site-packages/iotop-0.6-py2.7.egg-info
-#usr/lib/python2.7/site-packages/iotop/__init__.py
-#usr/lib/python2.7/site-packages/iotop/__init__.pyc
-#usr/lib/python2.7/site-packages/iotop/data.py
-#usr/lib/python2.7/site-packages/iotop/data.pyc
-#usr/lib/python2.7/site-packages/iotop/genetlink.py
-#usr/lib/python2.7/site-packages/iotop/genetlink.pyc
-#usr/lib/python2.7/site-packages/iotop/ioprio.py
-#usr/lib/python2.7/site-packages/iotop/ioprio.pyc
-#usr/lib/python2.7/site-packages/iotop/netlink.py
-#usr/lib/python2.7/site-packages/iotop/netlink.pyc
-#usr/lib/python2.7/site-packages/iotop/ui.py
-#usr/lib/python2.7/site-packages/iotop/ui.pyc
-#usr/lib/python2.7/site-packages/iotop/version.py
-#usr/lib/python2.7/site-packages/iotop/version.pyc
-#usr/lib/python2.7/site-packages/iotop/vmstat.py
-#usr/lib/python2.7/site-packages/iotop/vmstat.pyc
+usr/lib/python3.8/site-packages/iotop
+#usr/lib/python3.8/site-packages/iotop-0.6-py3.8.egg-info
+#usr/lib/python3.8/site-packages/iotop/__init__.py
+#usr/lib/python3.8/site-packages/iotop/data.py
+#usr/lib/python3.8/site-packages/iotop/genetlink.py
+#usr/lib/python3.8/site-packages/iotop/ioprio.py
+#usr/lib/python3.8/site-packages/iotop/netlink.py
+#usr/lib/python3.8/site-packages/iotop/ui.py
+#usr/lib/python3.8/site-packages/iotop/version.py
+#usr/lib/python3.8/site-packages/iotop/vmstat.py
 usr/sbin/iotop
 #usr/share/man/man8/iotop.8
diff --git a/lfs/iotop b/lfs/iotop
index d286eb1a9..02f027e5c 100644
--- a/lfs/iotop
+++ b/lfs/iotop
@@ -33,7 +33,7 @@  DIR_APP    = $(DIR_SRC)/$(THISAPP)
 TARGET     = $(DIR_INFO)/$(THISAPP)
 
 PROG       = iotop
-PAK_VER    = 1
+PAK_VER    = 2
 DEPS       =
 
 ###############################################################################
@@ -77,6 +77,7 @@  $(subst %,%_MD5,$(objects)) :
 $(TARGET) : $(patsubst %,$(DIR_DL)/%,$(objects))
 	@$(PREBUILD)
 	@rm -rf $(DIR_APP) && cd $(DIR_SRC) && tar zxf $(DIR_DL)/$(DL_FILE)
-	cd $(DIR_APP) && python setup.py install
+	cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/iotop-0.6-replace-itervalues-with-values-in-setup.py.patch
+	cd $(DIR_APP) && python3 setup.py install
 	@rm -rf $(DIR_APP)
 	@$(POSTBUILD)
diff --git a/src/patches/iotop-0.6-replace-itervalues-with-values-in-setup.py.patch b/src/patches/iotop-0.6-replace-itervalues-with-values-in-setup.py.patch
new file mode 100644
index 000000000..9778d19d1
--- /dev/null
+++ b/src/patches/iotop-0.6-replace-itervalues-with-values-in-setup.py.patch
@@ -0,0 +1,11 @@ 
+--- iotop-0.6/setup.py.orig	2013-05-27 00:44:18.000000000 +0200
++++ iotop-0.6/setup.py	2021-05-08 23:20:44.340837716 +0200
+@@ -7,7 +7,7 @@
+ # Dirty hack to make setup.py install the iotop script to sbin/ instead of bin/
+ # while still honoring the choice of installing into local/ or not.
+ if hasattr(distutils_install, 'INSTALL_SCHEMES'):
+-    for d in distutils_install.INSTALL_SCHEMES.itervalues():
++    for d in distutils_install.INSTALL_SCHEMES.values():
+         if d.get('scripts', '').endswith('/bin'):
+             d['scripts'] = d['scripts'][:-len('/bin')] + '/sbin'
+