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
This commit is contained in:
Stephan Kulow 2012-02-06 14:55:14 +00:00 committed by Git OBS Bridge
parent f65512fc66
commit 6f86f68387
10 changed files with 259 additions and 56 deletions

View File

@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:60845cbdf7b7267a78d619f770578d3fa2fe30911d3d5bb5a14f9fbe12f421da
size 90743

View File

@ -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<string, int>::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<string, int>::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();
}

View File

@ -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 <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

@ -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();

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

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

13
powertop-no-date.patch Normal file
View File

@ -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()

View File

@ -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 Tue Aug 24 17:14:01 UTC 2010 - trenn@novell.com

View File

@ -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 # All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed # remain the property of their copyright owners, unless otherwise agreed
@ -18,16 +18,25 @@
Name: powertop 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 Summary: A Linux Tool to Find out What is Using Power on a Laptop
Version: 1.13 Version: 1.98
Release: 1 Release: 1
License: GPL-2.0+ License: GPL-2.0+
Group: System/Monitoring Group: System/Monitoring
Source0: %{name}-%{version}.tar.bz2 Source0: %{name}-%{version}.tar.bz2
Patch0: powertop_fix_sizof_link.patch
Patch1: powertop_set_cflags_override.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: ncurses-devel
BuildRequires: pkg-config
BuildRequires: libnl-1_1-devel
BuildRequires: zlib-devel
BuildRequires: pciutils-devel
BuildRequires: gettext
BuildRoot: %{_tmppath}/%{name}-%{version}-build BuildRoot: %{_tmppath}/%{name}-%{version}-build
AutoReqProv: on 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 from your system and presents an overview of how well your laptop is
doing in terms of power savings. doing in terms of power savings.
Authors:
--------
Arjan van de Ven <arjan@linux.intel.com>
%prep %prep
%setup %setup -q
%patch0 -p1
%patch1 -p1 %patch1 -p1
%patch2 -p1
%patch3 -p1
%patch4 -p1
%patch5 -p1
%build %build
make CFLAGS="$RPM_OPT_FLAGS" make CFLAGS="$RPM_OPT_FLAGS" CXXFLAGS="$RPM_OPT_FLAGS"
%install %install
mkdir -p %{buildroot}/%{_bindir} mkdir -p %{buildroot}/%{_bindir}
make install DESTDIR=%{buildroot} 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 %clean
rm -rf %{_buildroot} rm -rf %{_buildroot}
%files -f %{name}.lang #%files -f %{name}.lang
%files
%defattr(-,root,root) %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} %{_bindir}/%{name}
%{_mandir}/man*/%{name}.8.gz
%changelog %changelog

View File

@ -1,22 +0,0 @@
commit 24a9f62c5b7f79500cd468876fa5323e689179a2
Author: Luca Tettamanti <kronos.it@gmail.com>
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 <kronos.it@gmail.com>
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;

View File

@ -1,17 +1,25 @@
--- Index: powertop-1.98/Makefile
Makefile | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
Index: powertop-1.13/Makefile
=================================================================== ===================================================================
--- powertop-1.13.orig/Makefile --- powertop-1.98.orig/Makefile
+++ powertop-1.13/Makefile +++ powertop-1.98/Makefile
@@ -7,7 +7,7 @@ WARNFLAGS=-Wall -Wshadow -W -Wformat -Wi @@ -2,9 +2,9 @@ all: powertop po/powertop.pot
CFLAGS?=-O1 -g ${WARNFLAGS}
CC?=gcc
-CFLAGS+=-D VERSION=\"$(VERSION)\" VERSION := 1.98
+override CFLAGS+=-D VERSION=\"$(VERSION)\"
# -CFLAGS += -Wall -O2 -g -fno-omit-frame-pointer -fstack-protector -Wshadow -Wformat -D_FORTIFY_SOURCE=2
# The w in -lncursesw is not a typo; it is the wide-character version +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: