diff --git a/pr_1364.patch b/pr_1364.patch deleted file mode 100644 index 3e02f2a..0000000 --- a/pr_1364.patch +++ /dev/null @@ -1,31 +0,0 @@ -From 6688d5fca0f5d19ff7741b2d1585882c4663541b Mon Sep 17 00:00:00 2001 -From: Jelle van der Waa -Date: Sun, 18 Nov 2018 19:55:08 +0100 -Subject: [PATCH] [Linux] read_sysfs() fails on Linux 4.18+ - -Linux kernel 4.18+ added 4 fields to /sys/block/$dev/stat, ignore them -and parse the rest as usual. ---- - psutil/_pslinux.py | 9 +++++++-- - 1 file changed, 7 insertions(+), 2 deletions(-) - -diff --git a/psutil/_pslinux.py b/psutil/_pslinux.py -index b775d39ae..12f17e861 100644 ---- a/psutil/_pslinux.py -+++ b/psutil/_pslinux.py -@@ -1099,8 +1099,13 @@ def read_sysfs(): - with open_text(os.path.join(root, 'stat')) as f: - fields = f.read().strip().split() - name = os.path.basename(root) -- (reads, reads_merged, rbytes, rtime, writes, writes_merged, -- wbytes, wtime, _, busy_time, _) = map(int, fields) -+ if len(fields) == 11: -+ (reads, reads_merged, rbytes, rtime, writes, writes_merged, -+ wbytes, wtime, _, busy_time, _) = map(int, fields) -+ else: # Linux 4.18+ adds for fields for discard -+ (reads, reads_merged, rbytes, rtime, writes, writes_merged, -+ wbytes, wtime, _, busy_time, _, _, _, _, _) = map(int, -+ fields) - yield (name, reads, writes, rbytes, wbytes, rtime, - wtime, reads_merged, writes_merged, busy_time) - diff --git a/pr_1665.patch b/pr_1665.patch deleted file mode 100644 index c419b56..0000000 --- a/pr_1665.patch +++ /dev/null @@ -1,61 +0,0 @@ -From df417c78f9b91fa19e3dd04645d584f572dac4de Mon Sep 17 00:00:00 2001 -From: Mike Hommey -Date: Fri, 17 Jan 2020 10:27:04 +0900 -Subject: [PATCH 1/2] Future-proof disk_ui_counters on Linux. - -Kernel 5.5 added 2 more fields to /proc/diskstats, requiring another -change after the one for 4.18, which recently added 4 fields. - -At this point in time, the meaning of the existing fields is unlikely to -change, and psutil is not using any of the newer ones. By considering -18 fields and more to have the current layout, psutil will continue to -work as newer kernels add more fields. ---- - psutil/_pslinux.py | 3 ++- - 1 file changed, 2 insertions(+), 1 deletion(-) - -diff --git a/psutil/_pslinux.py b/psutil/_pslinux.py -index c681439d4..673475116 100644 ---- a/psutil/_pslinux.py -+++ b/psutil/_pslinux.py -@@ -1066,6 +1066,7 @@ def read_procfs(): - # "3 1 hda1 8 8 8 8" - # 4.18+ has 4 fields added: - # "3 0 hda 8 8 8 8 8 8 8 8 8 8 8 0 0 0 0" -+ # 5.5 has 2 more fields. - # See: - # https://www.kernel.org/doc/Documentation/iostats.txt - # https://www.kernel.org/doc/Documentation/ABI/testing/procfs-diskstats -@@ -1080,7 +1081,7 @@ def read_procfs(): - reads = int(fields[2]) - (reads_merged, rbytes, rtime, writes, writes_merged, - wbytes, wtime, _, busy_time, _) = map(int, fields[4:14]) -- elif flen == 14 or flen == 18: -+ elif flen == 14 or flen >= 18 - # Linux 2.6+, line referring to a disk - name = fields[2] - (reads, reads_merged, rbytes, rtime, writes, writes_merged, - -From ae5532a70b653435adbf8c7e86c3baa0bd3f90dc Mon Sep 17 00:00:00 2001 -From: Giampaolo Rodola -Date: Fri, 17 Jan 2020 12:32:05 +0100 -Subject: [PATCH 2/2] fix typo - ---- - psutil/_pslinux.py | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/psutil/_pslinux.py b/psutil/_pslinux.py -index 673475116..d8f8ed5c8 100644 ---- a/psutil/_pslinux.py -+++ b/psutil/_pslinux.py -@@ -1081,7 +1081,7 @@ def read_procfs(): - reads = int(fields[2]) - (reads_merged, rbytes, rtime, writes, writes_merged, - wbytes, wtime, _, busy_time, _) = map(int, fields[4:14]) -- elif flen == 14 or flen >= 18 -+ elif flen == 14 or flen >= 18: - # Linux 2.6+, line referring to a disk - name = fields[2] - (reads, reads_merged, rbytes, rtime, writes, writes_merged, - diff --git a/psutil-5.6.7.tar.gz b/psutil-5.6.7.tar.gz deleted file mode 100644 index af317fe..0000000 --- a/psutil-5.6.7.tar.gz +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:ffad8eb2ac614518bbe3c0b8eb9dffdb3a8d2e3a7d5da51c5b974fb723a5c5aa -size 448321 diff --git a/psutil-5.7.0.tar.gz b/psutil-5.7.0.tar.gz new file mode 100644 index 0000000..d3163ff --- /dev/null +++ b/psutil-5.7.0.tar.gz @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:685ec16ca14d079455892f25bd124df26ff9137664af445563c1bd36629b5e0e +size 449628 diff --git a/python-psutil.changes b/python-psutil.changes index 545a53f..e0da7ba 100644 --- a/python-psutil.changes +++ b/python-psutil.changes @@ -1,3 +1,13 @@ +------------------------------------------------------------------- +Sat Mar 14 07:25:43 UTC 2020 - Tomáš Chvátal + +- Update to 5.7.0: + * Various fixes to build with updated kernel/etc. +- Remove merged patch pr_1665.patch and pr_1364.patch +- Update patch skip-obs.patch +- Remove skip-test-missing-warnings.patch as it can be fixed by + properly calling the tests + ------------------------------------------------------------------- Wed Jan 29 16:58:27 UTC 2020 - Dominique Leuenberger diff --git a/python-psutil.spec b/python-psutil.spec index 48c0d15..32ee88a 100644 --- a/python-psutil.spec +++ b/python-psutil.spec @@ -22,18 +22,16 @@ %else %bcond_with test %endif +%bcond_without python2 Name: python-psutil -Version: 5.6.7 +Version: 5.7.0 Release: 0 Summary: A process utilities module for Python License: BSD-3-Clause URL: https://github.com/giampaolo/psutil Source: https://files.pythonhosted.org/packages/source/p/psutil/psutil-%{version}.tar.gz -Patch0: pr_1364.patch -Patch1: skip-test-missing-warnings.patch -Patch2: skip-flaky-i586.patch -Patch3: skip-obs.patch -Patch4: pr_1665.patch +Patch0: skip-flaky-i586.patch +Patch1: skip-obs.patch BuildRequires: %{python_module devel} BuildRequires: %{python_module setuptools} BuildRequires: fdupes @@ -43,9 +41,11 @@ Requires: procps %if %{with test} BuildRequires: net-tools BuildRequires: procps +%if %{with python2} BuildRequires: python-ipaddress BuildRequires: python-mock %endif +%endif %ifpython2 Requires: python-ipaddress %endif @@ -56,11 +56,7 @@ A graphical interface that lets you easily analyze and introspect unaltered runn %prep %setup -q -n psutil-%{version} -%patch0 -p1 -%patch1 -p1 -%patch2 -p1 -%patch3 -p1 -%patch4 -p1 +%autopatch -p1 # Remove shebangs sed -i "1s/#!.*//" psutil/{__init__.py,_compat.py,_psbsd.py,_pslinux.py,_psosx.py,_psposix.py,_pssunos.py,_pswindows.py} @@ -74,7 +70,6 @@ sed -i "1s/#!.*//" psutil/{__init__.py,_compat.py,_psbsd.py,_pslinux.py,_psosx.p %{python_expand mkdir -p %{buildroot}%{_docdir}/%{$python_prefix}-psutil cp -r scripts %{buildroot}%{_docdir}/%{$python_prefix}-psutil/ find %{buildroot}%{_docdir}/%{$python_prefix}-psutil/scripts/ -type f -name "*.py" -exec sed -i "s|#!%{_bindir}/env python|#!%__$python|" {} \; -rm -r %{buildroot}%{$python_sitearch}/psutil/tests/ %fdupes %{buildroot}%{_docdir}/%{$python_prefix}-psutil/ %fdupes %{buildroot}%{$python_sitearch} } @@ -86,12 +81,7 @@ export PSUTIL_TESTING=1 export TRAVIS=1 # Note test_fetch_all is a bit flaky, occasionally failing -%{python_expand export PYTHONPATH=%{buildroot}%{$python_sitearch} -cp -r scripts %{buildroot}%{$python_sitearch}/ -cp -r psutil/tests %{buildroot}%{$python_sitearch}/psutil -$python -W default %{buildroot}%{$python_sitearch}/psutil/tests/__main__.py -rm -r %{buildroot}%{$python_sitearch}/scripts %{buildroot}%{$python_sitearch}/psutil/tests -} +%python_expand PYTHONPATH=%{buildroot}%{$python_sitearch} $python -Wa psutil/tests/runner.py %endif %files %{python_files} diff --git a/skip-obs.patch b/skip-obs.patch index 0bc1e34..ffb4937 100644 --- a/skip-obs.patch +++ b/skip-obs.patch @@ -1,8 +1,8 @@ -Index: psutil-5.6.3/psutil/tests/__init__.py +Index: psutil-5.7.0/psutil/tests/__init__.py =================================================================== ---- psutil-5.6.3.orig/psutil/tests/__init__.py -+++ psutil-5.6.3/psutil/tests/__init__.py -@@ -171,7 +171,7 @@ HAS_SENSORS_BATTERY = hasattr(psutil, "s +--- psutil-5.7.0.orig/psutil/tests/__init__.py ++++ psutil-5.7.0/psutil/tests/__init__.py +@@ -174,7 +174,7 @@ HAS_SENSORS_BATTERY = hasattr(psutil, "s try: HAS_BATTERY = HAS_SENSORS_BATTERY and bool(psutil.sensors_battery()) except Exception: @@ -11,11 +11,11 @@ Index: psutil-5.6.3/psutil/tests/__init__.py HAS_SENSORS_FANS = hasattr(psutil, "sensors_fans") HAS_SENSORS_TEMPERATURES = hasattr(psutil, "sensors_temperatures") HAS_THREADS = hasattr(psutil.Process, "threads") -Index: psutil-5.6.3/psutil/tests/test_misc.py +Index: psutil-5.7.0/psutil/tests/test_misc.py =================================================================== ---- psutil-5.6.3.orig/psutil/tests/test_misc.py -+++ psutil-5.6.3/psutil/tests/test_misc.py -@@ -680,7 +680,7 @@ class TestScripts(unittest.TestCase): +--- psutil-5.7.0.orig/psutil/tests/test_misc.py ++++ psutil-5.7.0/psutil/tests/test_misc.py +@@ -684,7 +684,7 @@ class TestScripts(unittest.TestCase): src = f.read() ast.parse(src) @@ -24,7 +24,7 @@ Index: psutil-5.6.3/psutil/tests/test_misc.py # make sure all example scripts have a test method defined meths = dir(self) for name in os.listdir(SCRIPTS_DIR): -@@ -698,7 +698,7 @@ class TestScripts(unittest.TestCase): +@@ -702,7 +702,7 @@ class TestScripts(unittest.TestCase): if not stat.S_IXUSR & os.stat(path)[stat.ST_MODE]: self.fail('%r is not executable' % path) @@ -33,7 +33,7 @@ Index: psutil-5.6.3/psutil/tests/test_misc.py self.assert_stdout('disk_usage.py') def test_free(self): -@@ -777,6 +777,8 @@ class TestScripts(unittest.TestCase): +@@ -783,6 +783,8 @@ class TestScripts(unittest.TestCase): def test_battery(self): self.assert_stdout('battery.py') @@ -42,11 +42,11 @@ Index: psutil-5.6.3/psutil/tests/test_misc.py def test_sensors(self): self.assert_stdout('sensors.py') -Index: psutil-5.6.3/psutil/tests/test_linux.py +Index: psutil-5.7.0/psutil/tests/test_linux.py =================================================================== ---- psutil-5.6.3.orig/psutil/tests/test_linux.py -+++ psutil-5.6.3/psutil/tests/test_linux.py -@@ -633,7 +633,7 @@ class TestSystemCPUCountLogical(unittest +--- psutil-5.7.0.orig/psutil/tests/test_linux.py ++++ psutil-5.7.0/psutil/tests/test_linux.py +@@ -636,7 +636,7 @@ class TestSystemCPUCountLogical(unittest self.assertEqual(psutil.cpu_count(logical=True), num) @unittest.skipIf(not which("lscpu"), "lscpu utility not available") @@ -55,7 +55,7 @@ Index: psutil-5.6.3/psutil/tests/test_linux.py out = sh("lscpu -p") num = len([x for x in out.split('\n') if not x.startswith('#')]) self.assertEqual(psutil.cpu_count(logical=True), num) -@@ -676,7 +676,7 @@ class TestSystemCPUCountLogical(unittest +@@ -679,7 +679,7 @@ class TestSystemCPUCountLogical(unittest class TestSystemCPUCountPhysical(unittest.TestCase): @unittest.skipIf(not which("lscpu"), "lscpu utility not available") @@ -64,7 +64,7 @@ Index: psutil-5.6.3/psutil/tests/test_linux.py out = sh("lscpu -p") core_ids = set() for line in out.split('\n'): -@@ -1027,7 +1027,7 @@ class TestSystemDiskPartitions(unittest. +@@ -1008,7 +1008,7 @@ class TestSystemDiskPartitions(unittest. @unittest.skipIf(not hasattr(os, 'statvfs'), "os.statvfs() not available") @skip_on_not_implemented() @@ -73,7 +73,7 @@ Index: psutil-5.6.3/psutil/tests/test_linux.py # test psutil.disk_usage() and psutil.disk_partitions() # against "df -a" def df(path): -@@ -1203,7 +1203,7 @@ class TestSystemDiskIoCounters(unittest. +@@ -1183,7 +1183,7 @@ class TestSystemDiskIoCounters(unittest. self.assertEqual(ret.read_count, 1) self.assertEqual(ret.write_count, 5) @@ -82,11 +82,11 @@ Index: psutil-5.6.3/psutil/tests/test_linux.py def exists(path): if path == '/proc/diskstats': return False -Index: psutil-5.6.3/psutil/tests/test_posix.py +Index: psutil-5.7.0/psutil/tests/test_posix.py =================================================================== ---- psutil-5.6.3.orig/psutil/tests/test_posix.py -+++ psutil-5.6.3/psutil/tests/test_posix.py -@@ -415,7 +415,7 @@ class TestSystemAPIs(unittest.TestCase): +--- psutil-5.7.0.orig/psutil/tests/test_posix.py ++++ psutil-5.7.0/psutil/tests/test_posix.py +@@ -414,7 +414,7 @@ class TestSystemAPIs(unittest.TestCase): # AIX can return '-' in df output instead of numbers, e.g. for /proc @unittest.skipIf(AIX, "unreliable on AIX") @@ -95,24 +95,24 @@ Index: psutil-5.6.3/psutil/tests/test_posix.py def df(device): out = sh("df -k %s" % device).strip() line = out.split('\n')[1] -Index: psutil-5.6.3/psutil/tests/test_contracts.py +Index: psutil-5.7.0/psutil/tests/test_contracts.py =================================================================== ---- psutil-5.6.3.orig/psutil/tests/test_contracts.py -+++ psutil-5.6.3/psutil/tests/test_contracts.py -@@ -110,7 +110,7 @@ class TestAvailability(unittest.TestCase - ae(hasattr(psutil, "RLIMIT_RTTIME"), hasit) - ae(hasattr(psutil, "RLIMIT_SIGPENDING"), hasit) +--- psutil-5.7.0.orig/psutil/tests/test_contracts.py ++++ psutil-5.7.0/psutil/tests/test_contracts.py +@@ -114,7 +114,7 @@ class TestAvailSystemAPIs(unittest.TestC + def test_win_service_get(self): + self.assertEqual(hasattr(psutil, "win_service_get"), WINDOWS) - def test_cpu_freq(self): + def _test_cpu_freq(self): linux = (LINUX and (os.path.exists("/sys/devices/system/cpu/cpufreq") or os.path.exists("/sys/devices/system/cpu/cpu0/cpufreq"))) -Index: psutil-5.6.3/psutil/tests/test_system.py +Index: psutil-5.7.0/psutil/tests/test_system.py =================================================================== ---- psutil-5.6.3.orig/psutil/tests/test_system.py -+++ psutil-5.6.3/psutil/tests/test_system.py -@@ -481,7 +481,7 @@ class TestSystemAPIs(unittest.TestCase): +--- psutil-5.7.0.orig/psutil/tests/test_system.py ++++ psutil-5.7.0/psutil/tests/test_system.py +@@ -604,7 +604,7 @@ class TestDiskAPIs(unittest.TestCase): def test_disk_usage_bytes(self): psutil.disk_usage(b'.') @@ -121,12 +121,3 @@ Index: psutil-5.6.3/psutil/tests/test_system.py # all = False ls = psutil.disk_partitions(all=False) # on travis we get: -@@ -685,7 +685,7 @@ class TestSystemAPIs(unittest.TestCase): - '/proc/diskstats not available on this linux version') - @unittest.skipIf(APPVEYOR and psutil.disk_io_counters() is None, - "unreliable on APPVEYOR") # no visible disks -- def test_disk_io_counters(self): -+ def _test_disk_io_counters(self): - def check_ntuple(nt): - self.assertEqual(nt[0], nt.read_count) - self.assertEqual(nt[1], nt.write_count) diff --git a/skip-test-missing-warnings.patch b/skip-test-missing-warnings.patch deleted file mode 100644 index d55004c..0000000 --- a/skip-test-missing-warnings.patch +++ /dev/null @@ -1,21 +0,0 @@ -diff -ru psutil-5.6.1-orig/psutil/tests/test_linux.py psutil-5.6.1/psutil/tests/test_linux.py ---- psutil-5.6.1-orig/psutil/tests/test_linux.py 2019-03-18 09:42:48.474895363 +0700 -+++ psutil-5.6.1/psutil/tests/test_linux.py 2019-03-18 10:56:59.227642825 +0700 -@@ -362,7 +362,7 @@ - self.assertIn( - "inactive memory stats couldn't be determined", str(w.message)) - -- def test_avail_old_missing_fields(self): -+ def _test_avail_old_missing_fields(self): - # Remove Active(file), Inactive(file) and SReclaimable - # from /proc/meminfo and make sure the fallback is used - # (free + cached), -@@ -387,7 +387,7 @@ - self.assertIn( - "inactive memory stats couldn't be determined", str(w.message)) - -- def test_avail_old_missing_zoneinfo(self): -+ def _test_avail_old_missing_zoneinfo(self): - # Remove /proc/zoneinfo file. Make sure fallback is used - # (free + cached). - with mock_open_content(