Accepting request 120888 from Base:System

- Update to new upstream release 2.0:
* Interactive mode: redesigned, tab-based user interface with full
  on-demand window refresh support.
* Reporting mode: PowerTOP v2.0 now allows you to specify not only
  the duration of each test measurement cycle, but the number of
  iterations to measure. PowerTOP can now produce HTML and CSV.
* Increased WLAN support: PowerTOP now supports multiple
  WLAN interfaces
* Enhanced i915 driver support
* More robust battery data acquisition
* Real time measurement support for USB hot-plug. (forwarded request 120774 from jengelh)

OBS-URL: https://build.opensuse.org/request/show/120888
OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/powertop?expand=0&rev=24
This commit is contained in:
Stephan Kulow 2012-05-16 13:03:51 +00:00 committed by Git OBS Bridge
commit 5ad375a70f
9 changed files with 61 additions and 218 deletions

View File

@ -1,26 +1,31 @@
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 src/parameters/persistent.cpp | 18 +++++++++---------
+++ powertop-1.98/parameters/persistent.cpp 2011-12-02 19:48:45.056747667 +0100 1 file changed, 9 insertions(+), 9 deletions(-)
@@ -122,22 +122,23 @@ void save_parameters(const char *filenam
Index: powertop-2.0/src/parameters/persistent.cpp
===================================================================
--- powertop-2.0.orig/src/parameters/persistent.cpp
+++ powertop-2.0/src/parameters/persistent.cpp
@@ -129,9 +129,6 @@ void save_parameters(const char *filenam
// printf("result size is %i, #parameters is %i \n", (int)past_results.size(), (int)all_parameters.parameters.size()); // printf("result size is %i, #parameters is %i \n", (int)past_results.size(), (int)all_parameters.parameters.size());
- if (!global_power_valid()) - if (!global_power_valid())
- return; - return;
-
pathname = get_param_directory(filename);
file.open(filename, ios::out); file.open(pathname, ios::out);
if (!file) { @@ -140,12 +137,15 @@ void save_parameters(const char *filenam
cout << _("Cannot save to file ") << filename << "\n";
return; return;
} }
-
- map<string, int>::iterator it;
- map<string, int>::iterator it;
-
- for (it = param_index.begin(); it != param_index.end(); it++) { - for (it = param_index.begin(); it != param_index.end(); it++) {
- int index; - int index;
- index = it->second; - index = it->second;
- file << it->first << "\t" << setprecision(9) << all_parameters.parameters[index] << "\n"; - file << it->first << "\t" << setprecision(9) << all_parameters.parameters[index] << "\n";
- }
+ if (global_power_valid()) + if (global_power_valid())
+ { + {
+ map<string, int>::iterator it; + map<string, int>::iterator it;
@ -29,8 +34,7 @@ diff -up powertop-1.98/parameters/persistent.cpp.orig powertop-1.98/parameters/p
+ int index; + int index;
+ index = it->second; + index = it->second;
+ file << it->first << "\t" << setprecision(9) << all_parameters.parameters[index] << "\n"; + file << it->first << "\t" << setprecision(9) << all_parameters.parameters[index] << "\n";
+ } + }
+ } }
file.close(); file.close();
} }

View File

@ -1,110 +0,0 @@
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 <stdio.h>
#include <sys/types.h>
#include <dirent.h>
+#include <unistd.h>
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 <stdio.h>
#include <limits.h>
#include <stdlib.h>
+#include <unistd.h>
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 <utility>
#include <iostream>
#include <fstream>
+#include <unistd.h>
#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 <stdio.h>
#include <sys/types.h>
#include <dirent.h>
+#include <unistd.h>
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 <sys/time.h>
#include <string.h>
#include <errno.h>
+#include <unistd.h>
#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 <time.h>
#include <sys/stat.h>
#include <getopt.h>
+#include <unistd.h>
#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 <dirent.h>
#include <libgen.h>
#include <stdlib.h>
+#include <unistd.h>
#include <linux/ethtool.h>
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 <sys/types.h>
#include <dirent.h>
#include <libgen.h>
+#include <unistd.h>
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 <sys/types.h>
#include <dirent.h>
#include <math.h>
+#include <unistd.h>
#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 <sys/types.h>
#include <dirent.h>
#include <math.h>
+#include <unistd.h>
#include "../lib.h"

View File

@ -1,35 +0,0 @@
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();

View File

@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:078b2d05a467ae83a6ee567d11ed7f80b917a3e2ad9d9de0e4b9facd857353f4
size 88110

3
powertop-2.0.tar.bz2 Normal file
View File

@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:7af51d320856b3446bcc314c9414385f3b05b9360f650883b0210cd3b12c5c1c
size 456654

View File

