From 9e07652a9b47cd0a3e50199493e6225a246b5a98 Mon Sep 17 00:00:00 2001 From: CentOS Sources Date: Tue, 28 Jul 2020 05:32:44 -0400 Subject: [PATCH] import python-linux-procfs-0.6.2-2.el8 --- .gitignore | 2 +- .python-linux-procfs.metadata | 2 +- SOURCES/pflags_Ignore_non-existent_pids.patch | 39 ---------- ...s_use_argparse_to_create_help_option.patch | 71 ------------------ ...oving-vanished-processes-in-pidstats.patch | 72 ------------------- ...cfs-Reduce-not-in-python3-by-default.patch | 27 ------- ...n-linux-procfs-Fix-import-of-utilist.patch | 31 ++++++++ SOURCES/sysctl-Fix-refreshing-cache.patch | 42 ----------- SPECS/python-linux-procfs.spec | 19 +++-- 9 files changed, 45 insertions(+), 260 deletions(-) delete mode 100644 SOURCES/pflags_Ignore_non-existent_pids.patch delete mode 100644 SOURCES/pflags_use_argparse_to_create_help_option.patch delete mode 100644 SOURCES/procfs-Fix-removing-vanished-processes-in-pidstats.patch delete mode 100644 SOURCES/procfs-Reduce-not-in-python3-by-default.patch create mode 100644 SOURCES/python-linux-procfs-Fix-import-of-utilist.patch delete mode 100644 SOURCES/sysctl-Fix-refreshing-cache.patch diff --git a/.gitignore b/.gitignore index 0951324..f4b5285 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1 @@ -SOURCES/python-linux-procfs-0.6.tar.xz +SOURCES/python-linux-procfs-0.6.2.tar.xz diff --git a/.python-linux-procfs.metadata b/.python-linux-procfs.metadata index 43336c3..a04bc08 100644 --- a/.python-linux-procfs.metadata +++ b/.python-linux-procfs.metadata @@ -1 +1 @@ -924eef33607e2229da5133ae510c95d36902d86a SOURCES/python-linux-procfs-0.6.tar.xz +80a5eb670d223e598be511c6df79851b7e986c3d SOURCES/python-linux-procfs-0.6.2.tar.xz diff --git a/SOURCES/pflags_Ignore_non-existent_pids.patch b/SOURCES/pflags_Ignore_non-existent_pids.patch deleted file mode 100644 index 8d1caa8..0000000 --- a/SOURCES/pflags_Ignore_non-existent_pids.patch +++ /dev/null @@ -1,39 +0,0 @@ -From 5b180973d90475ab32c470e568f1c786d94a9bf0 Mon Sep 17 00:00:00 2001 -From: John Kacur -Date: Thu, 29 Nov 2018 15:39:22 +0100 -Subject: [PATCH] python-linux-procfs: pflags: Ignore non-existent pids or - process names - -If the user enters a non-existent pid or process name, skip over it, - -Also, if the user enters nothing but a non-existent pid, then make sure -the max_comm_len defaults to 0 instead of generating an error. - -Signed-off-by: John Kacur ---- - pflags | 6 ++++-- - 1 file changed, 4 insertions(+), 2 deletions(-) - -diff --git a/pflags b/pflags -index a1667fc06131..9c45600cc1ee 100755 ---- a/pflags -+++ b/pflags -@@ -50,11 +50,13 @@ def main(argv): - pids = list(ps.processes.keys()) - - pids.sort() -- len_comms = [len(ps[pid]["stat"]["comm"]) for pid in pids] -- max_comm_len = max(len_comms) -+ len_comms = [len(ps[pid]["stat"]["comm"]) for pid in pids if pid in ps] -+ max_comm_len = max(len_comms, default=0) - del(len_comms) - - for pid in pids: -+ if pid not in ps: -+ continue - flags = ps[pid].stat.process_flags() - # Remove flags that were superseeded - if "PF_THREAD_BOUND" in flags and "PF_NO_SETAFFINITY" in flags: --- -2.19.2 - diff --git a/SOURCES/pflags_use_argparse_to_create_help_option.patch b/SOURCES/pflags_use_argparse_to_create_help_option.patch deleted file mode 100644 index 1b66c64..0000000 --- a/SOURCES/pflags_use_argparse_to_create_help_option.patch +++ /dev/null @@ -1,71 +0,0 @@ -From 68e3d6e74f0941c98aaeb82b89c954c76246ba7a Mon Sep 17 00:00:00 2001 -From: John Kacur -Date: Wed, 28 Nov 2018 04:28:53 +0100 -Subject: [PATCH 2/2] python-linux-procfs: pflags: Use argparse to create a - help option - -The purpose of this change was to create a -h, or --help option. -The following changes were made. - -1. pflags is now python3 only, since it uses argparse. -2. The handling of pids or process names is improved, instead of a -command separated list (without spaces), the more standard unix way of -space separated command line arguements are used. - -This is explained in the help - -./pflags -h -usage: pflags [-h] [pid [pid ...]] - -Print process flags - -positional arguments: - pid a list of pids or names - -optional arguments: - -h, --help show this help message and exit - -Signed-off-by: John Kacur ---- - pflags | 12 +++++++++--- - 1 file changed, 9 insertions(+), 3 deletions(-) - -diff --git a/pflags b/pflags -index abfcfe9e9ec1..a1667fc06131 100755 ---- a/pflags -+++ b/pflags -@@ -1,4 +1,4 @@ --#! /usr/bin/python -+#! /usr/bin/python3 - # -*- python -*- - # -*- coding: utf-8 -*- - # print process flags -@@ -14,8 +14,9 @@ - # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - # General Public License for more details. - --from __future__ import print_function -+ - import procfs, re, fnmatch, sys -+import argparse - from functools import reduce - from six.moves import map - -@@ -38,8 +39,13 @@ def main(argv): - global ps - ps = procfs.pidstats() - -+ parser = argparse.ArgumentParser(description='Print process flags') -+ parser.add_argument('pid', nargs='*', help='a list of pids or names') -+ args = parser.parse_args() -+ - if (len(argv) > 1): -- pids = reduce(lambda i, j: i + j, list(map(thread_mapper, argv[1].split(",")))) -+ pids = args.pid -+ pids = reduce(lambda i, j: i + j, list(map(thread_mapper, pids))) - else: - pids = list(ps.processes.keys()) - --- -2.19.1 - diff --git a/SOURCES/procfs-Fix-removing-vanished-processes-in-pidstats.patch b/SOURCES/procfs-Fix-removing-vanished-processes-in-pidstats.patch deleted file mode 100644 index 436f9a1..0000000 --- a/SOURCES/procfs-Fix-removing-vanished-processes-in-pidstats.patch +++ /dev/null @@ -1,72 +0,0 @@ -From cf4c740974834b7d5c9dc7b12a69c5269b0d7a2d Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?Ond=C5=99ej=20Lyson=C4=9Bk?= -Date: Thu, 24 Jan 2019 21:55:16 +0100 -Subject: [PATCH] procfs: Fix removing vanished processes in - pidstats.reload_threads() -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -If a process disappears while iterating the loop in -pidstats.reload_threads(), we get a RuntimeError as shown below. This -is because we cannot remove an entry from a dictionary while iterating the -dictionary. - -Reproducer: -1. Add the following line to the beginning of pidstats.reload_threads(): -import pdb; pdb.set_trace() -2. Start some process -3. Start the python interpreter and proceed as follows: -[~/git/python-linux-procfs]$ python3 -Python 3.6.8 (default, Jan 3 2019, 16:11:14) -[GCC 8.2.1 20181215 (Red Hat 8.2.1-6)] on linux -Type "help", "copyright", "credits" or "license" for more information. ->>> import procfs ->>> ps = procfs.pidstats() ->>> ps.reload_threads() -> /home/olysonek/git/python-linux-procfs/procfs/procfs.py(462)reload_threads() --> for pid in self.processes.keys(): -(Pdb) next -> /home/olysonek/git/python-linux-procfs/procfs/procfs.py(463)reload_threads() --> try: - -At this point, terminate the process started in step 2. Return to the -python interpreter: - -(Pdb) continue -Traceback (most recent call last): - File "", line 1, in - File "/home/olysonek/git/python-linux-procfs/procfs/procfs.py", line 463, in reload_threads - try: -RuntimeError: dictionary changed size during iteration - -Signed-off-by: Ondřej Lysoněk -Signed-off-by: John Kacur ---- - procfs/procfs.py | 5 ++++- - 1 file changed, 4 insertions(+), 1 deletion(-) - -diff --git a/procfs/procfs.py b/procfs/procfs.py -index c6f65890d0e4..b0ce2514063d 100755 ---- a/procfs/procfs.py -+++ b/procfs/procfs.py -@@ -459,12 +459,15 @@ class pidstats: - self.processes[pid] = process(pid, self.basedir) - - def reload_threads(self): -+ to_remove = [] - for pid in self.processes.keys(): - try: - self.processes[pid].load_threads() - except OSError: - # process vanished, remove it -- del self.processes[pid] -+ to_remove.append(pid) -+ for pid in to_remove: -+ del self.processes[pid] - - def find_by_name(self, name): - name = name[:15] --- -2.20.1 - diff --git a/SOURCES/procfs-Reduce-not-in-python3-by-default.patch b/SOURCES/procfs-Reduce-not-in-python3-by-default.patch deleted file mode 100644 index 97f6ac9..0000000 --- a/SOURCES/procfs-Reduce-not-in-python3-by-default.patch +++ /dev/null @@ -1,27 +0,0 @@ -From 5765b274bf2929aa99185be5ce946bce94ace7a5 Mon Sep 17 00:00:00 2001 -From: John Kacur -Date: Tue, 16 Oct 2018 20:26:39 +0200 -Subject: [PATCH] procfs: Reduce not in python3 by default - -Reduce not in python3 by default, so import it from functools - -Signed-off-by: John Kacur ---- - procfs/procfs.py | 1 + - 1 file changed, 1 insertion(+) - -diff --git a/procfs/procfs.py b/procfs/procfs.py -index c70fe2ae774b..c6f65890d0e4 100755 ---- a/procfs/procfs.py -+++ b/procfs/procfs.py -@@ -21,6 +21,7 @@ - from __future__ import absolute_import - from __future__ import print_function - import os, time -+from functools import reduce - from .utilist import bitmasklist - from six.moves import range - --- -2.14.4 - diff --git a/SOURCES/python-linux-procfs-Fix-import-of-utilist.patch b/SOURCES/python-linux-procfs-Fix-import-of-utilist.patch new file mode 100644 index 0000000..89ba358 --- /dev/null +++ b/SOURCES/python-linux-procfs-Fix-import-of-utilist.patch @@ -0,0 +1,31 @@ +From 208b963455fa5ff658b24e513639f27ef66920ce Mon Sep 17 00:00:00 2001 +From: John Kacur +Date: Wed, 24 Jun 2020 12:01:42 -0400 +Subject: [PATCH 1/2] python-linux-procfs: Fix import of utilist + +If procfs/utilist.py is not in your PYTHONPATH, the import can fail. +Specify it fully. + +Reported-by: David Runge +Suggested-by: Guy Streeter +Signed-off-by: John Kacur +--- + procfs/procfs.py | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/procfs/procfs.py b/procfs/procfs.py +index a586ae2b0156..3cfa941ffdb9 100755 +--- a/procfs/procfs.py ++++ b/procfs/procfs.py +@@ -21,7 +21,7 @@ + import os, time + from functools import reduce + from six.moves import range +-from utilist import bitmasklist ++from procfs.utilist import bitmasklist + import platform + import re + +-- +2.21.3 + diff --git a/SOURCES/sysctl-Fix-refreshing-cache.patch b/SOURCES/sysctl-Fix-refreshing-cache.patch deleted file mode 100644 index 5897e9c..0000000 --- a/SOURCES/sysctl-Fix-refreshing-cache.patch +++ /dev/null @@ -1,42 +0,0 @@ -From 6a84665b2422a98fbce8581ee9ae5eb60953f945 Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?Ond=C5=99ej=20Lyson=C4=9Bk?= -Date: Fri, 11 Jan 2019 15:24:00 +0100 -Subject: [PATCH] sysctl: Fix refreshing cache -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -Fix iterating over the 'cache' dictionary in refresh(). A dictionary is -not callable. This fixes the following error: - ->>> import procfs.sysctl ->>> s = procfs.sysctl() ->>> s.refresh() -Traceback (most recent call last): - File "", line 1, in - File "/usr/lib/python3.6/site-packages/procfs/sysctl.py", line 64, in refresh - for key in self.cache(): -TypeError: 'dict' object is not callable - -Signed-off-by: Ondřej Lysoněk -Signed-off-by: John Kacur ---- - procfs/sysctl.py | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/procfs/sysctl.py b/procfs/sysctl.py -index 8b256ab4317f..6a9145518c27 100755 ---- a/procfs/sysctl.py -+++ b/procfs/sysctl.py -@@ -61,7 +61,7 @@ class sysctl: - f.close() - - def refresh(self): -- for key in self.cache(): -+ for key in self.cache.keys(): - del self.cache[key] - value = self.read(key) - if value != None: --- -2.20.1 - diff --git a/SPECS/python-linux-procfs.spec b/SPECS/python-linux-procfs.spec index 1bd2e7c..0b60150 100644 --- a/SPECS/python-linux-procfs.spec +++ b/SPECS/python-linux-procfs.spec @@ -1,6 +1,6 @@ Name: python-linux-procfs -Version: 0.6 -Release: 7%{?dist} +Version: 0.6.2 +Release: 2%{?dist} License: GPLv2 Summary: Linux /proc abstraction classes Group: System Environment/Libraries @@ -20,11 +20,7 @@ Obsoletes: python-linux-procfs Abstractions to extract information from the Linux kernel /proc files. # PATCHES -Patch1: procfs-Reduce-not-in-python3-by-default.patch -Patch2: pflags_use_argparse_to_create_help_option.patch -Patch3: pflags_Ignore_non-existent_pids.patch -Patch4: sysctl-Fix-refreshing-cache.patch -Patch5: procfs-Fix-removing-vanished-processes-in-pidstats.patch +Patch1: python-linux-procfs-Fix-import-of-utilist.patch %description %_description @@ -58,6 +54,15 @@ rm -rf %{buildroot} %license COPYING %changelog +* Wed Jun 24 2020 John Kacur - 0.6.2-2 +- Resolves: rhbz#1850391 + +* Mon Jun 22 2020 John Kacur - 0.6.2-1 +- Add bitmasklist_test +- Clean-ups including using a more modern python spacing, tabbing, etc +- Fix to parse number of cpus correctly on s390(x) +Resolves: rhbz#1849215 + * Wed Apr 03 2019 Clark Williams - 0.6-7 - OSCI gating framework added Resolves: rhbz#1682424