Automatic import for version 2.8.0-1

This commit is contained in:
Rosa 2017-08-18 12:11:21 +03:00
commit 3e14380f86
6 changed files with 311 additions and 0 deletions

2
.abf.yml Normal file
View file

@ -0,0 +1,2 @@
sources:
"tuned-2.8.0.tar.bz2": ab82f13f867aeb64e83d2fd7dcea883ce4e66f34

View file

@ -0,0 +1,41 @@
From 4865d6ab3fe874d57a0c9e9c871238182afaab37 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Per=20=C3=98yvind=20Karlsen=20=28proyvind=29?=
<proyvind@moondrake.org>
Date: Sun, 20 Apr 2014 15:22:58 +0200
Subject: [PATCH 2/3] get CPE string from /etc/os-release rather than the more
distro specific /etc/system-release-cpe
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Signed-off-by: Per Ãyvind Karlsen (proyvind) <proyvind@moondrake.org>
---
tuned/consts.py | 2 +-
tuned/utils/commands.py | 4 +++-
2 files changed, 4 insertions(+), 2 deletions(-)
diff -Naur tuned-2.5.1/tuned/consts.py tuned-2.5.1.tpg/tuned/consts.py
--- tuned-2.5.1/tuned/consts.py 2015-07-02 12:37:48.000000000 +0000
+++ tuned-2.5.1.tpg/tuned/consts.py 2015-08-26 00:40:48.202828285 +0000
@@ -29,7 +29,7 @@
LOG_FILE_MAXBYTES = 100*1000
LOG_FILE = "/var/log/tuned/tuned.log"
PID_FILE = "/run/tuned/tuned.pid"
-SYSTEM_RELEASE_FILE = "/etc/system-release-cpe"
+OS_RELEASE_FILE = "/etc/os-release"
# prefix for functions plugins
FUNCTION_PREFIX = "function_"
# prefix for exported environment variables when calling scripts
diff -Naur tuned-2.5.1/tuned/utils/commands.py tuned-2.5.1.tpg/tuned/utils/commands.py
--- tuned-2.5.1/tuned/utils/commands.py 2015-07-31 16:24:47.000000000 +0000
+++ tuned-2.5.1.tpg/tuned/utils/commands.py 2015-08-26 00:42:26.529380723 +0000
@@ -246,7 +246,9 @@
if not re.match(value, self.execute("virt-what")[1], re.S):
match = False
elif option == "system":
- if not re.match(value, self.read_file(consts.SYSTEM_RELEASE_FILE), re.S):
+ regex = re.search('CPE_NAME="(.*)"', read_file(consts.OS_RELEASE_FILE))
+ cpe = ("" if regex is None else regex.groups()[0])
+ if not re.match(value, cpe, re.S):
match = False
elif option[0] == "/":
if not os.path.exists(option) or not re.match(value, self.read_file(option), re.S):

3
governors.modules Normal file
View file

@ -0,0 +1,3 @@
cpufreq_ondemand
cpufreq_conservative
cpufreq_powersave

View file

@ -0,0 +1,11 @@
diff -Naur tuned-2.7.0/tuned.service tuned-2.7.0.tpg/tuned.service
--- tuned-2.7.0/tuned.service 2016-06-16 16:10:59.000000000 +0000
+++ tuned-2.7.0.tpg/tuned.service 2016-07-20 22:38:51.438209707 +0000
@@ -3,6 +3,7 @@
After=syslog.target systemd-sysctl.service network.target
Requires=dbus.service polkit.service
Conflicts=cpupower.service
+ConditionVirtualization=no
[Service]
Type=dbus

48
tuned-2.7.0-python3.patch Normal file
View file

@ -0,0 +1,48 @@
diff -Naur tuned-2.8.0/Makefile tuned-2.8.0.tpg/Makefile
--- tuned-2.8.0/Makefile 2017-04-11 14:05:16.000000000 +0000
+++ tuned-2.8.0.tpg/Makefile 2017-04-29 21:29:15.256193107 +0000
@@ -29,7 +29,7 @@
DATADIR = /usr/share
DOCDIR = $(DATADIR)/doc/$(NAME)
-PYTHON_SITELIB = $(shell python -c 'from distutils.sysconfig import get_python_lib; print get_python_lib();' || echo /usr/lib/python2.7/site-packages)
+PYTHON_SITELIB = $(shell python -c 'from distutils.sysconfig import get_python_lib; print(get_python_lib());' || echo /usr/lib/python2.7/site-packages)
TUNED_PROFILESDIR = /usr/lib/tuned
BASH_COMPLETIONS = $(DATADIR)/bash-completion/completions
diff -Naur tuned-2.8.0/tuned/daemon/application.py tuned-2.8.0.tpg/tuned/daemon/application.py
--- tuned-2.8.0/tuned/daemon/application.py 2017-04-29 21:03:15.138214904 +0000
+++ tuned-2.8.0.tpg/tuned/daemon/application.py 2017-04-29 21:27:46.470189724 +0000
@@ -100,7 +100,7 @@
os.makedirs(dir_name)
fd = os.open(self._pid_file, os.O_CREAT|os.O_TRUNC|os.O_WRONLY , 0o644)
- os.write(fd, "%d" % os.getpid())
+ os.write(fd, b"%d" % os.getpid())
os.close(fd)
except (OSError,IOError) as error:
log.critical("cannot write the PID to %s: %s" % (self._pid_file, str(error)))
diff -Naur tuned-2.8.0/tuned/plugins/plugin_sysctl.py tuned-2.8.0.tpg/tuned/plugins/plugin_sysctl.py
--- tuned-2.8.0/tuned/plugins/plugin_sysctl.py 2017-04-29 21:03:15.139214904 +0000
+++ tuned-2.8.0.tpg/tuned/plugins/plugin_sysctl.py 2017-04-29 21:31:19.733197851 +0000
@@ -74,7 +74,7 @@
def _read_sysctl(self, option):
retcode, stdout = self._execute_sysctl(["-e", option])
if retcode == 0:
- parts = [self._cmd.remove_ws(value) for value in stdout.split("=", 1)]
+ parts = [self._cmd.remove_ws(str(value)) for value in stdout.split(b"=", 1)]
if len(parts) == 2:
option, value = parts
return value
diff -Naur tuned-2.8.0/tuned/profiles/variables.py tuned-2.8.0.tpg/tuned/profiles/variables.py
--- tuned-2.8.0/tuned/profiles/variables.py 2017-04-29 21:03:15.134214904 +0000
+++ tuned-2.8.0.tpg/tuned/profiles/variables.py 2017-04-29 21:28:40.896191798 +0000
@@ -1,7 +1,7 @@
import os
import re
import tuned.logs
-from . import functions.functions as functions
+from .functions import functions
import tuned.consts as consts
from tuned.utils.commands import commands
from configobj import ConfigObj, ConfigObjError

206
tuned.spec Normal file
View file