@ -1,8 +1,12 @@
Index: powertop-1.98/main.cpp ---
src/main.cpp | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
Index: powertop-2.0/src/main.cpp
=================================================================== ===================================================================
--- powertop-1.98.orig/main.cpp --- powertop-2.0.orig/src/main.cpp
+++ powertop-1.98/main.cpp +++ powertop-2.0/src/main.cpp
@@ -71,7 +71,7 @@ static const struct option long_options[ @@ -80,7 +80,7 @@ static const struct option long_options[
static void print_version() static void print_version()
{ {
@ -10,4 +14,4 @@ Index: powertop-1.98/main.cpp
+ printf(_("Powertop version" POWERTOP_VERSION "\n")); + printf(_("Powertop version" POWERTOP_VERSION "\n"));
} }
static void print_usage() static bool set_refresh_timeout()

View File

@ -1,3 +1,18 @@
-------------------------------------------------------------------
Sat May 12 15:22:00 UTC 2012 - jengelh@inai.de
- Update to new upstream release 2.0:
* Interactive mode: redesigned, tab-based user interface with full
on-demand window refresh support.
* Reporting mode: PowerTOP v2.0 now allows you to specify not only
the duration of each test measurement cycle, but the number of
iterations to measure. PowerTOP can now produce HTML and CSV.
* Increased WLAN support: PowerTOP now supports multiple
WLAN interfaces
* Enhanced i915 driver support
* More robust battery data acquisition
* Real time measurement support for USB hot-plug.
------------------------------------------------------------------- -------------------------------------------------------------------
Thu Feb 2 09:11:29 UTC 2012 - aj@suse.de Thu Feb 2 09:11:29 UTC 2012 - aj@suse.de

View File

@ -16,29 +16,27 @@
# #
Name: powertop Name: powertop
Url: http://www.lesswatts.org Url: https://01.org/powertop/
#Git-Clone: git://github.com/fenrus75/powertop
Summary: A Linux Tool to Find out What is Using Power on a Laptop Summary: A Linux Tool to Find out What is Using Power on a Laptop
Version: 1.98
Release: 1
License: GPL-2.0+ License: GPL-2.0+
Group: System/Monitoring Group: System/Monitoring
Source0: %{name}-%{version}.tar.bz2 Version: 2.0
Patch1: powertop_set_cflags_override.patch Release: 0
Source: https://01.org/powertop/sites/default/files/downloads/%name-%version.tar.bz2
Patch2: powertop-1.98-always-create-params.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 Patch5: powertop-no-date.patch
BuildRequires: gcc-c++ BuildRequires: gcc-c++
BuildRequires: gettext
BuildRequires: ncurses-devel BuildRequires: ncurses-devel
BuildRequires: pkg-config BuildRequires: pkg-config
BuildRequires: libnl-1_1-devel BuildRequires: pkgconfig
BuildRequires: zlib-devel BuildRequires: pkgconfig(libnl-3.0)
BuildRequires: pciutils-devel BuildRequires: pkgconfig(libnl-genl-3.0)
BuildRequires: gettext BuildRequires: pkgconfig(libpci)
BuildRequires: pkgconfig(zlib)
BuildRoot: %{_tmppath}/%{name}-%{version}-build BuildRoot: %{_tmppath}/%{name}-%{version}-build
AutoReqProv: on
%description %description
PowerTOP is a program that collects the various pieces of information PowerTOP is a program that collects the various pieces of information
@ -47,37 +45,29 @@ doing in terms of power savings.
%prep %prep
%setup -q %setup -q
%patch1 -p1
%patch2 -p1 %patch2 -p1
%patch3 -p1
%patch4 -p1
%patch5 -p1 %patch5 -p1
%build %build
make CFLAGS="$RPM_OPT_FLAGS" CXXFLAGS="$RPM_OPT_FLAGS" %configure
make %{?_smp_mflags}
%install %install
mkdir -p %{buildroot}/%{_bindir} make install DESTDIR="%buildroot"
make install DESTDIR=%{buildroot}
install -Dd %{buildroot}%{_localstatedir}/cache/powertop install -Dd %{buildroot}%{_localstatedir}/cache/powertop
touch %{buildroot}%{_localstatedir}/cache/powertop/{saved_parameters.powertop,saved_results.powertop} touch %{buildroot}%{_localstatedir}/cache/powertop/{saved_parameters.powertop,saved_results.powertop}
#%find_lang %{name} %find_lang %{name}
%post %post
# Hack for powertop not to show warnings on first start # Hack for powertop not to show warnings on first start
touch %{_localstatedir}/cache/powertop/{saved_parameters.powertop,saved_results.powertop} touch %{_localstatedir}/cache/powertop/{saved_parameters.powertop,saved_results.powertop}
%clean %files -f %name.lang
rm -rf %{_buildroot}
#%files -f %{name}.lang
%files
%defattr(-,root,root) %defattr(-,root,root)
%doc COPYING README %doc COPYING README
%dir %{_localstatedir}/cache/powertop %dir %{_localstatedir}/cache/powertop
%ghost %{_localstatedir}/cache/powertop/saved_parameters.powertop %ghost %{_localstatedir}/cache/powertop/saved_parameters.powertop
%ghost %{_localstatedir}/cache/powertop/saved_results.powertop %ghost %{_localstatedir}/cache/powertop/saved_results.powertop
%{_bindir}/%{name} %_sbindir/%name
%changelog %changelog

View File

@ -1,25 +0,0 @@
Index: powertop-1.98/Makefile
===================================================================
--- powertop-1.98.orig/Makefile
+++ powertop-1.98/Makefile
@@ -2,9 +2,9 @@ all: powertop po/powertop.pot
VERSION := 1.98
-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: