Skip to content

Commit

Permalink
sys-power/sntrack: new package, add 9999
Browse files Browse the repository at this point in the history
  • Loading branch information
SuperTux88 committed Jan 25, 2024
1 parent 4a929b6 commit 8bf0a80
Show file tree
Hide file tree
Showing 5 changed files with 83 additions and 0 deletions.
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,9 @@ The following packages are available in this overlay:
* sys-kernel/zenpower
* Linux kernel driver for reading sensors of AMD Zen family CPUs
* https://github.com/Ta180m/zenpower3
* sys-power/sntrack
* Tracks the battery discharge rate during sleep
* https://github.com/xsmile/sntrack
* www-servers/miniserve
* A CLI tool to serve files and dirs over HTTP
* https://github.com/svenstaro/miniserve
Expand Down
15 changes: 15 additions & 0 deletions metadata/md5-cache/sys-power/sntrack-9999
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
BDEPEND=>=dev-vcs/git-1.8.2.1[curl]
DEFINED_PHASES=install setup unpack
DEPEND=>=dev-python/matplotlib-3.5.0 systemd? ( sys-apps/systemd )
DESCRIPTION=Tracks the battery discharge rate during sleep
EAPI=8
HOMEPAGE=https://github.com/xsmile/sntrack
INHERIT=python-single-r1 git-r3
IUSE=systemd python_single_target_python3_10 python_single_target_python3_11 python_single_target_python3_12
LICENSE=GPL-3
PROPERTIES=live
RDEPEND=>=dev-python/matplotlib-3.5.0 systemd? ( sys-apps/systemd ) python_single_target_python3_10? ( dev-lang/python:3.10 ) python_single_target_python3_11? ( dev-lang/python:3.11 ) python_single_target_python3_12? ( dev-lang/python:3.12 )
REQUIRED_USE=^^ ( python_single_target_python3_10 python_single_target_python3_11 python_single_target_python3_12 )
SLOT=0
_eclasses_=multiprocessing 30ead54fa2e2b5f9cd4e612ffc34d0fe toolchain-funcs e56c7649b804f051623c8bc1a1c44084 multilib c19072c3cd7ac5cb21de013f7e9832e0 python-utils-r1 042f4cc53680245bf99a84669b94155a python-single-r1 75118e916668a74c660a13b0ecb22562 git-r3 86fa1f157b70b9d2ff340c4633b1cf4b
_md5_=74ef7bb9de48ba966fea58d9ad490efa
13 changes: 13 additions & 0 deletions sys-power/sntrack/files/history-db-path.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
diff --git a/main.py b/main.py
index 3162bd6..989333d 100755
--- a/main.py
+++ b/main.py
@@ -289,7 +289,7 @@ def main() -> None:
args = parse_args()
logging.basicConfig(format=LOGGING_FORMAT, level=args.loglevel)

- cur = init()
+ cur = init(f'/var/lib/{__pkgname__}/history.db')
fun_map[args.main_action](cur, args)
cleanup(cur)

11 changes: 11 additions & 0 deletions sys-power/sntrack/metadata.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE pkgmetadata SYSTEM "https://www.gentoo.org/dtd/metadata.dtd">
<pkgmetadata>
<maintainer type="person">
<name>Benjamin Neff</name>
<email>[email protected]</email>
</maintainer>
<upstream>
<remote-id type="github">xsmile/sntrack</remote-id>
</upstream>
</pkgmetadata>
41 changes: 41 additions & 0 deletions sys-power/sntrack/sntrack-9999.ebuild
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
# Copyright 2024 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2

EAPI=8

PYTHON_COMPAT=( python3_{10..12} )
inherit python-single-r1

DESCRIPTION="Tracks the battery discharge rate during sleep"
HOMEPAGE="https://github.com/xsmile/sntrack"

inherit git-r3
EGIT_REPO_URI="${HOMEPAGE}.git"

LICENSE="GPL-3"
SLOT="0"
IUSE="systemd"
REQUIRED_USE="${PYTHON_REQUIRED_USE}"

DEPEND="
>=dev-python/matplotlib-3.5.0
systemd? ( sys-apps/systemd )
"
RDEPEND="
${DEPEND}
${PYTHON_DEPS}
"

PATCHES=( "${FILESDIR}"/history-db-path.patch )

src_install() {
exeinto /usr/bin
newexe main.py ${PN}

keepdir /var/lib/${PN}

use systemd && dosym "/usr/bin/${PN}" /usr/lib/systemd/system-sleep/${PN}

dodoc README.md
}

0 comments on commit 8bf0a80

Please sign in to comment.