import tuna-0.17-2.el8

This commit is contained in:
CentOS Sources 2022-04-20 18:09:44 +00:00 committed by Stepan Oksanichenko
parent dd1a54f7cb
commit f14117e6a2
4 changed files with 112 additions and 1 deletions

View File

@ -0,0 +1,26 @@
From 8cad3c289471b985a8d0b7f698fcbf5ecbfa7bb5 Mon Sep 17 00:00:00 2001
From: Leah Leshchinsky <lleshchi@redhat.com>
Date: Wed, 2 Feb 2022 15:18:26 -0500
Subject: [PATCH 1/5] tuna: Fix typo for variable 'parm'
Variable 'parms' should be 'parm'. Fix typo.
Signed-off-by: Leah Leshchinsky <lleshchi@redhat.com>
Signed-off-by: John Kacur <jkacur@redhat.com>
diff --git a/tuna/tuna.py b/tuna/tuna.py
index 8fb42121e2e4..126990339985 100755
--- a/tuna/tuna.py
+++ b/tuna/tuna.py
@@ -561,7 +561,7 @@ def threads_set_priority(tids, parm, affect_children=False):
try:
(policy, rtprio) = get_policy_and_rtprio(parm)
except ValueError:
- print("tuna: " + _("\"%s\" is unsupported priority value!") % parms[0])
+ print("tuna: " + _("\"%s\" is an unsupported priority value!") % parm[0])
return
for tid in tids:
--
2.27.0

View File

@ -0,0 +1,39 @@
From f857c822256d512d351cda0d8fa4d5d255d1e64f Mon Sep 17 00:00:00 2001
From: Leah Leshchinsky <lleshchi@redhat.com>
Date: Wed, 2 Feb 2022 15:18:27 -0500
Subject: [PATCH 2/5] tuna: Handle get_policy_and_rtprio exceptions
In tuna-cmd.py, if a thread list is passed along with the
'--priority' flag, tuna.get_policy_and_rtprio() is called twice, first
directly, and then again by tuna.threads_set_priority(). The
expectation is that tuna.threads_set_priority will handle exceptions
raised by tuna.get_policy_and_rtprio(). This results in a failure to
handle exceptions that are raised by the initial direct call to
tuna.get_policy_and_rtprio().
Handle exceptions that may be raised during direct calls to
get_policy_and_rtprio in tuna-cmd.py.
Signed-off-by: Leah Leshchinsky <lleshchi@redhat.com>
Signed-off-by: John Kacur <jkacur@redhat.com>
diff --git a/tuna-cmd.py b/tuna-cmd.py
index cf117ec046ff..2b6e91bd0104 100755
--- a/tuna-cmd.py
+++ b/tuna-cmd.py
@@ -601,7 +601,11 @@ def main():
tuna.include_cpus(cpu_list, get_nr_cpus())
elif o in ("-p", "--priority"):
# Save policy and rtprio for future Actions (e.g. --run).
- (policy, rtprio) = tuna.get_policy_and_rtprio(a)
+ try:
+ (policy, rtprio) = tuna.get_policy_and_rtprio(a)
+ except ValueError:
+ print("tuna: " + _("\"%s\" is an unsupported priority value!") % a)
+ sys.exit(2)
if not thread_list:
# For backward compatibility
p_waiting_action = True
--
2.27.0

View File

@ -0,0 +1,34 @@
From adba6d6cad1a5c9f062dcf5ee4b4be40d4dc134f Mon Sep 17 00:00:00 2001
From: Leah Leshchinsky <lleshchi@redhat.com>
Date: Wed, 2 Feb 2022 15:18:29 -0500
Subject: [PATCH 3/5] tuna: Remove finally block in get_policy_and_rtprio
The implementation of the error handling block in
tuna.get_policy_and_rtprio() caused the exceptions raised by
tuna_sched.Policy to be consumed by the finally block.
When an invalid policy is passed via the '--priority' flag,
this consumption of the exception causes tuna to fail silently.
Remove the finally block in tuna.get_policy_and_rtprio().
Signed-off-by: Leah Leshchinsky <lleshchi@redhat.com>
Signed-off-by: John Kacur <jkacur@redhat.com>
diff --git a/tuna/tuna.py b/tuna/tuna.py
index 126990339985..31707c9cb69c 100755
--- a/tuna/tuna.py
+++ b/tuna/tuna.py
@@ -520,8 +520,8 @@ def get_policy_and_rtprio(parm):
rtprio = int(parms[1])
elif cp.is_rt():
rtprio = 1
- finally:
- return(policy, rtprio)
+
+ return (policy, rtprio)
def thread_filtered(tid, cpus_filtered, show_kthreads, show_uthreads):
if cpus_filtered:
--
2.27.0

View File

@ -1,6 +1,6 @@
Name: tuna
Version: 0.17
Release: 1%{?dist}
Release: 2%{?dist}
License: GPLv2
Summary: Application tuning GUI & command line utility
Group: Applications/System
@ -17,6 +17,9 @@ BuildRoot: %(mktemp -ud %{_tmppath}/%{name}-%{version}-%{release}-XXXXXX)
# PATCHES
Patch1: tuna-Fix-ModuleNotFoundError.patch
Patch2: tuna-Fix-typo-for-variable-parm.patch
Patch3: tuna-Handle-get_policy_and_rtprio-exceptions.patch
Patch4: tuna-Remove-finally-block-in-get_policy_and_rtprio.patch
%description
Provides interface for changing scheduler and IRQ tunables, at whole CPU and at
@ -30,6 +33,9 @@ installed.
%prep
%setup -q
%patch1 -p1
%patch2 -p1
%patch3 -p1
%patch4 -p1
%build
%{__python3} setup.py build
@ -76,6 +82,12 @@ rm -rf %{buildroot}
%{_datadir}/polkit-1/actions/org.tuna.policy
%changelog
* Mon Apr 11 2022 Leah Leshchinsky <lleshchi@redhat.com> - 0.17-2
- Fix typo for variable parm
- Handle get_policy_and_rtprio exceptions
- Remove finally block in get_policy_and_rtprio
Resolves: rhbz#2049746
* Thu Jan 13 2022 Leah Leshchinsky <lleshchi@redhat.com> - 0.17-1
- Rebase to upstream version 0.17
- Fix ModuleNotFoundError