sys-power/auto-cpufreq: new package, version 1.9.6

Signed-off-by: Pascal Jäger <pascal.jaeger@leimstift.de>
This commit is contained in:
Pascal Jäger
2022-10-12 08:50:40 +02:00
parent 375eef36a4
commit c189a6dd65
4 changed files with 111 additions and 0 deletions

View File

@@ -0,0 +1 @@
DIST auto-cpufreq-1.9.6.tar.gz 28393 BLAKE2B a4204cdfe549743c6781c4cf26c97133e488735d806d97205af2d956500b7b867c1635f6f20ee9940d9b98377b20fc83a31953099319e4e245a381754e35e8ee SHA512 55892a4ed27fbc8ffad8b67c9cfa9f70e510342bb2c4fbf8b84c8e4da0a4ca51940f34e02a052f97efdc41085cf4ff8db5323328a1b7ce948d9a87338a209798

View File

@@ -0,0 +1,75 @@
# Copyright 1999-2022 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
EAPI=8
PYTHON_COMPAT=( python3_{8..11} )
DISTUTILS_USE_PEP517=setuptools
inherit distutils-r1 systemd
DESCRIPTION="Automatic CPU speed & power optimizer for Linux"
HOMEPAGE="https://github.com/AdnanHodzic/auto-cpufreq"
SRC_URI="https://github.com/AdnanHodzic/${PN}/archive/v${PV}.tar.gz -> ${P}.tar.gz"
LICENSE="GPL-3"
KEYWORDS="~amd64"
SLOT="0"
IUSE="systemd"
RDEPEND="dev-python/psutil
dev-python/click
dev-python/distro"
DEPEND="${RDEPEND}"
DOCS=( README.md )
PATCHES=( "${FILESDIR}/${PN}-remove-setuptools_git_versioning.patch" )
src_prepare() {
sed -i 's|usr/local|usr|g' "scripts/${PN}.service" "scripts/${PN}-openrc" auto_cpufreq/core.py || die
distutils-r1_src_prepare
}
python_install() {
distutils-r1_python_install
exeinto "/usr/share/${PN}/scripts"
doexe scripts/cpufreqctl.sh
if use systemd; then
systemd_douserunit "scripts/${PN}.service"
else
doinitd "scripts/${PN}-openrc"
mv "${D}/etc/init.d/${PN}-openrc" "${D}/etc/init.d/${PN}" || die
fi
}
pkg_postinst() {
touch /var/log/auto-cpufreq.log
elog "Enable auto-cpufreq daemon service at boot:"
if use systemd; then
elog "systemctl enable --now auto-cpufreq"
else
elog "rc-update add auto-cpufreq default"
fi
elog ""
elog "To view live log, run:"
elog "auto-cpufreq --log"
}
pkg_postrm() {
# Remove auto-cpufreq log file
rm /var/log/auto-cpufreq.log
# Remove auto-cpufreq's cpufreqctl binary
# it copies cpufreqctl.sh over (I do NOT like this behavior)
rm /usr/bin/cpufreqctl
# Restore original cpufreqctl binary if backup was made
if [ -f "/usr/bin/cpufreqctl.auto-cpufreq.bak" ]; then
mv /usr/bin/cpufreqctl.auto-cpufreq.bak /usr/bin/cpufreqctl
fi
}

View File

@@ -0,0 +1,19 @@
Remove the automatic setuptools_git_versioning because distutils can not handle that.
--- a/setup.py
+++ b/setup.py
@@ -17,13 +17,7 @@ VERSION = "1.9.5"
setup(
name="auto-cpufreq",
- setuptools_git_versioning={
- "starting_version": VERSION,
- "template": "{tag}+{sha}",
- "dev_template": "{tag}+{sha}",
- "dirty_template": "{tag}+{sha}.post{ccount}.dirty"
- },
- setup_requires=["setuptools-git-versioning"],
+ version=VERSION,
description="Automatic CPU speed & power optimizer for Linux",
long_description=readme,
author="Adnan Hodzic",

View File

@@ -0,0 +1,16 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
<pkgmetadata>
<maintainer type="person">
<email>pascal.jaeger@leimstift.de</email>
<name>Pascal Jäger</name>
</maintainer>
<upstream>
<remote-id type="github">AdnanHodzic/auto-cpufreq</remote-id>
</upstream>
<longdescription lang="en">
Automatic CPU speed and power optimizer for Linux based on active monitoring
of laptop's battery state, CPU usage, CPU temperature and system load.
Ultimately allowing you to improve battery life without making any compromises.
</longdescription>
</pkgmetadata>