From 6f86f6838733d73c01348de32a083b8491923128889efabce70539dcc3a3dc26 Mon Sep 17 00:00:00 2001 From: Stephan Kulow Date: Mon, 6 Feb 2012 14:55:14 +0000 Subject: [PATCH] Accepting request 102498 from Base:System Update to powertop 1.98 (forwarded request 102454 from a_jaeger) OBS-URL: https://build.opensuse.org/request/show/102498 OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/powertop?expand=0&rev=23 --- powertop-1.13.tar.bz2 | 3 - powertop-1.98-always-create-params.patch | 36 ++++++++ powertop-1.98-compile-fix.patch | 110 +++++++++++++++++++++++ powertop-1.98-unknown-readings-fix.patch | 35 ++++++++ powertop-1.98.tar.bz2 | 3 + powertop-no-date.patch | 13 +++ powertop.changes | 6 ++ powertop.spec | 51 +++++++---- powertop_fix_sizof_link.patch | 22 ----- powertop_set_cflags_override.patch | 36 +++++--- 10 files changed, 259 insertions(+), 56 deletions(-) delete mode 100644 powertop-1.13.tar.bz2 create mode 100644 powertop-1.98-always-create-params.patch create mode 100644 powertop-1.98-compile-fix.patch create mode 100644 powertop-1.98-unknown-readings-fix.patch create mode 100644 powertop-1.98.tar.bz2 create mode 100644 powertop-no-date.patch delete mode 100644 powertop_fix_sizof_link.patch diff --git a/powertop-1.13.tar.bz2 b/powertop-1.13.tar.bz2 deleted file mode 100644 index 28ea7b7..0000000 --- a/powertop-1.13.tar.bz2 +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:60845cbdf7b7267a78d619f770578d3fa2fe30911d3d5bb5a14f9fbe12f421da -size 90743 diff --git a/powertop-1.98-always-create-params.patch b/powertop-1.98-always-create-params.patch new file mode 100644 index 0000000..b92625b --- /dev/null +++ b/powertop-1.98-always-create-params.patch @@ -0,0 +1,36 @@ +diff -up powertop-1.98/parameters/persistent.cpp.orig powertop-1.98/parameters/persistent.cpp +--- powertop-1.98/parameters/persistent.cpp.orig 2011-05-11 06:48:37.000000000 +0200 ++++ powertop-1.98/parameters/persistent.cpp 2011-12-02 19:48:45.056747667 +0100 +@@ -122,22 +122,23 @@ void save_parameters(const char *filenam + + // printf("result size is %i, #parameters is %i \n", (int)past_results.size(), (int)all_parameters.parameters.size()); + +- if (!global_power_valid()) +- return; + + file.open(filename, ios::out); + if (!file) { + cout << _("Cannot save to file ") << filename << "\n"; + return; + } +- +- map::iterator it; + +- for (it = param_index.begin(); it != param_index.end(); it++) { +- int index; +- index = it->second; +- file << it->first << "\t" << setprecision(9) << all_parameters.parameters[index] << "\n"; +- } ++ if (global_power_valid()) ++ { ++ map::iterator it; ++ ++ for (it = param_index.begin(); it != param_index.end(); it++) { ++ int index; ++ index = it->second; ++ file << it->first << "\t" << setprecision(9) << all_parameters.parameters[index] << "\n"; ++ } ++ } + file.close(); + } + diff --git a/powertop-1.98-compile-fix.patch b/powertop-1.98-compile-fix.patch new file mode 100644 index 0000000..c75d678 --- /dev/null +++ b/powertop-1.98-compile-fix.patch @@ -0,0 +1,110 @@ +diff -up powertop-1.98/devices/alsa.cpp.orig powertop-1.98/devices/alsa.cpp +--- powertop-1.98/devices/alsa.cpp.orig 2011-05-11 06:48:37.000000000 +0200 ++++ powertop-1.98/devices/alsa.cpp 2012-01-11 16:19:53.365786704 +0100 +@@ -28,6 +28,7 @@ + #include + #include + #include ++#include + + + using namespace std; +diff -up powertop-1.98/devices/device.cpp.orig powertop-1.98/devices/device.cpp +--- powertop-1.98/devices/device.cpp.orig 2011-05-11 06:48:37.000000000 +0200 ++++ powertop-1.98/devices/device.cpp 2012-01-11 16:13:38.284981557 +0100 +@@ -29,6 +29,7 @@ + #include + #include + #include ++#include + + using namespace std; + +diff -up powertop-1.98/html.cpp.orig powertop-1.98/html.cpp +--- powertop-1.98/html.cpp.orig 2011-05-11 06:48:37.000000000 +0200 ++++ powertop-1.98/html.cpp 2012-01-11 16:06:58.714989836 +0100 +@@ -29,6 +29,7 @@ + #include + #include + #include ++#include + + #include "css.h" + #include "lib.h" +diff -up powertop-1.98/devices/i915-gpu.cpp.orig powertop-1.98/devices/i915-gpu.cpp +--- powertop-1.98/devices/i915-gpu.cpp.orig 2011-05-11 06:48:37.000000000 +0200 ++++ powertop-1.98/devices/i915-gpu.cpp 2012-01-11 16:21:46.958008197 +0100 +@@ -28,6 +28,7 @@ + #include + #include + #include ++#include + + + using namespace std; +diff -up powertop-1.98/cpu/intel_cpus.cpp.orig powertop-1.98/cpu/intel_cpus.cpp +--- powertop-1.98/cpu/intel_cpus.cpp.orig 2011-05-11 06:48:37.000000000 +0200 ++++ powertop-1.98/cpu/intel_cpus.cpp 2012-01-11 16:11:55.784740852 +0100 +@@ -34,6 +34,7 @@ + #include + #include + #include ++#include + + #include "../lib.h" + #include "../parameters/parameters.h" +diff -up powertop-1.98/main.cpp.orig powertop-1.98/main.cpp +--- powertop-1.98/main.cpp.orig 2011-05-11 06:48:37.000000000 +0200 ++++ powertop-1.98/main.cpp 2012-01-11 16:00:06.445806979 +0100 +@@ -33,6 +33,7 @@ + #include + #include + #include ++#include + + #include "cpu/cpu.h" + #include "process/process.h" +diff -up powertop-1.98/devices/network.cpp.orig powertop-1.98/devices/network.cpp +--- powertop-1.98/devices/network.cpp.orig 2011-05-11 06:48:37.000000000 +0200 ++++ powertop-1.98/devices/network.cpp 2012-01-11 16:23:18.176178890 +0100 +@@ -33,6 +33,7 @@ + #include + #include + #include ++#include + + #include + +diff -up powertop-1.98/devices/rfkill.cpp.orig powertop-1.98/devices/rfkill.cpp +--- powertop-1.98/devices/rfkill.cpp.orig 2011-05-11 06:48:37.000000000 +0200 ++++ powertop-1.98/devices/rfkill.cpp 2012-01-11 16:15:46.003268813 +0100 +@@ -29,6 +29,7 @@ + #include + #include + #include ++#include + + + using namespace std; +diff -up powertop-1.98/devices/thinkpad-fan.cpp.orig powertop-1.98/devices/thinkpad-fan.cpp +--- powertop-1.98/devices/thinkpad-fan.cpp.orig 2011-05-11 06:48:37.000000000 +0200 ++++ powertop-1.98/devices/thinkpad-fan.cpp 2012-01-11 16:25:27.550410318 +0100 +@@ -29,6 +29,7 @@ + #include + #include + #include ++#include + + #include "../lib.h" + +diff -up powertop-1.98/devices/thinkpad-light.cpp.orig powertop-1.98/devices/thinkpad-light.cpp +--- powertop-1.98/devices/thinkpad-light.cpp.orig 2012-01-11 16:27:38.000000000 +0100 ++++ powertop-1.98/devices/thinkpad-light.cpp 2012-01-11 16:27:50.995652724 +0100 +@@ -29,6 +29,7 @@ + #include + #include + #include ++#include + + #include "../lib.h" + diff --git a/powertop-1.98-unknown-readings-fix.patch b/powertop-1.98-unknown-readings-fix.patch new file mode 100644 index 0000000..70fe273 --- /dev/null +++ b/powertop-1.98-unknown-readings-fix.patch @@ -0,0 +1,35 @@ +diff -up powertop-1.98/measurement/acpi.cpp.orig powertop-1.98/measurement/acpi.cpp +--- powertop-1.98/measurement/acpi.cpp.orig 2011-05-11 06:48:37.000000000 +0200 ++++ powertop-1.98/measurement/acpi.cpp 2012-01-10 18:31:21.093799991 +0100 +@@ -108,8 +108,13 @@ void acpi_power_meter::measure(void) + while (*c == ' ') c++; + _capacity = strtoull(c, NULL, 10); + c = strchr(c, ' '); +- c++; +- strcpy(capacity_units, c); ++ if (c) { ++ c++; ++ strcpy(capacity_units, c); ++ } else { ++ _capacity = 0; ++ strcpy(capacity_units, "Unknown"); ++ } + } + if (strstr(line, "present voltage:")) { + c = strchr(line, ':'); +@@ -117,8 +122,13 @@ void acpi_power_meter::measure(void) + while (*c == ' ') c++; + _voltage = strtoull(c, NULL, 10); + c = strchr(c, ' '); +- c++; +- strcpy(voltage_units, c); ++ if (c) { ++ c++; ++ strcpy(voltage_units, c); ++ } else { ++ _voltage = 0; ++ strcpy(voltage_units, "Unknown"); ++ } + } + } + file.close(); diff --git a/powertop-1.98.tar.bz2 b/powertop-1.98.tar.bz2 new file mode 100644 index 0000000..faf0817 --- /dev/null +++ b/powertop-1.98.tar.bz2 @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:078b2d05a467ae83a6ee567d11ed7f80b917a3e2ad9d9de0e4b9facd857353f4 +size 88110 diff --git a/powertop-no-date.patch b/powertop-no-date.patch new file mode 100644 index 0000000..18006a4 --- /dev/null +++ b/powertop-no-date.patch @@ -0,0 +1,13 @@ +Index: powertop-1.98/main.cpp +=================================================================== +--- powertop-1.98.orig/main.cpp ++++ powertop-1.98/main.cpp +@@ -71,7 +71,7 @@ static const struct option long_options[ + + static void print_version() + { +- printf(_("Powertop version" POWERTOP_VERSION ", compiled on "__DATE__ "\n")); ++ printf(_("Powertop version" POWERTOP_VERSION "\n")); + } + + static void print_usage() diff --git a/powertop.changes b/powertop.changes index 7966e1d..63cc8d7 100644 --- a/powertop.changes +++ b/powertop.changes @@ -1,3 +1,9 @@ +------------------------------------------------------------------- +Thu Feb 2 09:11:29 UTC 2012 - aj@suse.de + +- Update to version 1.98: + * Major rewrite using perf interface with many new options + ------------------------------------------------------------------- Tue Aug 24 17:14:01 UTC 2010 - trenn@novell.com diff --git a/powertop.spec b/powertop.spec index 8d06cd4..62b6ac9 100644 --- a/powertop.spec +++ b/powertop.spec @@ -1,7 +1,7 @@ # -# spec file for package powertop (Version 1.13) +# spec file for package powertop # -# Copyright (c) 2010 SUSE LINUX Products GmbH, Nuernberg, Germany. +# Copyright (c) 2012 SUSE LINUX Products GmbH, Nuernberg, Germany. # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed @@ -18,16 +18,25 @@ Name: powertop -Url: http://www.linuxpowertop.org +Url: http://www.lesswatts.org Summary: A Linux Tool to Find out What is Using Power on a Laptop -Version: 1.13 +Version: 1.98 Release: 1 License: GPL-2.0+ Group: System/Monitoring Source0: %{name}-%{version}.tar.bz2 -Patch0: powertop_fix_sizof_link.patch Patch1: powertop_set_cflags_override.patch +Patch2: powertop-1.98-always-create-params.patch +Patch3: powertop-1.98-unknown-readings-fix.patch +Patch4: powertop-1.98-compile-fix.patch +Patch5: powertop-no-date.patch +BuildRequires: gcc-c++ BuildRequires: ncurses-devel +BuildRequires: pkg-config +BuildRequires: libnl-1_1-devel +BuildRequires: zlib-devel +BuildRequires: pciutils-devel +BuildRequires: gettext BuildRoot: %{_tmppath}/%{name}-%{version}-build AutoReqProv: on @@ -36,31 +45,39 @@ PowerTOP is a program that collects the various pieces of information from your system and presents an overview of how well your laptop is doing in terms of power savings. - -Authors: --------- - Arjan van de Ven - %prep -%setup -%patch0 -p1 +%setup -q %patch1 -p1 +%patch2 -p1 +%patch3 -p1 +%patch4 -p1 +%patch5 -p1 %build -make CFLAGS="$RPM_OPT_FLAGS" +make CFLAGS="$RPM_OPT_FLAGS" CXXFLAGS="$RPM_OPT_FLAGS" %install mkdir -p %{buildroot}/%{_bindir} make install DESTDIR=%{buildroot} -%find_lang %{name} +install -Dd %{buildroot}%{_localstatedir}/cache/powertop +touch %{buildroot}%{_localstatedir}/cache/powertop/{saved_parameters.powertop,saved_results.powertop} +#%find_lang %{name} + +%post +# Hack for powertop not to show warnings on first start +touch %{_localstatedir}/cache/powertop/{saved_parameters.powertop,saved_results.powertop} %clean rm -rf %{_buildroot} -%files -f %{name}.lang +#%files -f %{name}.lang + +%files %defattr(-,root,root) -%doc COPYING +%doc COPYING README +%dir %{_localstatedir}/cache/powertop +%ghost %{_localstatedir}/cache/powertop/saved_parameters.powertop +%ghost %{_localstatedir}/cache/powertop/saved_results.powertop %{_bindir}/%{name} -%{_mandir}/man*/%{name}.8.gz %changelog diff --git a/powertop_fix_sizof_link.patch b/powertop_fix_sizof_link.patch deleted file mode 100644 index b9760bf..0000000 --- a/powertop_fix_sizof_link.patch +++ /dev/null @@ -1,22 +0,0 @@ -commit 24a9f62c5b7f79500cd468876fa5323e689179a2 -Author: Luca Tettamanti -Date: Fri Aug 6 09:56:15 2010 -0700 - - readlink is failing because sizeof(link) returns the size of 'link' - which is a function, not the intended char buffer. Fix the typo. - - Signed-off-by: Luca Tettamanti - -diff --git a/usb.c b/usb.c -index f3a1bef..44d3252 100644 ---- a/usb.c -+++ b/usb.c -@@ -52,7 +52,7 @@ void activate_usb_autosuspend(void) - /* skip usb input devices */ - sprintf(filename, "/sys/bus/usb/devices/%s/driver", dirent->d_name); - memset(linkto, 0, sizeof(linkto)); -- len = readlink(filename, linkto, sizeof(link) - 1); -+ len = readlink(filename, linkto, sizeof(linkto) - 1); - if (strstr(linkto, "usbhid")) - continue; - diff --git a/powertop_set_cflags_override.patch b/powertop_set_cflags_override.patch index 44ed0ca..5fb9fc9 100644 --- a/powertop_set_cflags_override.patch +++ b/powertop_set_cflags_override.patch @@ -1,17 +1,25 @@ ---- - Makefile | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -Index: powertop-1.13/Makefile +Index: powertop-1.98/Makefile =================================================================== ---- powertop-1.13.orig/Makefile -+++ powertop-1.13/Makefile -@@ -7,7 +7,7 @@ WARNFLAGS=-Wall -Wshadow -W -Wformat -Wi - CFLAGS?=-O1 -g ${WARNFLAGS} - CC?=gcc +--- powertop-1.98.orig/Makefile ++++ powertop-1.98/Makefile +@@ -2,9 +2,9 @@ all: powertop po/powertop.pot --CFLAGS+=-D VERSION=\"$(VERSION)\" -+override CFLAGS+=-D VERSION=\"$(VERSION)\" + VERSION := 1.98 - # - # The w in -lncursesw is not a typo; it is the wide-character version +-CFLAGS += -Wall -O2 -g -fno-omit-frame-pointer -fstack-protector -Wshadow -Wformat -D_FORTIFY_SOURCE=2 ++override CFLAGS += -Wall -O2 -g -fno-omit-frame-pointer -fstack-protector -Wshadow -Wformat -D_FORTIFY_SOURCE=2 + CPPFLAGS += -Wall -O2 -g -fno-omit-frame-pointer +-CXXFLAGS += -Wall -O2 -g -fno-omit-frame-pointer -fstack-protector -Wshadow -Wformat -D_FORTIFY_SOURCE=2 ++override CXXFLAGS += -Wall -O2 -g -fno-omit-frame-pointer -fstack-protector -Wshadow -Wformat -D_FORTIFY_SOURCE=2 + PKG_CONFIG ?= pkg-config + + OBJS := lib.o main.o display.o html.o devlist.o +@@ -90,7 +90,7 @@ css.h: csstoh powertop.css + %.o: %.cpp lib.h css.h Makefile + @echo " CC $<" + @[ -x /usr/bin/cppcheck ] && /usr/bin/cppcheck -q $< || : +- @$(CC) $(CFLAGS) -c -o $@ $< ++ $(CC) $(CFLAGS) -c -o $@ $< + + + uptrans: