powertop: update to 2.14

Upstream switched to github.

Fix license information.

Backport patch for ncurses 6.3. Remove other backported patches.

Signed-off-by: Rosen Penev <rosenp@gmail.com>
This commit is contained in:
Rosen Penev 2022-03-20 21:21:52 -07:00
parent 2819935d99
commit 32241d76d8
5 changed files with 57 additions and 89 deletions

View File

@ -8,19 +8,22 @@
include $(TOPDIR)/rules.mk
PKG_NAME:=powertop
PKG_VERSION:=2.10
PKG_RELEASE:=5
PKG_VERSION:=2.14
PKG_RELEASE:=$(AUTORELEASE)
PKG_SOURCE:=$(PKG_NAME)-v$(PKG_VERSION).tar.gz
PKG_SOURCE_URL:=https://01.org/sites/default/files/downloads/
PKG_HASH:=d3b7459eaba7d01c8841dd33a3b4d369416c01e9bd8951b0d88234cf18fe4a75
PKG_SOURCE_PROTO:=git
PKG_SOURCE_VERSION:=v$(PKG_VERSION)
PKG_SOURCE_URL:=https://github.com/fenrus75/powertop
PKG_MIRROR_HASH:=9b49054a7e9684781287eb25c50003f68669e7dcad1c234573bd6a5e26474da7
PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-v$(PKG_VERSION)
PKG_MAINTAINER:=Lucian Cristain <lucian.cristian@gmail.com>
PKG_LICENSE:=GPL-2.0
PKG_LICENSE:=GPL-2.0-only
PKG_LICENSE_FILES:=COPYING
PKG_BUILD_PARALLEL:=1
PKG_FIXUP:=autoreconf
PKG_INSTALL:=1
PKG_BUILD_PARALLEL:=1
PKG_BUILD_DEPENDS:=gettext-full/host
include $(INCLUDE_DIR)/package.mk
include $(INCLUDE_DIR)/nls.mk
@ -39,9 +42,7 @@ define Package/powertop/description
endef
TARGET_LDFLAGS += \
$(if $(INTL_FULL),-lintl) \
$(if $(CONFIG_USE_GLIBC),-lm) \
$(if $(CONFIG_USE_GLIBC),-lpthread)
$(if $(INTL_FULL),-lintl)
define Package/powertop/install
$(INSTALL_DIR) $(1)/usr/sbin

View File

@ -1,20 +0,0 @@
--- a/traceevent/event-parse.c
+++ b/traceevent/event-parse.c
@@ -5121,12 +5121,17 @@ int pevent_strerror(struct pevent *peven
const char *msg;
if (errnum >= 0) {
+#if defined(__GLIBC__)
msg = strerror_r(errnum, buf, buflen);
if (msg != buf) {
size_t len = strlen(msg);
memcpy(buf, msg, min(buflen - 1, len));
*(buf + min(buflen - 1, len)) = '\0';
}
+#else
+ if (strerror_r(errnum, buf, buflen))
+ snprintf(buf, buflen, "errnum %i", errnum);
+#endif
return 0;
}

View File

@ -0,0 +1,45 @@
From 9ef1559a1582f23d599c149601c3a8e06809296c Mon Sep 17 00:00:00 2001
From: Alexander Kanavin <alex@linutronix.de>
Date: Mon, 25 Oct 2021 17:47:23 +0200
Subject: [PATCH] src: fix compatibility with ncurses 6.3
Signed-off-by: Alexander Kanavin <alex@linutronix.de>
---
src/devices/devfreq.cpp | 2 +-
src/display.cpp | 2 +-
src/lib.cpp | 2 +-
3 files changed, 3 insertions(+), 3 deletions(-)
--- a/src/devices/devfreq.cpp
+++ b/src/devices/devfreq.cpp
@@ -297,7 +297,7 @@ void display_devfreq_devices(void)
df->fill_freq_utilization(j, buf);
strcat(fline, buf);
strcat(fline, "\n");
- wprintw(win, fline);
+ wprintw(win, "%s", fline);
}
wprintw(win, "\n");
}
--- a/src/display.cpp
+++ b/src/display.cpp
@@ -125,7 +125,7 @@ void show_tab(unsigned int tab)
c = bottom_lines[tab_names[tab]].c_str();
if (c && strlen(c) > 0)
- mvwprintw(bottom_line, 0,0, c);
+ mvwprintw(bottom_line, 0,0, "%s", c);
else
mvwprintw(bottom_line, 0, 0,
"<ESC> %s | <TAB> / <Shift + TAB> %s | ", _("Exit"),
--- a/src/lib.cpp
+++ b/src/lib.cpp
@@ -583,7 +583,7 @@ void ui_notify_user_ncurses(const char *
* buffer */
vsnprintf(notify, UI_NOTIFY_BUFF_SZ - 1, frmt, list);
va_end(list);
- mvprintw(1, 0, notify);
+ mvprintw(1, 0, "%s", notify);
attroff(COLOR_PAIR(1));
}

View File

@ -1,33 +0,0 @@
From 7235a786ea30ae5ca7c1b3458ef5b2388c08dfd9 Mon Sep 17 00:00:00 2001
From: Rosen Penev <rosenp@gmail.com>
Date: Thu, 28 Mar 2019 18:44:27 -0700
Subject: [PATCH] src/main: Add missing pthread header
Otherwise compilation can fail with:
main.cpp: In function 'void one_measurement(int, int, char*)':
main.cpp:226:3: error: 'pthread_t' was not declared in this scope
pthread_t thread = 0UL;
^~~~~~~~~
main.cpp:226:3: note: suggested alternative: 'pread'
pthread_t thread = 0UL;
^~~~~~~~~
pread
et al.
Signed-off-by: Rosen Penev <rosenp@gmail.com>
---
src/main.cpp | 1 +
1 file changed, 1 insertion(+)
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -39,6 +39,7 @@
#include <locale.h>
#include <sys/resource.h>
#include <limits.h>
+#include <pthread.h>
#include "cpu/cpu.h"
#include "process/process.h"

View File

@ -1,25 +0,0 @@
From 8cdf846922ffb3e0d2a828be473fdf9c45a56e7c Mon Sep 17 00:00:00 2001
From: Rosen Penev <rosenp@gmail.com>
Date: Sat, 30 Mar 2019 20:19:17 -0700
Subject: [PATCH] intel_cpus.cpp: Change open parameter to const char *
ifstream::open takes std::string starting with C++11, not before.
This fixes compilation with uClibc++ and potentially other older libraries
Signed-off-by: Rosen Penev <rosenp@gmail.com>
---
src/cpu/intel_cpus.cpp | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
--- a/src/cpu/intel_cpus.cpp
+++ b/src/cpu/intel_cpus.cpp
@@ -92,7 +92,7 @@ int is_supported_intel_cpu(int model, in
int is_intel_pstate_driver_loaded()
{
- const string filename("/sys/devices/system/cpu/cpu0/cpufreq/scaling_driver");
+ const char *filename = "/sys/devices/system/cpu/cpu0/cpufreq/scaling_driver";
const string intel_pstate("intel_pstate");
char line[32] = { '\0' };
ifstream file;