another powertop-2.0 compatibility fix
Resolves: rhbz#830415
This commit is contained in:
parent
effc86626a
commit
9f67a15b77
@ -1,8 +1,23 @@
|
|||||||
diff --git a/experiments/powertop2tuned.py b/experiments/powertop2tuned.py
|
diff -up tuned-2.0.1/experiments/powertop2tuned.py.orig tuned-2.0.1/experiments/powertop2tuned.py
|
||||||
index 02a5b23..70c6f0b 100755
|
--- tuned-2.0.1/experiments/powertop2tuned.py.orig 2012-04-03 19:25:37.000000000 +0200
|
||||||
--- a/experiments/powertop2tuned.py
|
+++ tuned-2.0.1/experiments/powertop2tuned.py 2012-06-12 17:19:30.548102052 +0200
|
||||||
+++ b/experiments/powertop2tuned.py
|
@@ -44,12 +44,14 @@ stop() {
|
||||||
@@ -74,6 +74,8 @@ class PowertopHTMLParser(HTMLParser):
|
process $@
|
||||||
|
"""
|
||||||
|
|
||||||
|
-TUNED_CONF_PROLOG = "# Automatically generated by powertop2tuned tool"
|
||||||
|
+TUNED_CONF_PROLOG = "# Automatically generated by powertop2tuned tool\n\n"
|
||||||
|
TUNED_CONF_INCLUDE = """[main]
|
||||||
|
%s
|
||||||
|
+
|
||||||
|
"""
|
||||||
|
TUNED_CONF_EPILOG="""[powertop_script]
|
||||||
|
type=script
|
||||||
|
+replace=1
|
||||||
|
script=script.sh
|
||||||
|
"""
|
||||||
|
|
||||||
|
@@ -74,6 +76,8 @@ class PowertopHTMLParser(HTMLParser):
|
||||||
|
|
||||||
def handle_starttag(self, tag, attrs):
|
def handle_starttag(self, tag, attrs):
|
||||||
self.lastStartTag = tag
|
self.lastStartTag = tag
|
||||||
@ -11,7 +26,7 @@ index 02a5b23..70c6f0b 100755
|
|||||||
if self.inProperTable and tag == "td":
|
if self.inProperTable and tag == "td":
|
||||||
self.tdCounter += 1
|
self.tdCounter += 1
|
||||||
|
|
||||||
@@ -92,8 +94,6 @@ class PowertopHTMLParser(HTMLParser):
|
@@ -92,8 +96,6 @@ class PowertopHTMLParser(HTMLParser):
|
||||||
|
|
||||||
def handle_data(self, data):
|
def handle_data(self, data):
|
||||||
prefix = self.prefix
|
prefix = self.prefix
|
||||||
@ -20,7 +35,7 @@ index 02a5b23..70c6f0b 100755
|
|||||||
if self.inProperTable and self.tdCounter == 1:
|
if self.inProperTable and self.tdCounter == 1:
|
||||||
self.lastDesc = data
|
self.lastDesc = data
|
||||||
if self.lastDesc.lower().find("autosuspend") != -1 and (self.lastDesc.lower().find("keyboard") != -1 or self.lastDesc.lower().find("mouse") != -1):
|
if self.lastDesc.lower().find("autosuspend") != -1 and (self.lastDesc.lower().find("keyboard") != -1 or self.lastDesc.lower().find("mouse") != -1):
|
||||||
@@ -103,10 +103,10 @@ class PowertopHTMLParser(HTMLParser):
|
@@ -103,10 +105,10 @@ class PowertopHTMLParser(HTMLParser):
|
||||||
self.tdCounter = 0
|
self.tdCounter = 0
|
||||||
if not self.inScript:
|
if not self.inScript:
|
||||||
self.data += "\t# " + self.lastDesc + "\n"
|
self.data += "\t# " + self.lastDesc + "\n"
|
||||||
@ -33,7 +48,7 @@ index 02a5b23..70c6f0b 100755
|
|||||||
|
|
||||||
class PowertopProfile:
|
class PowertopProfile:
|
||||||
BAD_PRIVS = 100
|
BAD_PRIVS = 100
|
||||||
@@ -132,16 +132,18 @@ class PowertopProfile:
|
@@ -132,16 +134,18 @@ class PowertopProfile:
|
||||||
return True
|
return True
|
||||||
|
|
||||||
def generateHTML(self):
|
def generateHTML(self):
|
||||||
@ -49,15 +64,24 @@ index 02a5b23..70c6f0b 100755
|
|||||||
+ output = proc.communicate()[0]
|
+ output = proc.communicate()[0]
|
||||||
+ if proc.returncode != 0:
|
+ if proc.returncode != 0:
|
||||||
+ return ret
|
+ return ret
|
||||||
+
|
|
||||||
|
- return name;
|
||||||
+ prefix = "PowerTOP outputing using base filename "
|
+ prefix = "PowerTOP outputing using base filename "
|
||||||
+ if output.find(prefix) == -1:
|
+ if output.find(prefix) == -1:
|
||||||
+ return -1
|
+ return -1
|
||||||
|
+
|
||||||
- return name;
|
|
||||||
+ name = output[output.find(prefix)+len(prefix):-1]
|
+ name = output[output.find(prefix)+len(prefix):-1]
|
||||||
+ #print "Parsed filename=", [name]
|
+ #print "Parsed filename=", [name]
|
||||||
+ return name
|
+ return name
|
||||||
|
|
||||||
def parseHTML(self, enable_tunings):
|
def parseHTML(self, enable_tunings):
|
||||||
f = open(self.name)
|
f = open(self.name)
|
||||||
|
@@ -163,7 +167,7 @@ class PowertopProfile:
|
||||||
|
print "Generating Tuned config file", os.path.join(self.output, "tuned.conf")
|
||||||
|
f = open(os.path.join(self.output, "tuned.conf"), "w")
|
||||||
|
f.write(TUNED_CONF_PROLOG)
|
||||||
|
- if (new_profile):
|
||||||
|
+ if (not new_profile):
|
||||||
|
f.write(TUNED_CONF_INCLUDE % ("include=" + profile))
|
||||||
|
f.write(TUNED_CONF_EPILOG)
|
||||||
|
f.close()
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
Summary: A dynamic adaptive system tuning daemon
|
Summary: A dynamic adaptive system tuning daemon
|
||||||
Name: tuned
|
Name: tuned
|
||||||
Version: 2.0.1
|
Version: 2.0.1
|
||||||
Release: 2%{?dist}
|
Release: 3%{?dist}
|
||||||
License: GPLv2
|
License: GPLv2
|
||||||
# The source for this package was pulled from upstream git. Use the
|
# The source for this package was pulled from upstream git. Use the
|
||||||
# following commands to get the corresponding tarball:
|
# following commands to get the corresponding tarball:
|
||||||
@ -135,6 +135,10 @@ fi
|
|||||||
%{_prefix}/lib/tuned/spindown-disk
|
%{_prefix}/lib/tuned/spindown-disk
|
||||||
|
|
||||||
%changelog
|
%changelog
|
||||||
|
* Tue Jun 12 2012 Jaroslav Škarvada <jskarvad@redhat.com> - 2.0.1-3
|
||||||
|
- another powertop-2.0 compatibility fix
|
||||||
|
Resolves: rhbz#830415
|
||||||
|
|
||||||
* Tue Jun 12 2012 Jan Kaluza <jkaluza@redhat.com> - 2.0.1-2
|
* Tue Jun 12 2012 Jan Kaluza <jkaluza@redhat.com> - 2.0.1-2
|
||||||
- fixed powertop2tuned compatibility with powertop-2.0
|
- fixed powertop2tuned compatibility with powertop-2.0
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user