From 280fb1b4a0319d2d88a90e6d5d3e2126a2fe92a8 Mon Sep 17 00:00:00 2001 From: meator Date: Tue, 20 Feb 2024 21:14:04 +0100 Subject: [PATCH] New package: auto-cpufreq-2.2.0 --- srcpkgs/auto-cpufreq/files/README.voidlinux | 4 +++ srcpkgs/auto-cpufreq/files/auto-cpufreq/run | 14 ++++++++ .../disable_poetry_dynamic_versioning.patch | 25 +++++++++++++ .../patches/fix_icon_n_style_locations.patch | 15 ++++++++ .../patches/fix_other_icon_path.patch | 13 +++++++ srcpkgs/auto-cpufreq/template | 36 +++++++++++++++++++ 6 files changed, 107 insertions(+) create mode 100644 srcpkgs/auto-cpufreq/files/README.voidlinux create mode 100644 srcpkgs/auto-cpufreq/files/auto-cpufreq/run create mode 100644 srcpkgs/auto-cpufreq/patches/disable_poetry_dynamic_versioning.patch create mode 100644 srcpkgs/auto-cpufreq/patches/fix_icon_n_style_locations.patch create mode 100644 srcpkgs/auto-cpufreq/patches/fix_other_icon_path.patch create mode 100644 srcpkgs/auto-cpufreq/template diff --git a/srcpkgs/auto-cpufreq/files/README.voidlinux b/srcpkgs/auto-cpufreq/files/README.voidlinux new file mode 100644 index 0000000000000..5d41268ed9cda --- /dev/null +++ b/srcpkgs/auto-cpufreq/files/README.voidlinux @@ -0,0 +1,4 @@ +If you are using GNOME, you should turn off the GNOME Power Profiles daemon. +This can turn it off permanently using the following command: + +# touch /etc/sv/power-profiles-daemon/down diff --git a/srcpkgs/auto-cpufreq/files/auto-cpufreq/run b/srcpkgs/auto-cpufreq/files/auto-cpufreq/run new file mode 100644 index 0000000000000..ad00319bf9d0e --- /dev/null +++ b/srcpkgs/auto-cpufreq/files/auto-cpufreq/run @@ -0,0 +1,14 @@ +#!/bin/sh +exec 2>&1 + +# Test whether the power-profiles-daemon service exists +if sv status power-profiles-daemon 2>/dev/null; then + # Make sure that it isn't running + if sv status power-profiles-daemon | grep -q "^run"; then + echo "Please disable power-profiles-daemon runit service " \ + "to make auto-cpufreq work!" + exit 1 + fi +fi + +exec auto-cpufreq --daemon diff --git a/srcpkgs/auto-cpufreq/patches/disable_poetry_dynamic_versioning.patch b/srcpkgs/auto-cpufreq/patches/disable_poetry_dynamic_versioning.patch new file mode 100644 index 0000000000000..ad7cc733a9446 --- /dev/null +++ b/srcpkgs/auto-cpufreq/patches/disable_poetry_dynamic_versioning.patch @@ -0,0 +1,25 @@ +The pyproject.toml already sets the correct version, so the version detection +system doesn't even have to be replaced. +--- a/pyproject.toml ++++ b/pyproject.toml +@@ -32,18 +32,12 @@ + 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" ++requires = ["poetry-core>=1.0.0"] ++build-backend = "poetry.core.masonry.api" + + [tool.poetry.scripts] + auto-cpufreq = "auto_cpufreq.bin.auto_cpufreq:main" + auto-cpufreq-gtk = "auto_cpufreq.bin.auto_cpufreq_gtk:main" + +-# https://github.com/mtkennerly/poetry-dynamic-versioning +-[tool.poetry-dynamic-versioning] +-enable = true +-vcs = "git" +-format = "v{base}+{commit}" +- + # SideNote + # Regarding zip_safe = https://setuptools.pypa.io/en/latest/deprecated/zip_safe.html diff --git a/srcpkgs/auto-cpufreq/patches/fix_icon_n_style_locations.patch b/srcpkgs/auto-cpufreq/patches/fix_icon_n_style_locations.patch new file mode 100644 index 0000000000000..18f4b04e8b7eb --- /dev/null +++ b/srcpkgs/auto-cpufreq/patches/fix_icon_n_style_locations.patch @@ -0,0 +1,15 @@ +This patch is taken from +https://aur.archlinux.org/cgit/aur.git/tree/001-fix-icon-n-style-locations.patch?h=auto-cpufreq&id=2cb3f7935e7e0252e15d8dbcf1309ab246e143cf +--- a/auto_cpufreq/gui/app.py ++++ b/auto_cpufreq/gui/app.py +@@ -20,8 +20,8 @@ + ICON_FILE = "/snap/auto-cpufreq/current/icon.png" + CSS_FILE = "/snap/auto-cpufreq/current/style.css" + else: +- ICON_FILE = "/usr/local/share/auto-cpufreq/images/icon.png" +- CSS_FILE = "/usr/local/share/auto-cpufreq/scripts/style.css" ++ ICON_FILE = "/usr/share/pixmaps/auto-cpufreq.png" ++ CSS_FILE = "/usr/share/auto-cpufreq/scripts/style.css" + + HBOX_PADDING = 20 + PKEXEC_ERROR = "Error executing command as another user: Not authorized\n\nThis incident has been reported.\n" diff --git a/srcpkgs/auto-cpufreq/patches/fix_other_icon_path.patch b/srcpkgs/auto-cpufreq/patches/fix_other_icon_path.patch new file mode 100644 index 0000000000000..a982d60e688bd --- /dev/null +++ b/srcpkgs/auto-cpufreq/patches/fix_other_icon_path.patch @@ -0,0 +1,13 @@ +This patch is taken from +https://aur.archlinux.org/cgit/aur.git/tree/002-fix-other-icon-path.patch?h=auto-cpufreq&id=2cb3f7935e7e0252e15d8dbcf1309ab246e143cf +--- a/auto_cpufreq/gui/objects.py ++++ b/auto_cpufreq/gui/objects.py +@@ -221,7 +221,7 @@ + self.add_button("Close", Gtk.ResponseType.CLOSE) + self.set_default_size(400, 350) + img_buffer = GdkPixbuf.Pixbuf.new_from_file_at_scale( +- filename="/usr/local/share/auto-cpufreq/images/icon.png", ++ filename="/usr/share/pixmaps/auto-cpufreq.png", + width=150, + height=150, + preserve_aspect_ratio=True) diff --git a/srcpkgs/auto-cpufreq/template b/srcpkgs/auto-cpufreq/template new file mode 100644 index 0000000000000..c6a9e38a0dbf0 --- /dev/null +++ b/srcpkgs/auto-cpufreq/template @@ -0,0 +1,36 @@ +# Template file for 'auto-cpufreq' +pkgname=auto-cpufreq +version=2.2.0 +revision=1 +build_style=python3-pep517 +# auto-cpufreq is executed in post_install() to get completions, so masterdir +# needs part of $depends installed +_core_deps="python3-click python3-psutil python3-distro python3-requests" +hostmakedepends="python3-poetry-core $_core_deps" +depends="$_core_deps dmidecode python3-gobject gtk+3" +short_desc="Automatic CPU speed & power optimizer for Linux" +maintainer="meator " +license="LGPL-3.0-only" +homepage="https://github.com/AdnanHodzic/auto-cpufreq" +distfiles="https://github.com/AdnanHodzic/auto-cpufreq/archive/refs/tags/v${version}.tar.gz" +checksum=d84d45a1638f5bff72b5ce7c1653886143cdbb4c6b198e63e054b6a18f7ade68 + +post_patch() { + patch -Np1 < nix/patches/prevent-install-and-copy.patch +} + +post_install() { + vsconf auto-cpufreq.conf-example auto-cpufreq.conf + vinstall scripts/auto-cpufreq-gtk.desktop 644 usr/share/applications + vinstall images/icon.png 644 usr/share/pixmaps auto-cpufreq.png + vinstall scripts/style.css 644 usr/share/auto-cpufreq/scripts + vbin scripts/cpufreqctl.sh cpufreqctl.auto-cpufreq + vinstall scripts/org.auto-cpufreq.pkexec.policy 644 usr/share/polkit-1/actions + vdoc ${FILESDIR}/README.voidlinux + vsv auto-cpufreq + + for completion in bash fish zsh; do + PYTHONPATH=$DESTDIR/$py3_sitelib _AUTO_CPUFREQ_COMPLETE=${completion}_source ${DESTDIR}/usr/bin/auto-cpufreq > auto-cpufreq.$completion + vcompletion auto-cpufreq.$completion $completion + done +}