import tuna-0.18-4.el8
This commit is contained in:
parent
e02e33e398
commit
8584cb70d6
66
SOURCES/tuna-tuna-cmd.py-use-fstrings.patch
Normal file
66
SOURCES/tuna-tuna-cmd.py-use-fstrings.patch
Normal file
@ -0,0 +1,66 @@
|
||||
From e9f60274865475c4e9081ee356ffbc61d1df2ade Mon Sep 17 00:00:00 2001
|
||||
From: Leah Leshchinsky <lleshchi@redhat.com>
|
||||
Date: Wed, 2 Nov 2022 10:57:19 -0400
|
||||
Subject: [PATCH 3/3] tuna: tuna-cmd.py use fstrings
|
||||
|
||||
Add fstrings where possible to improve readabilty
|
||||
|
||||
Due to the discussion regarding dropping the language feature, gettext
|
||||
shorthand _() have been removed.
|
||||
|
||||
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 79e33371837e..75b63da972c2 100755
|
||||
--- a/tuna-cmd.py
|
||||
+++ b/tuna-cmd.py
|
||||
@@ -176,13 +176,16 @@ def thread_help(tid):
|
||||
ps = procfs.pidstats()
|
||||
|
||||
if tid not in ps:
|
||||
- print("tuna: " + _("thread %d doesn't exists!") % tid)
|
||||
+ print(f"tuna: thread {tid} doesn't exist!")
|
||||
return
|
||||
|
||||
pinfo = ps[tid]
|
||||
cmdline = procfs.process_cmdline(pinfo)
|
||||
help, title = tuna.kthread_help_plain_text(tid, cmdline)
|
||||
- print("%s\n\n%s" % (title, _(help)))
|
||||
+ print(title, "\n\n")
|
||||
+ if help.isspace():
|
||||
+ help = "No help description available."
|
||||
+ print(help)
|
||||
|
||||
|
||||
def save(cpu_list, thread_list, filename):
|
||||
@@ -208,7 +211,7 @@ def ps_show_header(has_ctxt_switch_info, cgroups=False):
|
||||
|
||||
def ps_show_sockets(pid, ps, inodes, inode_re, indent=0):
|
||||
header_printed = False
|
||||
- dirname = "/proc/%s/fd" % pid
|
||||
+ dirname = f"/proc/{pid}/fd"
|
||||
try:
|
||||
filenames = os.listdir(dirname)
|
||||
except: # Process died
|
||||
@@ -650,7 +653,7 @@ def main():
|
||||
try:
|
||||
gui_refresh=int(a)
|
||||
except Exception as err:
|
||||
- print("tuna: --refresh %s" % err)
|
||||
+ print(f"tuna: --refresh {err}")
|
||||
sys.exit(2)
|
||||
elif o in ("-d", "--disable_perf"):
|
||||
run_gui = True
|
||||
@@ -679,7 +682,7 @@ def main():
|
||||
try:
|
||||
tuna.threads_set_priority(thread_list, a, affect_children)
|
||||
except OSError as err:
|
||||
- print("tuna: %s" % err)
|
||||
+ print(f"tuna: {err}")
|
||||
sys.exit(2)
|
||||
elif o in ("-P", "--show_threads"):
|
||||
# If the user specified process names that weren't
|
||||
--
|
||||
2.31.1
|
||||
|
94
SOURCES/tuna-tuna.py-use-fstrings.patch
Normal file
94
SOURCES/tuna-tuna.py-use-fstrings.patch
Normal file
@ -0,0 +1,94 @@
|
||||
From 5f90d8b80a259884d3ca2a647fdf9471b7d7091c Mon Sep 17 00:00:00 2001
|
||||
From: Leah Leshchinsky <lleshchi@redhat.com>
|
||||
Date: Mon, 31 Oct 2022 13:15:07 -0400
|
||||
Subject: [PATCH 1/3] tuna: tuna.py use fstrings
|
||||
|
||||
Add fstrings where possible to improve readabilty
|
||||
|
||||
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 84419c957b1b..e64211b88fc3 100755
|
||||
--- a/tuna/tuna.py
|
||||
+++ b/tuna/tuna.py
|
||||
@@ -58,7 +58,7 @@ def iskthread(pid):
|
||||
# in this function, so that they know that the thread vanished and
|
||||
# can act accordingly, removing entries from tree views, etc
|
||||
try:
|
||||
- f = open("/proc/%d/smaps" % pid)
|
||||
+ f = open(f"/proc/{pid}/smaps")
|
||||
except IOError:
|
||||
# Thread has vanished
|
||||
return True
|
||||
@@ -88,7 +88,7 @@ def is_irq_thread(cmd):
|
||||
return cmd[:4] in ("IRQ-", "irq/")
|
||||
|
||||
def threaded_irq_re(irq):
|
||||
- return re.compile("(irq/%s-.+|IRQ-%s)" % (irq, irq))
|
||||
+ return re.compile(f"(irq/{irq}-.+|IRQ-{irq})")
|
||||
|
||||
# FIXME: Move to python-linux-procfs
|
||||
def has_threaded_irqs(ps):
|
||||
@@ -96,10 +96,10 @@ def has_threaded_irqs(ps):
|
||||
return len(ps.find_by_regex(irq_re)) > 0
|
||||
|
||||
def set_irq_affinity_filename(filename, bitmasklist):
|
||||
- pathname = "/proc/irq/%s" % filename
|
||||
+ pathname = f"/proc/irq/{filename}"
|
||||
f = open(pathname, "w")
|
||||
text = ",".join(["%x" % a for a in bitmasklist])
|
||||
- f.write("%s\n" % text)
|
||||
+ f.write(f"{text}\n")
|
||||
try:
|
||||
f.close()
|
||||
except IOError:
|
||||
@@ -225,7 +225,7 @@ def move_threads_to_cpu(cpus, pid_list, set_affinity_warning=None, spread=False)
|
||||
if pid not in ps:
|
||||
continue
|
||||
|
||||
- threads = procfs.pidstats("/proc/%d/task" % pid)
|
||||
+ threads = procfs.pidstats(f"/proc/{pid}/task")
|
||||
for tid in list(threads.keys()):
|
||||
try:
|
||||
curr_affinity = os.sched_getaffinity(tid)
|
||||
@@ -320,11 +320,11 @@ def affinity_remove_cpus(affinity, cpus, nr_cpus):
|
||||
# Should be moved to python_linux_procfs.interrupts, shared with interrupts.parse_affinity, etc.
|
||||
def parse_irq_affinity_filename(filename, nr_cpus):
|
||||
try:
|
||||
- f = open("/proc/irq/%s" % filename)
|
||||
+ f = open(f"/proc/irq/{filename}")
|
||||
except IOError as err:
|
||||
if procfs.is_s390():
|
||||
print("This operation is not supported on s390", file=sys.stderr)
|
||||
- print("tuna: %s" % err, file=sys.stderr)
|
||||
+ print(f"tuna: {err}", file=sys.stderr)
|
||||
sys.exit(2)
|
||||
|
||||
line = f.readline()
|
||||
@@ -627,19 +627,19 @@ def run_command(cmd, policy, rtprio, cpu_list):
|
||||
try:
|
||||
thread_set_priority(pid, policy, rtprio)
|
||||
except (SystemError, OSError) as err:
|
||||
- print("tuna: %s" % err)
|
||||
+ print(f"tuna: {err}")
|
||||
sys.exit(2)
|
||||
if cpu_list:
|
||||
try:
|
||||
os.sched_setaffinity(pid, cpu_list)
|
||||
except (SystemError, OSError) as err:
|
||||
- print("tuna: %s" % err)
|
||||
+ print(f"tuna: {err}")
|
||||
sys.exit(2)
|
||||
|
||||
try:
|
||||
os.execvp(cmd_list[0], cmd_list)
|
||||
except (SystemError, OSError) as err:
|
||||
- print("tuna: %s" % err)
|
||||
+ print(f"tuna: {err}")
|
||||
sys.exit(2)
|
||||
else:
|
||||
os.waitpid(newpid, 0)
|
||||
--
|
||||
2.31.1
|
||||
|
26
SOURCES/tuna-tuna_gui.py-use-fstrings.patch
Normal file
26
SOURCES/tuna-tuna_gui.py-use-fstrings.patch
Normal file
@ -0,0 +1,26 @@
|
||||
From f53f77f73199f398713f8edfdfa417cf8b9e1a74 Mon Sep 17 00:00:00 2001
|
||||
From: Leah Leshchinsky <lleshchi@redhat.com>
|
||||
Date: Fri, 28 Oct 2022 13:14:04 -0400
|
||||
Subject: [PATCH 2/3] tuna: tuna_gui.py use fstrings
|
||||
|
||||
Add fstrings where possible to improve readabilty
|
||||
|
||||
Signed-off-by: Leah Leshchinsky <lleshchi@redhat.com>
|
||||
Signed-off-by: John Kacur <jkacur@redhat.com>
|
||||
|
||||
diff --git a/tuna/tuna_gui.py b/tuna/tuna_gui.py
|
||||
index f1f2caacbcba..459f90303ed5 100755
|
||||
--- a/tuna/tuna_gui.py
|
||||
+++ b/tuna/tuna_gui.py
|
||||
@@ -33,7 +33,7 @@ class main_gui:
|
||||
if self.check_root():
|
||||
sys.exit(1)
|
||||
for dir in tuna_glade_dirs:
|
||||
- tuna_glade = "%s/tuna_gui.glade" % dir
|
||||
+ tuna_glade = f"{dir}/tuna_gui.glade"
|
||||
if os.access(tuna_glade, os.F_OK):
|
||||
break
|
||||
self.wtree = Gtk.Builder()
|
||||
--
|
||||
2.31.1
|
||||
|
@ -1,6 +1,6 @@
|
||||
Name: tuna
|
||||
Version: 0.18
|
||||
Release: 3%{?dist}
|
||||
Release: 4%{?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-Replace-python_ethtool-with-builtin-funtionalit.patch
|
||||
Patch2: tuna-Fix-matching-irqs-in-ps_show_thread.patch
|
||||
Patch3: tuna-tuna.py-use-fstrings.patch
|
||||
Patch4: tuna-tuna_gui.py-use-fstrings.patch
|
||||
Patch5: tuna-tuna-cmd.py-use-fstrings.patch
|
||||
|
||||
%description
|
||||
Provides interface for changing scheduler and IRQ tunables, at whole CPU and at
|
||||
@ -28,9 +31,7 @@ Can be used as a command line utility without requiring the GUI libraries to be
|
||||
installed.
|
||||
|
||||
%prep
|
||||
%setup -q
|
||||
%patch1 -p1
|
||||
%patch2 -p1
|
||||
%autosetup -p1
|
||||
|
||||
%build
|
||||
%{__python3} setup.py build
|
||||
@ -77,7 +78,11 @@ rm -rf %{buildroot}
|
||||
%{_datadir}/polkit-1/actions/org.tuna.policy
|
||||
|
||||
%changelog
|
||||
* Mon Oct 03 2022 John Kacur <jkacur@redhat.com> - 0.18-5
|
||||
* Wed Nov 02 2022 Leah Leshchinsky <lleshchi@redhat.com> - 0.18-4
|
||||
- Use f-strings in tuna where possible
|
||||
Resolves: rhbz#2120805
|
||||
|
||||
* Mon Oct 03 2022 John Kacur <jkacur@redhat.com> - 0.18-3
|
||||
- Match irqs with "irqs/"
|
||||
Resolves: rhbz#2131353
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user