From fa4930e669a5d65f2b30a5edd52bd4b4381b4a3b Mon Sep 17 00:00:00 2001 From: CentOS Sources Date: Oct 31 2019 14:26:12 +0000 Subject: import python-linux-procfs-0.4.11-4.el7 --- diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..1e8f01f --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +SOURCES/python-linux-procfs-0.4.11.tar.bz2 diff --git a/.python-linux-procfs.metadata b/.python-linux-procfs.metadata new file mode 100644 index 0000000..63f6293 --- /dev/null +++ b/.python-linux-procfs.metadata @@ -0,0 +1 @@ +7672a83d64b9ed78dcd3558cfc3a61eee4d340ca SOURCES/python-linux-procfs-0.4.11.tar.bz2 diff --git a/SOURCES/pflags_Use_argparse_to_create_help_option.patch b/SOURCES/pflags_Use_argparse_to_create_help_option.patch new file mode 100644 index 0000000..688d239 --- /dev/null +++ b/SOURCES/pflags_Use_argparse_to_create_help_option.patch @@ -0,0 +1,59 @@ +From 1694ab2ab3628cead18ba7aa59e134e80675c601 Mon Sep 17 00:00:00 2001 +From: John Kacur +Date: Fri, 30 Nov 2018 11:50:34 -0500 +Subject: [PATCH 1/2] python-linux-procfs: pflags: Use argparse to create a + help option + +The purpose of this change is to create a -h or --help option. +In addition 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 arguments 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-cmd.py | 8 +++++++- + 1 file changed, 7 insertions(+), 1 deletion(-) + +diff --git a/pflags-cmd.py b/pflags-cmd.py +index 9228c688e7a2..f180ed505977 100755 +--- a/pflags-cmd.py ++++ b/pflags-cmd.py +@@ -15,6 +15,7 @@ + # General Public License for more details. + + import procfs, re, fnmatch, sys ++import argparse + + ps = None + +@@ -35,8 +36,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, map(thread_mapper, argv[1].split(","))) ++ pids = args.pid ++ pids = reduce(lambda i, j: i + j, list(map(thread_mapper, pids))) + else: + pids = ps.processes.keys() + +-- +2.19.2 + diff --git a/SOURCES/pflags_ignore_non-existent_pids.patch b/SOURCES/pflags_ignore_non-existent_pids.patch new file mode 100644 index 0000000..90c1b07 --- /dev/null +++ b/SOURCES/pflags_ignore_non-existent_pids.patch @@ -0,0 +1,40 @@ +From e153f5177e1ae4b7859454a2d3011d6f55710600 Mon Sep 17 00:00:00 2001 +From: John Kacur +Date: Mon, 3 Dec 2018 09:02:34 -0500 +Subject: [PATCH 2/2] 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 don't +calculte max_comm_len since you can't take the max of an empty list. + +Signed-off-by: John Kacur +--- + pflags-cmd.py | 7 +++++-- + 1 file changed, 5 insertions(+), 2 deletions(-) + +diff --git a/pflags-cmd.py b/pflags-cmd.py +index f180ed505977..c2627dcec14e 100755 +--- a/pflags-cmd.py ++++ b/pflags-cmd.py +@@ -47,11 +47,14 @@ def main(argv): + pids = ps.processes.keys() + + pids.sort() +- len_comms = map(lambda pid: len(ps[pid]["stat"]["comm"]), pids) +- max_comm_len = max(len_comms) ++ len_comms = [len(ps[pid]["stat"]["comm"]) for pid in pids if pid in ps] ++ if len_comms: ++ max_comm_len = max(len_comms) + 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/SPECS/python-linux-procfs.spec b/SPECS/python-linux-procfs.spec new file mode 100644 index 0000000..c82c0d5 --- /dev/null +++ b/SPECS/python-linux-procfs.spec @@ -0,0 +1,151 @@ +%{!?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.11 +Release: 4%{?dist} +License: GPLv2 +Summary: Linux /proc abstraction classes +Group: System Environment/Libraries + +URL: https://git.kernel.org/pub/scm/libs/python/python-linux-procfs/python-linux-procfs.git +# If upstream does not provide tarballs, to generate +# git clone git://git.kernel.org/pub/scm/libs/python/python-linux-procfs/python-linux-procfs.git +# cd python-linux-procfs +# git archive --format=tar --prefix=python-linux-procfs-%%{version}/ v%%{version} | bzip2 -c > python-linux-procfs-%%{version}.tar.bz2 +Source: https://git.kernel.org/pub/scm/libs/python/python-linux-procfs/python-linux-procfs.git/snapshot/%{name}-%{version}.tar.bz2 + +# PATCHES +Patch1: pflags_Use_argparse_to_create_help_option.patch +Patch2: pflags_ignore_non-existent_pids.patch + +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 +* Tue Dec 04 2018 John Kacur - 0.4.11-4 +- Need to apply the patch in prep +Resolves: rhbz#1654311 + +* Mon Dec 03 2018 John Kacur - 0.4.11-3 +- Ignore non-existent pids +Resolves: rhbz#1654311 + +* Mon Dec 03 2018 John Kacur - 0.4.11-2 +- Use argparse to create a help option +Resolves: rhbz#1654700 + +* Fri Nov 30 2018 John Kacur - 0.4.11-1 +- Upgrade to upstream v0.4-11 +Resolves: rhbz#1654726 + +* Thu May 31 2018 John Kacur - 0.4.9-4 +- Fix upstream URL reference and source +Resolves: rhbz#1583961 + +* Wed Aug 24 2016 John Kacur - 0.4.9-3 +- fix parse_affinity for CPU numbers greater than 31 +Resolves: rhbz#1365902 + +* Tue Jul 05 2016 John Kacur - 0.4.9-2 +- Rebuild for rhel-7.3 +Resolves: rhbz#1245677 + +* Fri Nov 20 2015 John Kacur - 0.4.9-1 +- update to v0.4.9 +- Add pidstats-fix-documentation-indentation.patch +Resolves: rhbz#1235826 + +* Thu Jun 25 2015 John Kacur - 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 - 0.4.6-2 +- Mass rebuild 2013-12-27 + +* Fri Jun 14 2013 Jiri Kastner - 0.4.6-1 +- updated to 0.4.6 + +* Thu Jun 6 2013 Jiri Kastner - 0.4.5-1 +- Added support for parsing cgroups as a per thread attribute + +* Thu Feb 14 2013 Fedora Release Engineering - 0.4.4-8 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_19_Mass_Rebuild + +* Sat Jul 21 2012 Fedora Release Engineering - 0.4.4-7 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_18_Mass_Rebuild + +* Sat Jan 14 2012 Fedora Release Engineering - 0.4.4-6 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_17_Mass_Rebuild + +* Tue Feb 08 2011 Fedora Release Engineering - 0.4.4-5 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_15_Mass_Rebuild + +* Thu Jul 22 2010 David Malcolm - 0.4.4-4 +- Rebuilt for https://fedoraproject.org/wiki/Features/Python_2.7/MassRebuild + +* Sun Jul 26 2009 Fedora Release Engineering - 0.4.4-3 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_12_Mass_Rebuild + +* Thu Feb 26 2009 Fedora Release Engineering - 0.4.4-2 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_11_Mass_Rebuild + +* Tue Feb 10 2009 Arnaldo Carvalho de Melo - 0.4.4-1 +- Even more fixes due to the fedora review process + +* Mon Feb 9 2009 Arnaldo Carvalho de Melo - 0.4.3-1 +- Fixups due to the fedora review process + +* Tue Aug 12 2008 Arnaldo Carvalho de Melo - 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 - 0.4-1 +- Per process flags needed by tuna + +* Fri Jun 13 2008 Arnaldo Carvalho de Melo - 0.3-1 +- Support CPU hotplug + +* Mon Feb 25 2008 Arnaldo Carvalho de Melo - 0.1-1 +- package created