import python-linux-procfs-0.6.2-2.el8
This commit is contained in:
parent
67220e5e41
commit
f6a248ac2e
2
.gitignore
vendored
2
.gitignore
vendored
@ -1 +1 @@
|
||||
SOURCES/python-linux-procfs-0.6.tar.xz
|
||||
SOURCES/python-linux-procfs-0.6.2.tar.xz
|
||||
|
@ -1 +1 @@
|
||||
924eef33607e2229da5133ae510c95d36902d86a SOURCES/python-linux-procfs-0.6.tar.xz
|
||||
80a5eb670d223e598be511c6df79851b7e986c3d SOURCES/python-linux-procfs-0.6.2.tar.xz
|
||||
|
@ -1,39 +0,0 @@
|
||||
From 5b180973d90475ab32c470e568f1c786d94a9bf0 Mon Sep 17 00:00:00 2001
|
||||
From: John Kacur <jkacur@redhat.com>
|
||||
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 <jkacur@redhat.com>
|
||||
---
|
||||
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
|
||||
|
@ -1,71 +0,0 @@
|
||||
From 68e3d6e74f0941c98aaeb82b89c954c76246ba7a Mon Sep 17 00:00:00 2001
|
||||
From: John Kacur <jkacur@redhat.com>
|
||||
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 <jkacur@redhat.com>
|
||||
---
|
||||
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
|
||||
|
@ -1,72 +0,0 @@
|
||||
From cf4c740974834b7d5c9dc7b12a69c5269b0d7a2d Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?Ond=C5=99ej=20Lyson=C4=9Bk?= <olysonek@redhat.com>
|
||||
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 "<stdin>", line 1, in <module>
|
||||
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 <olysonek@redhat.com>
|
||||
Signed-off-by: John Kacur <jkacur@redhat.com>
|
||||
---
|
||||
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
|
||||
|
@ -1,27 +0,0 @@
|
||||
From 5765b274bf2929aa99185be5ce946bce94ace7a5 Mon Sep 17 00:00:00 2001
|
||||
From: John Kacur <jkacur@redhat.com>
|
||||
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 <jkacur@redhat.com>
|
||||
---
|
||||
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
|
||||
|
31
SOURCES/python-linux-procfs-Fix-import-of-utilist.patch
Normal file
31
SOURCES/python-linux-procfs-Fix-import-of-utilist.patch
Normal file
@ -0,0 +1,31 @@
|
||||
From 208b963455fa5ff658b24e513639f27ef66920ce Mon Sep 17 00:00:00 2001
|
||||
From: John Kacur <jkacur@redhat.com>
|
||||
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 <dave@sleepmap.de>
|
||||
Suggested-by: Guy Streeter <guy.streeter@gmail.com>
|
||||
Signed-off-by: John Kacur <jkacur@redhat.com>
|
||||
---
|
||||
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
|
||||
|
@ -1,42 +0,0 @@
|
||||
From 6a84665b2422a98fbce8581ee9ae5eb60953f945 Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?Ond=C5=99ej=20Lyson=C4=9Bk?= <olysonek@redhat.com>
|
||||
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 "<stdin>", line 1, in <module>
|
||||
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 <olysonek@redhat.com>
|
||||
Signed-off-by: John Kacur <jkacur@redhat.com>
|
||||
---
|
||||
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
|
||||
|
@ -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 <jkacur@redhat.com> - 0.6.2-2
|
||||
- Resolves: rhbz#1850391
|
||||
|
||||
* Mon Jun 22 2020 John Kacur <jkacur@redhat.com> - 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 <williams@redhat.com> - 0.6-7
|
||||
- OSCI gating framework added
|
||||
Resolves: rhbz#1682424
|
||||
|
Loading…
Reference in New Issue
Block a user