commit:     85ef6cd085ca1f1fe78ae73cdebae3640ca78f53
Author:     Violet Purcell <vimproved <AT> inventati <DOT> org>
AuthorDate: Sun Oct  8 18:23:08 2023 +0000
Commit:     Yixun Lan <dlan <AT> gentoo <DOT> org>
CommitDate: Mon Oct  9 06:22:41 2023 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=85ef6cd0

sys-power/throttled: new package, add 0.10.0

add kernel config check, but only make it as a warning
rename openrc script file to throttled.initd

Closes: https://github.com/gentoo/gentoo/pull/33252/
Signed-off-by: Violet Purcell <vimproved <AT> inventati.org>
Signed-off-by: Yixun Lan <dlan <AT> gentoo.org>

 sys-power/throttled/Manifest                |  1 +
 sys-power/throttled/files/throttled.initd   |  5 ++++
 sys-power/throttled/files/throttled.service | 11 ++++++++
 sys-power/throttled/metadata.xml            | 19 +++++++++++++
 sys-power/throttled/throttled-0.10.0.ebuild | 43 +++++++++++++++++++++++++++++
 5 files changed, 79 insertions(+)

diff --git a/sys-power/throttled/Manifest b/sys-power/throttled/Manifest
new file mode 100644
index 000000000000..67d1fc89509a
--- /dev/null
+++ b/sys-power/throttled/Manifest
@@ -0,0 +1 @@
+DIST throttled-0.10.0.gh.tar.gz 22191 BLAKE2B 
c301ee070ff462acd613c90525209eb5237c57e7171bf25133535f9c9a50d226b919065d8f6999f95b45f7f0d4c30e63abb5e04ec768d76b3c82dd19f092a693
 SHA512 
b89c467295bfc592d7b3ce0c4a41fedf436acf8067f8ef63d8596b92343ed8e04d371d065a9e35fdddba40772f12255c30960c2c46f0cbd5093bfc5e72fb4e18

diff --git a/sys-power/throttled/files/throttled.initd 
b/sys-power/throttled/files/throttled.initd
new file mode 100644
index 000000000000..efe8b6a7e151
--- /dev/null
+++ b/sys-power/throttled/files/throttled.initd
@@ -0,0 +1,5 @@
+#!/sbin/openrc-run
+command="/usr/bin/throttled"
+pidfile="/run/throttled.pid"
+description="Stop Intel throttling"
+command_background="yes"

diff --git a/sys-power/throttled/files/throttled.service 
b/sys-power/throttled/files/throttled.service
new file mode 100644
index 000000000000..5b7decc435b0
--- /dev/null
+++ b/sys-power/throttled/files/throttled.service
@@ -0,0 +1,11 @@
+[Unit]
+Description=Stop Intel throttling
+
+[Service]
+Type=simple
+ExecStart=/usr/bin/throttled
+# Setting PYTHONUNBUFFERED is necessary to see the output of this service in 
the journal
+Environment=PYTHONUNBUFFERED=1
+
+[Install]
+WantedBy=multi-user.target

diff --git a/sys-power/throttled/metadata.xml b/sys-power/throttled/metadata.xml
new file mode 100644
index 000000000000..b7efde349add
--- /dev/null
+++ b/sys-power/throttled/metadata.xml
@@ -0,0 +1,19 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE pkgmetadata SYSTEM "https://www.gentoo.org/dtd/metadata.dtd";>
+<pkgmetadata>
+       <maintainer type="person" proxied="yes">
+               <email>[email protected]</email>
+               <name>Violet Purcell</name>
+       </maintainer>
+       <maintainer type="person" proxied="proxy">
+               <email>[email protected]</email>
+               <name>Yixun Lan</name>
+       </maintainer>
+       <maintainer type="project" proxied="proxy">
+               <email>[email protected]</email>
+               <name>Proxy Maintainers</name>
+       </maintainer>
+       <upstream>
+               <remote-id type="github">erpalma/throttled</remote-id>
+       </upstream>
+</pkgmetadata>

diff --git a/sys-power/throttled/throttled-0.10.0.ebuild 
b/sys-power/throttled/throttled-0.10.0.ebuild
new file mode 100644
index 000000000000..9b1a5e143ffa
--- /dev/null
+++ b/sys-power/throttled/throttled-0.10.0.ebuild
@@ -0,0 +1,43 @@
+# Copyright 2023 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=8
+
+PYTHON_COMPAT=( python3_{10..12} )
+inherit linux-info python-single-r1 systemd
+
+DESCRIPTION="Daemon to work around throttling issues on some Intel laptops"
+HOMEPAGE="https://github.com/erpalma/throttled";
+SRC_URI="https://github.com/erpalma/throttled/archive/refs/tags/v${PV}.tar.gz 
-> ${P}.gh.tar.gz"
+
+LICENSE="MIT"
+SLOT="0"
+KEYWORDS="~amd64"
+REQUIRED_USE="${PYTHON_REQUIRED_USE}"
+RESTRICT="test"
+
+CONFIG_CHECK="~X86_MSR ~DEVMEM"
+
+RDEPEND="
+       ${PYTHON_DEPS}
+       $(python_gen_cond_dep '
+               dev-python/dbus-python[${PYTHON_USEDEP}]
+               dev-python/pygobject[${PYTHON_USEDEP}]
+       ')
+       sys-apps/pciutils
+"
+
+pkg_setup() {
+       linux-info_pkg_setup
+       python-single-r1_pkg_setup
+}
+
+src_install() {
+       default
+       python_newscript throttled.py throttled
+       python_domodule mmio.py
+       newinitd "${FILESDIR}/throttled.initd" throttled
+       systemd_dounit "${FILESDIR}/throttled.service"
+       insinto /etc
+       doins etc/throttled.conf
+}

Reply via email to