[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/cpupower 0325122de5 31/35: Merge remote-tracking branch
From: |
ELPA Syncer |
Subject: |
[elpa] externals/cpupower 0325122de5 31/35: Merge remote-tracking branch 'origin/version-check' |
Date: |
Thu, 5 May 2022 15:57:47 -0400 (EDT) |
branch: externals/cpupower
commit 0325122de52915afabd253d1d7930097273515d4
Merge: a18d913837 f7f4671e69
Author: smeister <smeister@awstruepower.com>
Commit: smeister <smeister@awstruepower.com>
Merge remote-tracking branch 'origin/version-check'
---
cpupower.el | 41 ++++++++++++++++++++++++++++++++++++-----
1 file changed, 36 insertions(+), 5 deletions(-)
diff --git a/cpupower.el b/cpupower.el
index b0ce586dad..ab795c9492 100644
--- a/cpupower.el
+++ b/cpupower.el
@@ -64,7 +64,13 @@ messages buffer"
(defconst cpupower--compatible-versions
'("5.4")
- "Versions of cpupower which cpupower.el can work with.")
+ "Versions of cpupower which cpupower.el can work with.
+
+It is possible that other versions of cpupower have the same
+command line input/output structure. If you are working with a
+version of cpupower not listed here but you suspect is
+compatible, extending this list with you version will all you to
+test.")
(defvar cpupower--cache
nil
@@ -86,13 +92,33 @@ will be called if the value is not cached."
derived-value))))
(defun cpupower--get-version ()
- "Return the cpupower executable version or 'nil on failure"
+ "Return the cpupower executable version or 'nil on failure.
+
+Note: this function skips the safety check because the safety
+check is composed of this function."
(cpupower--with-cache-slot :version
- (let* ((output (cpupower--run "--version"))
+ (let* ((output (cpupower--run "--version" t))
(tokens (split-string output)))
(when (string-equal (car tokens) "cpupower")
(cadr tokens)))))
+(defun cpupower--ensure-executable-valid ()
+ "This function will cause an error if an invalid configuration is detected.
+
+The cpupower command must be executable and must indicate an
+acceptible version."
+ (let ((is-valid (cpupower--with-cache-slot :valid
+ (cl-member (cpupower--get-version)
+ cpupower--compatible-versions
+ :test 'string-equal))))
+ (unless is-valid
+ (let ((version (cpupower--get-version)))
+ (if (null version)
+ (error "Unable to communicate with cpupower (shell command:
\"%s\")"
+ cpupower-cmd)
+ (error "Invalid cpu power version %s. Must be one of: %s"
+ version (mapconcat 'identity cpupower--compatible-versions ",
")))))))
+
(defun cpupower--get-num-cpus ()
"Return the number of CPUs on this system."
(cpupower--with-cache-slot :num-cpus
@@ -111,8 +137,13 @@ cpus but currently it just finds _all_ governors."
"available cpufreq governors:"
"\n")))))
-(defun cpupower--run (subcommand)
- "Execute cpupower with SUBCOMMAND arguments return the output as a string."
+(defun cpupower--run (subcommand &optional skip-safety-check)
+ "Execute cpupower with SUBCOMMAND arguments return the output as a string.
+
+When SKIP-SAFETY-CHECK is non-nil the cpupower configuration will
+be checked before executing any commands."
+ (unless skip-safety-check
+ (cpupower--ensure-executable-valid))
(with-temp-buffer
(let ((command (format "%s %s" cpupower-cmd subcommand)))
(when cpupower-enable-logging
- [elpa] branch externals/cpupower created (now 26d745d610), ELPA Syncer, 2022/05/05
- [elpa] externals/cpupower 54da9938b4 07/35: well, it's slightly more concise., ELPA Syncer, 2022/05/05
- [elpa] externals/cpupower 24b05daf79 02/35: GPL-v3, ELPA Syncer, 2022/05/05
- [elpa] externals/cpupower 4204048eea 08/35: Merge branch 'cpu-info-change', ELPA Syncer, 2022/05/05
- [elpa] externals/cpupower 757ef4a6fb 09/35: now with a version string, ELPA Syncer, 2022/05/05
- [elpa] externals/cpupower 6ab7e0caec 10/35: whitespace, ELPA Syncer, 2022/05/05
- [elpa] externals/cpupower b3742b03bf 15/35: Merge branch 'formalize', ELPA Syncer, 2022/05/05
- [elpa] externals/cpupower bdc0013d83 33/35: version 1.0.1?, ELPA Syncer, 2022/05/05
- [elpa] externals/cpupower b6c476e8f1 27/35: do these need to be out here?, ELPA Syncer, 2022/05/05
- [elpa] externals/cpupower 0325122de5 31/35: Merge remote-tracking branch 'origin/version-check',
ELPA Syncer <=
- [elpa] externals/cpupower 3824c2aae4 25/35: remove that warning?, ELPA Syncer, 2022/05/05
- [elpa] externals/cpupower c62689f72e 24/35: now without cat-ing random files, ELPA Syncer, 2022/05/05
- [elpa] externals/cpupower d2e1eacaba 13/35: ok, that looks reasonable, ELPA Syncer, 2022/05/05
- [elpa] externals/cpupower 40e5ece723 17/35: Merge branch 'with-readme', ELPA Syncer, 2022/05/05
- [elpa] externals/cpupower f661743bcf 19/35: :shrug:, ELPA Syncer, 2022/05/05
- [elpa] externals/cpupower 24bd212efe 28/35: ok, got those backwards, ELPA Syncer, 2022/05/05
- [elpa] externals/cpupower 3b29497bc3 01/35: here's the first piece, ELPA Syncer, 2022/05/05
- [elpa] externals/cpupower 7b0e057ca6 05/35: ok, I think it works now., ELPA Syncer, 2022/05/05
- [elpa] externals/cpupower 4e85b4dc02 04/35: Initial commit, ELPA Syncer, 2022/05/05
- [elpa] externals/cpupower d38011bbb9 06/35: Merge branch 'starting' into 'main', ELPA Syncer, 2022/05/05