@ -0,0 +1,206 @@
%define __noautoreq /usr/bin/stap
%global _libexecdir %{_prefix}/libexec
Summary: A dynamic adaptive system tuning daemon
Name: tuned
Version: 2.8.0
Release: 1
License: GPLv2+
Group: System/Kernel and hardware
Url: https://fedorahosted.org/tuned/
Source0: https://fedorahosted.org/releases/t/u/tuned/%{name}-%{version}.tar.bz2
Source1: governors.modules
Patch1: 0002-get-CPE-string-from-etc-os-release-rather-than-the-m.patch
Patch3: tuned-2.4.1-dont-start-in-virtual-env.patch
Patch4: tuned-2.7.0-python3.patch
BuildRequires: pkgconfig(python)
BuildRequires: pythonegg(six)
Requires: cpupower
Requires: dbus
Requires: ethtool
Requires: hdparm
Requires: polkit
Requires: python-dbus
Requires: python-gi
Requires: pythonegg(configobj)
Requires: pythonegg(decorator)
Requires: pythonegg(pyudev)
Requires: pythonegg(six)
Requires: typelib(GObject)
Requires: virt-what
Requires(post): virt-what
BuildArch: noarch
%description
The tuned package contains a daemon that tunes system settings dynamically.
It does so by monitoring the usage of several system components periodically.
Based on that information components will then be put into lower or higher
power saving modes to adapt to the current usage. Currently only ethernet
network and ATA harddisk devices are implemented.
%files
%doc AUTHORS README doc/TIPS.txt
%{_sysconfdir}/modprobe.preload.d/governors
%{_datadir}/bash-completion/completions/tuned-adm
%exclude %{python_sitelib}/tuned/gtk
%{python_sitelib}/tuned
%{_sbindir}/tuned
%{_sbindir}/tuned-adm
%exclude %{_prefix}/lib/tuned/default
%exclude %{_prefix}/lib/tuned/desktop-powersave
%exclude %{_prefix}/lib/tuned/laptop-ac-powersave
%exclude %{_prefix}/lib/tuned/server-powersave
%exclude %{_prefix}/lib/tuned/laptop-battery-powersave
%exclude %{_prefix}/lib/tuned/enterprise-storage
%exclude %{_prefix}/lib/tuned/spindown-disk
%exclude %{_mandir}/man7/tuned-profiles-compat.7*
%{_prefix}/lib/tuned
%dir %{_sysconfdir}/tuned
%config(noreplace) %{_sysconfdir}/tuned/active_profile
%config(noreplace) %{_sysconfdir}/tuned/tuned-main.conf
%config(noreplace) %{_sysconfdir}/tuned/bootcmdline
%config(noreplace) %{_sysconfdir}/tuned/cpu-partitioning-variables.conf
%config(noreplace) %{_sysconfdir}/tuned/realtime-variables.conf
%config(noreplace) %{_sysconfdir}/tuned/realtime-virtual-guest-variables.conf
%config(noreplace) %{_sysconfdir}/tuned/realtime-virtual-host-variables.conf
%{_sysconfdir}/dbus-1/system.d/com.redhat.tuned.conf
%verify(not size mtime md5) %{_sysconfdir}/modprobe.d/tuned.conf
%{_tmpfilesdir}/tuned.conf
%{_unitdir}/tuned.service
%{_presetdir}/86-tuned.preset
%{_libexecdir}/tuned/defirqaffinity.py
%dir %{_localstatedir}/log/tuned
%dir /run/tuned
%{_mandir}/man5/tuned*
%{_mandir}/man7/tuned-profiles*
%{_mandir}/man8/tuned*
%{_sysconfdir}/grub.d/00_tuned
%{_datadir}/polkit-1/actions/com.redhat.tuned.policy
%post
# try to autodetect the best profile for the system in case there is none preset
if [ ! -f %{_sysconfdir}/tuned/active_profile -o -z "`cat %{_sysconfdir}/tuned/active_profile 2>/dev/null`" ]
then
PROFILE=`%{_sbindir}/tuned-adm recommend 2>/dev/null`
[ "$PROFILE" ] || PROFILE=balanced
%{_sbindir}/tuned-adm profile "$PROFILE" 2>/dev/null || echo -n "$PROFILE" > %{_sysconfdir}/tuned/active_profile
fi
# convert active_profile from full path to name (if needed)
sed -e 's|.*/\([^/]\+\)/[^\.]\+\.conf|\1|' -i %{_sysconfdir}/tuned/active_profile
%systemd_post {name}
%preun
%systemd_preun {name}
#----------------------------------------------------------------------------
%package gtk
Summary: GTK GUI for tuned
Group: System/Kernel and hardware
Requires: %{name} = %{EVRD}
Requires: polkit
Requires: powertop
Requires: python-gi
%description gtk
GTK GUI that can control tuned and provide simple profile editor.
%files gtk
%{_sbindir}/tuned-gui
%{python_sitelib}/tuned/gtk
%{_datadir}/tuned/ui
%{_datadir}/polkit-1/actions/com.redhat.tuned.gui.policy
%{_iconsdir}/hicolor/scalable/apps/tuned.svg
%{_datadir}/applications/tuned-gui.desktop
#----------------------------------------------------------------------------
%package profiles-compat
Summary: Additional tuned profiles mainly for backward compatibility with tuned 1.0
Group: System/Kernel and hardware
Requires: %{name} = %{EVRD}
%description profiles-compat
Additional tuned profiles mainly for backward compatibility with tuned 1.0.
It can be also used to fine tune your system for specific scenarios.
%files profiles-compat
%{_prefix}/lib/tuned/default
%{_prefix}/lib/tuned/desktop-powersave
%{_prefix}/lib/tuned/laptop-ac-powersave
%{_prefix}/lib/tuned/server-powersave
%{_prefix}/lib/tuned/laptop-battery-powersave
%{_prefix}/lib/tuned/enterprise-storage
%{_prefix}/lib/tuned/spindown-disk
%{_mandir}/man7/tuned-profiles-compat.7*
#----------------------------------------------------------------------------
%package utils
Summary: Various tuned utilities
Group: System/Kernel and hardware
Requires: %{name} = %{EVRD}
Requires: powertop
%description utils
This package contains utilities that can help you to fine tune and
debug your system and manage tuned profiles.
%files utils
%{_bindir}/powertop2tuned
%{_libexecdir}/tuned/pmqos-static*
#----------------------------------------------------------------------------
%package utils-systemtap
Summary: Disk and net statistic monitoring systemtap scripts
Group: System/Kernel and hardware
Requires: %{name} = %{EVRD}
Requires: systemtap
%description utils-systemtap
This package contains several systemtap scripts to allow detailed
manual monitoring of the system. Instead of the typical IO/sec it collects
minimal, maximal and average time between operations to be able to
identify applications that behave power inefficient (many small operations
instead of fewer large ones).
%files utils-systemtap
%doc doc/README.utils
%doc doc/README.scomes
%{_sbindir}/varnetload
%{_sbindir}/netdevstat
%{_sbindir}/diskdevstat
%{_sbindir}/scomes
%{_mandir}/man8/varnetload.*
%{_mandir}/man8/netdevstat.*
%{_mandir}/man8/diskdevstat.*
%{_mandir}/man8/scomes.*
#----------------------------------------------------------------------------
%prep
%setup -q
find . -name "*.py" |xargs 2to3 -w
# Python 3.x is WAY more picky about mixing tabs and spaces than 2.x
find . -name "*.py" |xargs sed -i -e 's, , ,g'
%apply_patches
%build
%make
%install
%makeinstall_std
rm -r %{buildroot}%{_docdir}/%{name}
install -d %{buildroot}%{_presetdir}
cat > %{buildroot}%{_presetdir}/86-tuned.preset << EOF
enable tuned.service
EOF
# (tpg) install cpu governors's modules
install -D -m644 %{SOURCE1} %{buildroot}%{_sysconfdir}/modprobe.preload.d/governors