From 3141185a3b6213e5635eaea26577731bcb7cdb77 Mon Sep 17 00:00:00 2001 From: Bruno Bigras Date: Tue, 9 Feb 2021 19:12:43 -0500 Subject: [PATCH] auto-cpufreq: 1.5.3 -> 1.6.1 Co-authored-by: Aamaruvi Yogamani <38222826+Technical27@users.noreply.github.com> --- pkgs/tools/system/auto-cpufreq/default.nix | 4 +- .../prevent-install-and-copy.patch | 38 ++++++++++++++----- 2 files changed, 30 insertions(+), 12 deletions(-) diff --git a/pkgs/tools/system/auto-cpufreq/default.nix b/pkgs/tools/system/auto-cpufreq/default.nix index b4bef5fc5e3..f86ac47fdde 100644 --- a/pkgs/tools/system/auto-cpufreq/default.nix +++ b/pkgs/tools/system/auto-cpufreq/default.nix @@ -2,13 +2,13 @@ python3Packages.buildPythonPackage rec { pname = "auto-cpufreq"; - version = "1.5.3"; + version = "1.6.1"; src = fetchFromGitHub { owner = "AdnanHodzic"; repo = pname; rev = "v${version}"; - sha256 = "sha256-NDIdQ4gUN2jG+VWXsv3fdUogZxOOiNtnbekD30+jx6M="; + sha256 = "sha256-oz3C1150CPfT0kkx1x7VIX/Rm06dkjyxeDPFCRJaWNc="; }; propagatedBuildInputs = with python3Packages; [ click distro psutil ]; diff --git a/pkgs/tools/system/auto-cpufreq/prevent-install-and-copy.patch b/pkgs/tools/system/auto-cpufreq/prevent-install-and-copy.patch index 232ac780341..7f86f6eda0e 100644 --- a/pkgs/tools/system/auto-cpufreq/prevent-install-and-copy.patch +++ b/pkgs/tools/system/auto-cpufreq/prevent-install-and-copy.patch @@ -1,8 +1,17 @@ diff --git a/auto_cpufreq/core.py b/auto_cpufreq/core.py -index 482a544..d142013 100644 +index a685db8..1ca1ca1 100644 --- a/auto_cpufreq/core.py +++ b/auto_cpufreq/core.py -@@ -163,31 +163,13 @@ def get_current_gov(): +@@ -72,7 +72,7 @@ def app_version(): + print("Git commit:", check_output(["git", "describe", "--always"]).strip().decode()) + else: + print(getoutput("pacman -Qi auto-cpufreq | grep Version")) +- else: ++ else: + # source code (auto-cpufreq-installer) + try: + print("Git commit:", check_output(["git", "describe", "--always"]).strip().decode()) +@@ -179,31 +179,13 @@ def get_current_gov(): return print("Currently using:", getoutput("cpufreqctl.auto-cpufreq --governor").strip().split(" ")[0], "governor") def cpufreqctl(): @@ -38,8 +47,8 @@ index 482a544..d142013 100644 def footer(l=79): print("\n" + "-" * l + "\n") -@@ -212,74 +194,12 @@ def remove_complete_msg(): - +@@ -233,74 +215,12 @@ def remove_complete_msg(): + footer() def deploy_daemon(): - print("\n" + "-" * 21 + " Deploying auto-cpufreq as a daemon " + "-" * 22 + "\n") @@ -60,7 +69,7 @@ index 482a544..d142013 100644 - except: - print("\nERROR:\nWas unable to turn off bluetooth on boot") - -- auto_cpufreq_log_path.touch(exist_ok=True) +- auto_cpufreq_stats_path.touch(exist_ok=True) - - print("\n* Deploy auto-cpufreq install script") - shutil.copy(SCRIPTS_DIR / "auto-cpufreq-install.sh", "/usr/bin/auto-cpufreq-install") @@ -102,12 +111,12 @@ index 482a544..d142013 100644 - # remove auto-cpufreq-remove - os.remove("/usr/bin/auto-cpufreq-remove") - -- # delete log file -- if auto_cpufreq_log_path.exists(): -- if auto_cpufreq_log_file is not None: -- auto_cpufreq_log_file.close() +- # delete stats file +- if auto_cpufreq_stats_path.exists(): +- if auto_cpufreq_stats_file is not None: +- auto_cpufreq_stats_file.close() - -- auto_cpufreq_log_path.unlink() +- auto_cpufreq_stats_path.unlink() - - # restore original cpufrectl script - cpufreqctl_restore() @@ -116,6 +125,15 @@ index 482a544..d142013 100644 def gov_check(): for gov in get_avail_gov(): +@@ -331,7 +251,7 @@ def countdown(s): + if auto_cpufreq_stats_file is not None: + auto_cpufreq_stats_file.seek(0) + auto_cpufreq_stats_file.truncate(0) +- ++ + # execution timestamp + from datetime import datetime + now = datetime.now() diff --git a/scripts/cpufreqctl.sh b/scripts/cpufreqctl.sh index 63a2b5b..e157efe 100755 --- a/scripts/cpufreqctl.sh