Commit bb1c2e77 authored by Milan P. Stanić's avatar Milan P. Stanić Committed by Natanael Copa
Browse files

community/cpupower: remove from aports

community/linux-tools contains same subpkgname where is added
cpupower-openrc subpackage in previous commit
parent b11c32d6
Pipeline #66883 passed with stages
in 3 minutes and 41 seconds
# Contributor: Carlo Landmeter <clandmeter@gmail.com>
# Maintainer: Ben Allen <bensallen@me.com>
pkgname=cpupower
pkgver=5.4.35
pkgrel=0
pkgdesc="Linux kernel tool to examine and tune power saving related features of your processor"
url="https://www.kernel.org/"
arch="all"
license="GPL-2.0-only"
depends_dev="pciutils-dev readline-dev"
makedepends="$depends_dev bash linux-headers gettext-dev"
subpackages="$pkgname-doc $pkgname-dev $pkgname-openrc $pkgname-bash-completion"
replaces="linux-tools-cpupower"
source="https://kernel.org/pub/linux/kernel/v5.x/linux-$pkgver.tar.xz
nls.patch
cpupower.initd
cpupower.confd
"
options="!check" # no tests
builddir="$srcdir"/linux-$pkgver/tools/power/cpupower
build() {
make NLS=false VERSION=$pkgver-$pkgrel
}
package() {
make NLS=false VERSION=$pkgver-$pkgrel DESTDIR="$pkgdir" libdir=/usr/lib mandir=/usr/share/man install
install -Dm755 "$srcdir"/$pkgname.initd \
"$pkgdir"/etc/init.d/$pkgname
install -Dm644 "$srcdir"/$pkgname.confd \
"$pkgdir"/etc/conf.d/$pkgname
}
sha512sums="66daf0192339450b0838cd1aef013ea8675f8687e2271d8d9b79c842e8cb081541788eb16fb0b6e5cd0b15617be67813c53a4db2d2e63219f3c64e692c325c5d linux-5.4.35.tar.xz
3f95439c334a5b1dd173c4ed2e58721d4687177e3b4070b375deaca38062bd88af352838acbff8b2bc8f5e624359ce8dd604091adb940b2232520e60ba65fbf0 nls.patch
97ecfeaaaa8efca7af585316b843bf7be885e88095bbdfbf52bc9a96b14dc862435482781e205ea022ab208978aaa4aabb317354fab890ed514a5088ae5045c8 cpupower.initd
63cd12a4d8782198c71662e9205e346e064b65bae5e3e175b5bc43bdf7ec6ddf675b60349750afe3c37c8a925f9ae9a93530671821342581bd282a69e0773b8c cpupower.confd"
# /etc/conf.d/cpupower: config file for /etc/init.d/cpupower
# Options when starting cpufreq (given to the `cpupower` program)
# Possible options are:
# -g --governor <GOV> (ie: ondemand, performance, or powersave)
# -d --min <FREQ> (ie: 1000MHz)
# -u --max <FREQ> (ie: 2000MHz)
# -f --freq <FREQ> (requires userspace governor, this *can not* be combined with
# with any other parameters).
# Frequencies can be passed in Hz, kHz (default), MHz, GHz, or THz by postfixing the
# value with the wanted unit name, without any space.
# (frequency in kHz =^ Hz * 0.001 =^ MHz * 1000 =^ GHz * 1000000).
START_OPTS="--governor ondemand"
# Options when stopping cpufreq (given to the `cpupower` program)
# This option can be used to change governer on stop. Leaving it empty will ensure
# the governer remains on the one provided above.
STOP_OPTS=""
# Extra settings to write to sysfs cpufreq values.
#
# up_threshold: threshold for stepping up frequency, where the value represents
# the percentage of cpu load.
#
# down_threshold: threshold for stepping down frequency, where the value
# represents the percentage of cpu load.
#
# sampling_down_factor: determines how frequently the governor polls the cpu, a
# value greater than 1 improves performance by reducing the polling when the
# load is high. This tunable has no effect on behavior at lower CPU frequencies.
#
# ignore_nice_load: when set to '1' the processes that are run with a 'nice'
# value will not count in the usage calculation.
#SYSFS_EXTRA="ondemand/ignore_nice_load=1 ondemand/up_threshold=75 ondemand/sampling_down_factor=10"
#!/sbin/openrc-run
# Copyright 1999-2013 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Id$
CPUFREQ_SYSFS=/sys/devices/system/cpu/cpufreq
change() {
local c ret=0 opts="$1"
if [ -n "$opts" ] ; then
ebegin "Running cpupower -c all frequency-set ${opts}"
cpupower -c all frequency-set ${opts} >/dev/null 2>&1
: $(( ret += $? ))
eend ${ret}
if [ -d ${CPUFREQ_SYSFS} ] && [ -n "${SYSFS_EXTRA}" ] ; then
c=1
einfo "Setting extra options: ${SYSFS_EXTRA}"
if cd ${CPUFREQ_SYSFS} ; then
local o v
for o in ${SYSFS_EXTRA} ; do
v=${o#*=}
o=${o%%=*}
echo ${v} > ${o} || break
done
c=0
fi
eend ${c}
: $(( ret += c ))
fi
fi
return ${ret}
}
start() {
change "${START_OPTS}"
}
stop() {
change "${STOP_OPTS}"
}
diff --git a/utils/cpupower-info.c b/utils/cpupower-info.c
index 4c9d342b7..91b43d67c 100644
--- a/utils/cpupower-info.c
+++ b/utils/cpupower-info.c
@@ -39,8 +39,10 @@ int cmd_info(int argc, char **argv)
} params = {};
int ret = 0;
+#ifdef NLS
setlocale(LC_ALL, "");
textdomain(PACKAGE);
+#endif
/* parameter parsing */
while ((ret = getopt_long(argc, argv, "b", set_opts, NULL)) != -1) {
diff --git a/utils/cpupower-set.c b/utils/cpupower-set.c
index 3cd95c6cb..7f8698493 100644
--- a/utils/cpupower-set.c
+++ b/utils/cpupower-set.c
@@ -41,8 +41,10 @@ int cmd_set(int argc, char **argv)
int perf_bias = 0;
int ret = 0;
+#ifdef NLS
setlocale(LC_ALL, "");
textdomain(PACKAGE);
+#endif
params.params = 0;
/* parameter parsing */
diff --git a/utils/cpupower.c b/utils/cpupower.c
index 8e3d08042..0ab891d3a 100644
--- a/utils/cpupower.c
+++ b/utils/cpupower.c
@@ -191,8 +191,10 @@ int main(int argc, const char *argv[])
return EXIT_FAILURE;
}
+#ifdef NLS
setlocale(LC_ALL, "");
textdomain(PACKAGE);
+#endif
/* Turn "perf cmd --help" into "perf help cmd" */
if (argc > 1 && !strcmp(argv[1], "--help")) {
diff --git a/utils/helpers/helpers.h b/utils/helpers/helpers.h
index 357b19bb1..cde3a9f6f 100644
--- a/utils/helpers/helpers.h
+++ b/utils/helpers/helpers.h
@@ -9,7 +9,6 @@
#ifndef __CPUPOWERUTILS_HELPERS__
#define __CPUPOWERUTILS_HELPERS__
-#include <libintl.h>
#include <locale.h>
#include "helpers/bitmask.h"
@@ -18,6 +17,8 @@
/* Internationalization ****************************/
#ifdef NLS
+#include <libintl.h>
+
#define _(String) gettext(String)
#ifndef gettext_noop
#define gettext_noop(String) String
diff --git a/utils/idle_monitor/cpupower-monitor.c b/utils/idle_monitor/cpupower-monitor.c
index 3d54fd433..7026e3367 100644
--- a/utils/idle_monitor/cpupower-monitor.c
+++ b/utils/idle_monitor/cpupower-monitor.c
@@ -273,7 +273,7 @@ void list_monitors(void)
* percent, time (granlarity)
*/
printf("%s\t[%c] -> %s\n", s.name, range_abbr[s.range],
- gettext(s.desc));
+ _(s.desc));
}
}
}
diff --git a/utils/idle_monitor/cpupower-monitor.h b/utils/idle_monitor/cpupower-monitor.h
index eafef38f1..f3e44f063 100644
--- a/utils/idle_monitor/cpupower-monitor.h
+++ b/utils/idle_monitor/cpupower-monitor.h
@@ -67,7 +67,7 @@ extern long long timespec_diff_us(struct timespec start, struct timespec end);
#define print_overflow_err(mes, ov) \
{ \
- fprintf(stderr, gettext("Measure took %u seconds, but registers could " \
+ fprintf(stderr, _("Measure took %u seconds, but registers could " \
"overflow at %u seconds, results " \
"could be inaccurate\n"), mes, ov); \
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment