From ca4babc32a085ddc64f081032166788f0a6b36e4 Mon Sep 17 00:00:00 2001 From: David Roman Date: Mon, 29 Jan 2024 19:24:45 +0100 Subject: sys-power/auto-cpufreq: add 2.1.0 Signed-off-by: David Roman --- sys-power/auto-cpufreq/Manifest | 1 + sys-power/auto-cpufreq/auto-cpufreq-2.1.0.ebuild | 84 ++++++++++++++++++++++ .../auto-cpufreq-remove-poetry_versioning.patch | 13 ++++ 3 files changed, 98 insertions(+) create mode 100644 sys-power/auto-cpufreq/auto-cpufreq-2.1.0.ebuild create mode 100644 sys-power/auto-cpufreq/files/auto-cpufreq-remove-poetry_versioning.patch (limited to 'sys-power') diff --git a/sys-power/auto-cpufreq/Manifest b/sys-power/auto-cpufreq/Manifest index b1e61e9c1..d01430a9c 100644 --- a/sys-power/auto-cpufreq/Manifest +++ b/sys-power/auto-cpufreq/Manifest @@ -1 +1,2 @@ DIST auto-cpufreq-1.9.6.tar.gz 28393 BLAKE2B a4204cdfe549743c6781c4cf26c97133e488735d806d97205af2d956500b7b867c1635f6f20ee9940d9b98377b20fc83a31953099319e4e245a381754e35e8ee SHA512 55892a4ed27fbc8ffad8b67c9cfa9f70e510342bb2c4fbf8b84c8e4da0a4ca51940f34e02a052f97efdc41085cf4ff8db5323328a1b7ce948d9a87338a209798 +DIST auto-cpufreq-2.1.0.tar.gz 211221 BLAKE2B ee376e44b31cd93ae37c3a800fd1b7e89af3b696e1d128d2bc8d335b1240d2e2b0d5aa0e90cd1465185bfff9cee02069ee1d46120be014b1dc61ce056308d4a1 SHA512 e01e6f03e7fcd3e0640ebd829234a07043c8d88bd1feabbcc6df463007b2e93410935394257bc28ed1297b294292425adfe4079a3dff0ec5636c23c3cbdd9ee0 diff --git a/sys-power/auto-cpufreq/auto-cpufreq-2.1.0.ebuild b/sys-power/auto-cpufreq/auto-cpufreq-2.1.0.ebuild new file mode 100644 index 000000000..ba46f6a70 --- /dev/null +++ b/sys-power/auto-cpufreq/auto-cpufreq-2.1.0.ebuild @@ -0,0 +1,84 @@ +# Copyright 1999-2022 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +EAPI=8 + +PYTHON_COMPAT=( python3_{10..12} ) + +DISTUTILS_USE_PEP517=poetry + +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/click[${PYTHON_USEDEP}] + dev-python/distro[${PYTHON_USEDEP}] + dev-python/psutil[${PYTHON_USEDEP}] + dev-python/pygobject[${PYTHON_USEDEP}] + dev-python/requests[${PYTHON_USEDEP}] +" + +DEPEND="${RDEPEND}" + +DOCS=( README.md ) +PATCHES=( "${FILESDIR}/${PN}-remove-poetry_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 "" + 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 --stats" +} + +pkg_postrm() { + # Remove auto-cpufreq log file + if [ -f "/var/log/auto-cpufreq.log" ]; then + rm /var/log/auto-cpufreq.log || die + fi + + # Remove auto-cpufreq's cpufreqctl binary + # it overwrites cpufreqctl.sh + if [ -f "/usr/bin/cpufreqctl" ]; then + rm /usr/bin/cpufreqctl || die + fi + + # 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 || die + fi +} diff --git a/sys-power/auto-cpufreq/files/auto-cpufreq-remove-poetry_versioning.patch b/sys-power/auto-cpufreq/files/auto-cpufreq-remove-poetry_versioning.patch new file mode 100644 index 000000000..c48110495 --- /dev/null +++ b/sys-power/auto-cpufreq/files/auto-cpufreq-remove-poetry_versioning.patch @@ -0,0 +1,13 @@ +diff --git a/pyproject.toml b/pyproject.toml +index c555726..f3ea0ab 100644 +--- a/pyproject.toml ++++ b/pyproject.toml +@@ -33,7 +33,7 @@ poetry = "^1.6.1" + + [build-system] + requires = ["poetry-core>=1.0.0", "poetry-dynamic-versioning>=1.0.0,<2.0.0"] +-build-backend = "poetry_dynamic_versioning.backend" ++build-backend = "poetry.core.masonry.api" + + [tool.poetry.scripts] + auto-cpufreq = "auto_cpufreq.bin.auto_cpufreq:main" -- cgit v1.2.3-65-gdbad