Browse Source

python-linux-procfs package added

Signed-off-by: basebuilder_pel7ppc64bebuilder0 <basebuilder@powerel.org>
master
basebuilder_pel7ppc64bebuilder0 6 years ago
parent
commit
7b2c532144
  1. 49
      SOURCES/fix-parse_affinity-for-CPU-numbers-greater-than-31.patch
  2. 49
      SOURCES/pidstats-fix-documentation-indentation.patch
  3. 125
      SPECS/python-linux-procfs.spec

49
SOURCES/fix-parse_affinity-for-CPU-numbers-greater-than-31.patch

@ -0,0 +1,49 @@ @@ -0,0 +1,49 @@
From 56cec3cf78392f2464f28129b1de70c53616de26 Mon Sep 17 00:00:00 2001
From: Jozef Bacik <jobacik@redhat.com>
Date: Wed, 24 Aug 2016 11:05:05 +0100
Subject: [PATCH] fix parse_affinity for CPU numbers greater than 31

The function parse_affinity reports wrong results for CPU numbers
greater than 31.

The problem is caused by the function bitmastlist which parse_affinity
calls. The fix treats the inpput line as a long hexbitmask instead of an
array in order to produce correct results

Signed-off-by: Jozef Bacik <jobacik@redhat.com>
Signed-off-by: John Kacur <jkacur@redhat.com>
---
procfs/utilist.py | 16 ++++++----------
1 file changed, 6 insertions(+), 10 deletions(-)

diff --git a/procfs/utilist.py b/procfs/utilist.py
index 18645c0ba45e..0e7c24f45cda 100755
--- a/procfs/utilist.py
+++ b/procfs/utilist.py
@@ -37,18 +37,14 @@ def hexbitmask(l, nr_entries):
return hexbitmask

def bitmasklist(line, nr_entries):
- fields = line.strip().split(",")
+ hexmask = line.strip().replace(",", "")
bitmasklist = []
entry = 0
- for i in range(len(fields) - 1, -1, -1):
- mask = int(fields[i], 16)
- while mask != 0:
- if mask & 1:
- bitmasklist.append(entry)
- mask >>= 1
- entry += 1
- if entry == nr_entries:
- break
+ bitmask = bin(int(hexmask, 16))[2::]
+ for i in reversed(bitmask):
+ if int(i) & 1:
+ bitmasklist.append(entry)
+ entry +=1
if entry == nr_entries:
break
return bitmasklist
--
2.4.11

49
SOURCES/pidstats-fix-documentation-indentation.patch

@ -0,0 +1,49 @@ @@ -0,0 +1,49 @@
From f1c8bf461da1344ae48f456a129502f276f5fc14 Mon Sep 17 00:00:00 2001
From: Jiri Kastner <jkastner@redhat.com>
Date: Fri, 9 Oct 2015 13:50:09 +0200
Subject: [PATCH] pidstats: fix documentation indentation

Signed-off-by: Jiri Kastner <jkastner@redhat.com>
Signed-off-by: John Kacur <jkacur at redhat.com>
---
procfs/procfs.py | 22 +++++++++++-----------
1 file changed, 11 insertions(+), 11 deletions(-)

diff --git a/procfs/procfs.py b/procfs/procfs.py
index 3d683c1ec5c6..0706fbc3debd 100755
--- a/procfs/procfs.py
+++ b/procfs/procfs.py
@@ -412,20 +412,20 @@ class pidstats:
return key in self.processes

def reload(self):
- """
- This operation will trow away the current dictionary contents, if any, and
- read all the pid files from /proc/, instantiating a 'process' instance for
- each of them.
+ """
+ This operation will throw away the current dictionary contents, if any, and
+ read all the pid files from /proc/, instantiating a 'process' instance for
+ each of them.

- This is a high overhead operation, and should be avoided if the perf python
- binding can be used to detect when new threads appear and existing ones
- terminate.
+ This is a high overhead operation, and should be avoided if the perf python
+ binding can be used to detect when new threads appear and existing ones
+ terminate.

- In RHEL it is found in the python-perf rpm package.
+ In RHEL it is found in the python-perf rpm package.

- More information about the perf facilities can be found in the 'perf_event_open'
- man page.
- """
+ More information about the perf facilities can be found in the 'perf_event_open'
+ man page.
+ """
del self.processes
self.processes = {}
pids = os.listdir(self.basedir)
--
2.4.3

125
SPECS/python-linux-procfs.spec

@ -0,0 +1,125 @@ @@ -0,0 +1,125 @@
%{!?python_sitelib: %define python_sitelib %(%{__python} -c "from distutils.sysconfig import get_python_lib; print get_python_lib()")}
%{!?python_ver: %define python_ver %(%{__python} -c "import sys ; print sys.version[:3]")}

Name: python-linux-procfs
Version: 0.4.9
Release: 3%{?dist}
License: GPLv2
Summary: Linux /proc abstraction classes
Group: System Environment/Libraries
Source: http://userweb.kernel.org/~acme/python-linux-procfs/%{name}-%{version}.tar.bz2

Patch1: pidstats-fix-documentation-indentation.patch
Patch2: fix-parse_affinity-for-CPU-numbers-greater-than-31.patch

URL: http://userweb.kernel.org/~acme/python-linux-procfs
BuildArch: noarch
BuildRequires: python-devel
BuildRoot: %(mktemp -ud %{_tmppath}/%{name}-%{version}-%{release}-XXXXXX)

%description
Abstractions to extract information from the Linux kernel /proc files.

%prep
%setup -q
%patch1 -p1
%patch2 -p1

%build
%{__python} setup.py build

%install
rm -rf %{buildroot}
%{__python} setup.py install --skip-build --root %{buildroot}
mkdir -p %{buildroot}%{_bindir}
cp pflags-cmd.py %{buildroot}%{_bindir}/pflags

%clean
rm -rf %{buildroot}

%files
%defattr(0755,root,root,0755)
%{_bindir}/pflags
%{python_sitelib}/procfs/
%defattr(0644,root,root,0755)
%if "%{python_ver}" >= "2.5"
%{python_sitelib}/*.egg-info
%endif
%doc COPYING

%changelog
* Wed Aug 24 2016 John Kacur <jkacur@redhat.com> - 0.4.9-3
- fix parse_affinity for CPU numbers greater than 31
Resolves: rhbz#1365902

* Tue Jul 05 2016 John Kacur <jkacur@redhat.com> - 0.4.9-2
- Rebuild for rhel-7.3
Resolves: rhbz#1245677

* Fri Nov 20 2015 John Kacur <jkacur@redhat.com> - 0.4.9-1
- update to v0.4.9
- Add pidstats-fix-documentation-indentation.patch
Resolves: rhbz#1235826

* Thu Jun 25 2015 John Kacur <jkacur@redhat.com> - 0.4.6-3
- procfs-Add-a-__contains__-method-to-dict-classes.patch
- pidstat-Add-PF_NO_SETAFFINITY-const.patch
- interrupts-Do-not-refrain-from-parsing-the-irq-affin.patch
- pidstat-Fix-process_flags-method.patch
- pidstat-Add-missing-PF_-flags.patch
- pflags-Add-command-line-utility-to-print-processor-f.patch
- pidstat-Support-COMM-names-with-spaces.patch
Resolves: rhbz#1232394

* Fri Dec 27 2013 Daniel Mach <dmach@redhat.com> - 0.4.6-2
- Mass rebuild 2013-12-27

* Fri Jun 14 2013 Jiri Kastner <jkastner@redhat.com> - 0.4.6-1
- updated to 0.4.6

* Thu Jun 6 2013 Jiri Kastner <jkastner@redhat.com> - 0.4.5-1
- Added support for parsing cgroups as a per thread attribute

* Thu Feb 14 2013 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 0.4.4-8
- Rebuilt for https://fedoraproject.org/wiki/Fedora_19_Mass_Rebuild

* Sat Jul 21 2012 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 0.4.4-7
- Rebuilt for https://fedoraproject.org/wiki/Fedora_18_Mass_Rebuild

* Sat Jan 14 2012 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 0.4.4-6
- Rebuilt for https://fedoraproject.org/wiki/Fedora_17_Mass_Rebuild

* Tue Feb 08 2011 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 0.4.4-5
- Rebuilt for https://fedoraproject.org/wiki/Fedora_15_Mass_Rebuild

* Thu Jul 22 2010 David Malcolm <dmalcolm@redhat.com> - 0.4.4-4
- Rebuilt for https://fedoraproject.org/wiki/Features/Python_2.7/MassRebuild

* Sun Jul 26 2009 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 0.4.4-3
- Rebuilt for https://fedoraproject.org/wiki/Fedora_12_Mass_Rebuild

* Thu Feb 26 2009 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 0.4.4-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_11_Mass_Rebuild

* Tue Feb 10 2009 Arnaldo Carvalho de Melo <acme@redhat.com> - 0.4.4-1
- Even more fixes due to the fedora review process

* Mon Feb 9 2009 Arnaldo Carvalho de Melo <acme@redhat.com> - 0.4.3-1
- Fixups due to the fedora review process

* Tue Aug 12 2008 Arnaldo Carvalho de Melo <acme@redhat.com> - 0.4.2-1
- interrupts: Add find_by_user_regex
- process: Always set the "cmdline" array, even if empty
- pidstats: Remove dead processes in find_by_name()
- pidstats: Add process class to catch dict references for late parsing
- pidstats: Move the /proc/PID/{stat,status} parsing to classes
- pidstats: Introduce process_flags method

* Tue Aug 12 2008 Arnaldo Carvalho de Melo <acme@redhat.com> - 0.4-1
- Per process flags needed by tuna

* Fri Jun 13 2008 Arnaldo Carvalho de Melo <acme@redhat.com> - 0.3-1
- Support CPU hotplug

* Mon Feb 25 2008 Arnaldo Carvalho de Melo <acme@redhat.com> - 0.1-1
- package created
Loading…
Cancel
Save