!16 [sync] PR-15: fix build with latest gettext

From: @openeuler-sync-bot 
Reviewed-by: @dillon_chen 
Signed-off-by: @dillon_chen
This commit is contained in:
openeuler-ci-bot 2025-01-08 09:22:01 +00:00 committed by Gitee
commit 1ec12a6a0a
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
6 changed files with 125 additions and 11 deletions

View File

@ -0,0 +1,38 @@
From c339df50d858041255bb759fe8a6a54ce369409b Mon Sep 17 00:00:00 2001
From: Zentaro Kavanagh <zentaro@chromium.org>
Date: Thu, 14 Jun 2018 13:13:37 -0700
Subject: [PATCH] Fix configure to support ncurses w/ tinfo
- The existing code checked for both ncursesw and ncurses and if
both were not found, NCURSES_LIBS was not set correctly.
- Removed redundant concatenation to $LIBS since the makefile.am
already maps NCURSES_LIBS into LIBS.
- Patch sent upstream to powertop mailing list [1]
[1] - https://lists.01.org/pipermail/powertop/2018-June/002021.html
---
configure.ac | 11 +++++++----
1 file changed, 7 insertions(+), 4 deletions(-)
diff --git a/configure.ac b/configure.ac
index a69cf619..c698818b 100644
--- a/configure.ac
+++ b/configure.ac
@@ -116,10 +116,13 @@ AC_CHECK_FUNCS([ \
AC_SEARCH_LIBS([clock_gettime], [rt])
-PKG_CHECK_MODULES([NCURSES], [ncursesw ncurses], [LIBS="$LIBS $ncurses_LIBS"], [
- AC_SEARCH_LIBS([delwin], [ncursesw ncurses], [], [
- AC_MSG_ERROR([ncurses is required but was not found])
- ], [])
+PKG_CHECK_MODULES([ncursesw], [ncursesw],
+ [NCURSES_CFLAGS="$ncursesw_CFLAGS"; NCURSES_LIBS="$ncursesw_LIBS"], [
+ PKG_CHECK_MODULES([NCURSES], [ncurses], [], [
+ AC_SEARCH_LIBS([delwin], [ncursesw ncurses], [], [
+ AC_MSG_ERROR([ncurses is required but was not found])
+ ])
+ ])
])
has_libpci=0

View File

@ -0,0 +1,38 @@
From 184b2f4dd43dfbec64654ba9dce6aa6645717ca1 Mon Sep 17 00:00:00 2001
From: Renat Sabitov <r.sabitov@gmail.com>
Date: Thu, 2 Nov 2023 22:03:05 +1000
Subject: [PATCH] Fixed RISCV T-Head 1520 CPU identification
---
src/cpu/cpu.cpp | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/src/cpu/cpu.cpp b/src/cpu/cpu.cpp
index eb1578d9..ca1e3a74 100644
--- a/src/cpu/cpu.cpp
+++ b/src/cpu/cpu.cpp
@@ -174,6 +174,8 @@ static void handle_one_cpu(unsigned int number, char *vendor, int family, int mo
file.open(filename, ios::in);
if (file) {
file >> core_number;
+ if (core_number == (unsigned int) -1)
+ core_number = number;
file.close();
}
@@ -300,11 +302,13 @@ void enumerate_cpus(void)
}
/* on x86 and others 'bogomips' is last
* on ARM it *can* be bogomips, or 'CPU revision'
- * on POWER, it's revision
+ * on POWER, it's 'revision'
+ * on RISCV64 it's 'isa'
*/
if (strncasecmp(line, "bogomips\t", 9) == 0
|| strncasecmp(line, "CPU revision\t", 13) == 0
- || strncmp(line, "revision", 8) == 0) {
+ || strncmp(line, "revision", 8) == 0
+ || strncmp(line, "isa\t", 4) == 0) {
if (number == -1) {
/* Not all /proc/cpuinfo include "processor\t". */
number = 0;

View File

@ -0,0 +1,15 @@
--- powertop-2.15/configure.ac.orig 2025-01-07 00:36:37.491841200 +0800
+++ powertop-2.15/configure.ac 2025-01-07 00:37:15.629889400 +0800
@@ -26,7 +26,11 @@
AC_SUBST([GETTEXT_PACKAGE])
AM_SILENT_RULES([yes])
AM_GNU_GETTEXT([external])
-AM_GNU_GETTEXT_VERSION([0.18.2])
+dnl Support for _REQUIRE_VERSION was added in gettext 0.19.6. If both
+dnl _REQUIRE_VERSION and _VERSION are present, the _VERSION is ignored.
+dnl We use both for compatibility with other programs in the Autotools family.
+AM_GNU_GETTEXT_REQUIRE_VERSION([0.19.6])
+AM_GNU_GETTEXT_VERSION([0.19.6])
m4_ifdef([AM_PROG_AR], [AM_PROG_AR])
AX_REQUIRE_DEFINED([AX_ADD_FORTIFY_SOURCE])

View File

@ -2,6 +2,18 @@
Description=PowerTOP autotuner Description=PowerTOP autotuner
[Service] [Service]
# added automatically, for details please see
# https://en.opensuse.org/openSUSE:Security_Features#Systemd_hardening_effort
ProtectSystem=full
ProtectHome=true
PrivateDevices=true
ProtectHostname=true
ProtectClock=true
ProtectKernelModules=true
ProtectKernelLogs=true
ProtectControlGroups=true
RestrictRealtime=true
# end of automatic additions
Type=oneshot Type=oneshot
ExecStart=/usr/sbin/powertop --auto-tune ExecStart=/usr/sbin/powertop --auto-tune

View File

@ -1,17 +1,26 @@
Name: powertop Name: powertop
Version: 2.15 Version: 2.15
Release: 1 Release: 2
Summary: Power consumption tool for Linux Summary: Power consumption tool for Linux
License: GPLv2 License: GPL-2.0-only AND LGPL-2.1-only AND ISC
URL: http://01.org/powertop/ URL: https://github.com/fenrus75/powertop
Source0: http://github.com/fenrus75/%{name}/archive/v%{version}/%{name}-%{version}.tar.gz Source0: https://github.com/fenrus75/%{name}/archive/v%{version}/%{name}-%{version}.tar.gz
Source1: powertop.service Source1: powertop.service
Patch1: backport-powertop-2.7-always-create-params.patch Patch1: backport-powertop-2.7-always-create-params.patch
Patch2: powertop-2.15-gettext-0.19.patch
Patch6001: backport-powertop-2.15-fix-configure-to-support-ncurses-w-tinfo.patch
Patch6002: backport-powertop-2.15-fixed-riscv-t-head-1520-cpu-identification.patch
BuildRequires: autoconf autoconf-archive automake libtool BuildRequires: autoconf autoconf-archive automake libtool
BuildRequires: gcc gcc-c++ systemd BuildRequires: gcc gcc-c++ systemd
BuildRequires: gettext-devel ncurses-devel pciutils-devel zlib-devel libnl3-devel BuildRequires: gettext-devel
BuildRequires: pkgconfig(bash-completion)
BuildRequires: pkgconfig(libnl-3.0) >= 3.0
BuildRequires: pkgconfig(libnl-genl-3.0) >= 3.0
BuildRequires: pkgconfig(libpci)
BuildRequires: pkgconfig(ncursesw)
BuildRequires: pkgconfig(zlib)
Requires(post): coreutils Requires(post): coreutils
%{?systemd_requires} %{?systemd_requires}
Provides: bundled(kernel-event-lib) Provides: bundled(kernel-event-lib)
@ -42,8 +51,6 @@ touch $RPM_BUILD_ROOT%{_localstatedir}/cache/%{name}/{saved_parameters.powertop,
install -Dpm 644 %{SOURCE1} $RPM_BUILD_ROOT%{_unitdir}/powertop.service install -Dpm 644 %{SOURCE1} $RPM_BUILD_ROOT%{_unitdir}/powertop.service
%pre
%preun %preun
%systemd_preun powertop.service %systemd_preun powertop.service
@ -56,8 +63,8 @@ install -Dpm 644 %{SOURCE1} $RPM_BUILD_ROOT%{_unitdir}/powertop.service
touch %{_localstatedir}/cache/powertop/{saved_parameters.powertop,saved_results.powertop} &> /dev/null || : touch %{_localstatedir}/cache/powertop/{saved_parameters.powertop,saved_results.powertop} &> /dev/null || :
%files -f %{name}.lang %files -f %{name}.lang
%defattr(-,root,root) %license COPYING
%doc COPYING README.md README.traceevent CONTRIBUTE.md TODO %doc README.md README.traceevent CONTRIBUTE.md TODO
%{_sbindir}/powertop %{_sbindir}/powertop
%{_unitdir}/powertop.service %{_unitdir}/powertop.service
%dir %{_localstatedir}/cache/powertop %dir %{_localstatedir}/cache/powertop
@ -68,8 +75,12 @@ touch %{_localstatedir}/cache/powertop/{saved_parameters.powertop,saved_results.
%files help %files help
%{_mandir}/man8/powertop.8* %{_mandir}/man8/powertop.8*
%changelog %changelog
* Tue Jan 07 2025 Funda Wang <fundawang@yeah.net> - 2.15-2
- fix build with latest gettext
- harden systemd service file from openSUSE
- add patch regarding risc-v arch support
* Sat May 6 2023 panxiaohe <pan_xiaohe@hoperun.com> - 2.15-1 * Sat May 6 2023 panxiaohe <pan_xiaohe@hoperun.com> - 2.15-1
- update to 2.15 - update to 2.15

View File

@ -1,4 +1,4 @@
version_control: github version_control: github
src_repo: "fenrus75/powertop" src_repo: "fenrus75/powertop"
tag_prefix: "^v" tag_prefix: "^v"
seperator: separator: