Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)

auto-cpufreq: 1.6.1 -> 1.6.4

+24 -36
+2 -2
pkgs/tools/system/auto-cpufreq/default.nix
··· 2 3 python3Packages.buildPythonPackage rec { 4 pname = "auto-cpufreq"; 5 - version = "1.6.1"; 6 7 src = fetchFromGitHub { 8 owner = "AdnanHodzic"; 9 repo = pname; 10 rev = "v${version}"; 11 - sha256 = "sha256-oz3C1150CPfT0kkx1x7VIX/Rm06dkjyxeDPFCRJaWNc="; 12 }; 13 14 propagatedBuildInputs = with python3Packages; [ click distro psutil ];
··· 2 3 python3Packages.buildPythonPackage rec { 4 pname = "auto-cpufreq"; 5 + version = "1.6.4"; 6 7 src = fetchFromGitHub { 8 owner = "AdnanHodzic"; 9 repo = pname; 10 rev = "v${version}"; 11 + sha256 = "sha256-9WYuAWcJGosYEsnnkqvZLXXvqF+1nBEozh6F84Kit6w="; 12 }; 13 14 propagatedBuildInputs = with python3Packages; [ click distro psutil ];
+22 -34
pkgs/tools/system/auto-cpufreq/prevent-install-and-copy.patch
··· 1 diff --git a/auto_cpufreq/core.py b/auto_cpufreq/core.py 2 - index a685db8..1ca1ca1 100644 3 --- a/auto_cpufreq/core.py 4 +++ b/auto_cpufreq/core.py 5 - @@ -72,7 +72,7 @@ def app_version(): 6 - print("Git commit:", check_output(["git", "describe", "--always"]).strip().decode()) 7 - else: 8 - print(getoutput("pacman -Qi auto-cpufreq | grep Version")) 9 - - else: 10 - + else: 11 - # source code (auto-cpufreq-installer) 12 - try: 13 - print("Git commit:", check_output(["git", "describe", "--always"]).strip().decode()) 14 - @@ -179,31 +179,13 @@ def get_current_gov(): 15 - return print("Currently using:", getoutput("cpufreqctl.auto-cpufreq --governor").strip().split(" ")[0], "governor") 16 17 def cpufreqctl(): 18 - """ ··· 20 - """ 21 - 22 - # detect if running on a SNAP 23 - - if os.getenv('PKG_MARKER') == "SNAP": 24 - pass 25 - else: 26 - # deploy cpufreqctl.auto-cpufreq script 27 - if os.path.isfile("/usr/bin/cpufreqctl"): 28 - - shutil.copy(SCRIPTS_DIR / "cpufreqctl.sh", "/usr/bin/cpufreqctl.auto-cpufreq") 29 - else: 30 - - shutil.copy(SCRIPTS_DIR / "cpufreqctl.sh", "/usr/bin/cpufreqctl.auto-cpufreq") 31 + # scripts are already in the correct place 32 + pass 33 ··· 37 - remove cpufreqctl.auto-cpufreq script 38 - """ 39 - # detect if running on a SNAP 40 - - if os.getenv('PKG_MARKER') == "SNAP": 41 - pass 42 - else: 43 - if os.path.isfile("/usr/bin/cpufreqctl.auto-cpufreq"): 44 - os.remove("/usr/bin/cpufreqctl.auto-cpufreq") 45 + # no need to restore 46 + pass 47 48 def footer(l=79): 49 - print("\n" + "-" * l + "\n") 50 - @@ -233,74 +215,12 @@ def remove_complete_msg(): 51 - footer() 52 53 def deploy_daemon(): 54 - print("\n" + "-" * 21 + " Deploying auto-cpufreq as a daemon " + "-" * 22 + "\n") ··· 66 - f.seek(0) 67 - f.truncate() 68 - f.write(content.replace(orig_set, change_set)) 69 - - except: 70 - - print("\nERROR:\nWas unable to turn off bluetooth on boot") 71 - 72 - auto_cpufreq_stats_path.touch(exist_ok=True) 73 - 74 - print("\n* Deploy auto-cpufreq install script") 75 - - shutil.copy(SCRIPTS_DIR / "auto-cpufreq-install.sh", "/usr/bin/auto-cpufreq-install") 76 - 77 - print("\n* Deploy auto-cpufreq remove script") 78 - shutil.copy(SCRIPTS_DIR / "auto-cpufreq-remove.sh", "/usr/bin/auto-cpufreq-remove") 79 - 80 - call("/usr/bin/auto-cpufreq-install", shell=True) 81 - - 82 + # prevent needless copying and system changes 83 + pass 84 85 # remove auto-cpufreq daemon 86 def remove(): 87 - ··· 102 - f.seek(0) 103 - f.truncate() 104 - f.write(content.replace(change_set, orig_set)) 105 - - except: 106 - - print("\nERROR:\nWas unable to turn on bluetooth on boot") 107 - 108 - # run auto-cpufreq daemon install script 109 - call("/usr/bin/auto-cpufreq-remove", shell=True) ··· 125 126 def gov_check(): 127 for gov in get_avail_gov(): 128 - @@ -331,7 +251,7 @@ def countdown(s): 129 - if auto_cpufreq_stats_file is not None: 130 - auto_cpufreq_stats_file.seek(0) 131 - auto_cpufreq_stats_file.truncate(0) 132 - - 133 - + 134 - # execution timestamp 135 - from datetime import datetime 136 - now = datetime.now() 137 diff --git a/scripts/cpufreqctl.sh b/scripts/cpufreqctl.sh 138 index 63a2b5b..e157efe 100755 139 --- a/scripts/cpufreqctl.sh
··· 1 diff --git a/auto_cpufreq/core.py b/auto_cpufreq/core.py 2 + index 83d0d64..04b5035 100644 3 --- a/auto_cpufreq/core.py 4 +++ b/auto_cpufreq/core.py 5 + @@ -204,35 +204,13 @@ def get_current_gov(): 6 + 7 8 def cpufreqctl(): 9 - """ ··· 11 - """ 12 - 13 - # detect if running on a SNAP 14 + - if os.getenv("PKG_MARKER") == "SNAP": 15 - pass 16 - else: 17 - # deploy cpufreqctl.auto-cpufreq script 18 - if os.path.isfile("/usr/bin/cpufreqctl"): 19 + - shutil.copy( 20 + - SCRIPTS_DIR / "cpufreqctl.sh", "/usr/bin/cpufreqctl.auto-cpufreq" 21 + - ) 22 - else: 23 + - shutil.copy( 24 + - SCRIPTS_DIR / "cpufreqctl.sh", "/usr/bin/cpufreqctl.auto-cpufreq" 25 + - ) 26 + # scripts are already in the correct place 27 + pass 28 ··· 32 - remove cpufreqctl.auto-cpufreq script 33 - """ 34 - # detect if running on a SNAP 35 + - if os.getenv("PKG_MARKER") == "SNAP": 36 - pass 37 - else: 38 - if os.path.isfile("/usr/bin/cpufreqctl.auto-cpufreq"): 39 - os.remove("/usr/bin/cpufreqctl.auto-cpufreq") 40 + # no need to restore 41 + pass 42 + 43 44 def footer(l=79): 45 + @@ -276,76 +254,13 @@ def remove_complete_msg(): 46 + 47 48 def deploy_daemon(): 49 - print("\n" + "-" * 21 + " Deploying auto-cpufreq as a daemon " + "-" * 22 + "\n") ··· 61 - f.seek(0) 62 - f.truncate() 63 - f.write(content.replace(orig_set, change_set)) 64 + - except Exception as e: 65 + - print(f"\nERROR:\nWas unable to turn off bluetooth on boot\n{repr(e)}") 66 - 67 - auto_cpufreq_stats_path.touch(exist_ok=True) 68 - 69 - print("\n* Deploy auto-cpufreq install script") 70 + - shutil.copy( 71 + - SCRIPTS_DIR / "auto-cpufreq-install.sh", "/usr/bin/auto-cpufreq-install" 72 + - ) 73 - 74 - print("\n* Deploy auto-cpufreq remove script") 75 - shutil.copy(SCRIPTS_DIR / "auto-cpufreq-remove.sh", "/usr/bin/auto-cpufreq-remove") 76 - 77 - call("/usr/bin/auto-cpufreq-install", shell=True) 78 + # prevent needless copying and system changes 79 + pass 80 81 + 82 # remove auto-cpufreq daemon 83 def remove(): 84 - ··· 99 - f.seek(0) 100 - f.truncate() 101 - f.write(content.replace(change_set, orig_set)) 102 + - except Exception as e: 103 + - print(f"\nERROR:\nWas unable to turn on bluetooth on boot\n{repr(e)}") 104 - 105 - # run auto-cpufreq daemon install script 106 - call("/usr/bin/auto-cpufreq-remove", shell=True) ··· 122 123 def gov_check(): 124 for gov in get_avail_gov(): 125 diff --git a/scripts/cpufreqctl.sh b/scripts/cpufreqctl.sh 126 index 63a2b5b..e157efe 100755 127 --- a/scripts/cpufreqctl.sh