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