uboot: (firmwareOdroidC2/C4) don't invoke patch tool, use patches = [] instead

https://github.com/NixOS/nixpkgs/blob/master/pkgs/stdenv/generic/setup.sh#L948
this can do it nicely.

Signed-off-by: Anton Arapov <anton@deadbeef.mx>
This commit is contained in:
Anton Arapov 2021-04-03 12:58:10 +02:00 committed by Alan Daniels
commit 56de2bcd43
30691 changed files with 3076956 additions and 0 deletions

View file

@ -0,0 +1,47 @@
{ lib, python3Packages, fetchFromGitHub, substituteAll }:
python3Packages.buildPythonPackage rec {
pname = "auto-cpufreq";
version = "1.7.1";
src = fetchFromGitHub {
owner = "AdnanHodzic";
repo = pname;
rev = "v${version}";
sha256 = "1r27ydv258c6pc82za0wq8q8fj0j3r50c8wxc6r7dwr6wx8q3asx";
};
propagatedBuildInputs = with python3Packages; [ click distro psutil ];
doCheck = false;
pythonImportsCheck = [ "auto_cpufreq" ];
patches = [
# hardcodes version output
(substituteAll {
src = ./fix-version-output.patch;
inherit version;
})
# patch to prevent script copying and to disable install
./prevent-install-and-copy.patch
];
postInstall = ''
# copy script manually
cp ${src}/scripts/cpufreqctl.sh $out/bin/cpufreqctl.auto-cpufreq
# systemd service
mkdir -p $out/lib/systemd/system
cp ${src}/scripts/auto-cpufreq.service $out/lib/systemd/system
substituteInPlace $out/lib/systemd/system/auto-cpufreq.service --replace "/usr/local" $out
'';
meta = with lib; {
homepage = "https://github.com/AdnanHodzic/auto-cpufreq";
description = "Automatic CPU speed & power optimizer for Linux";
license = licenses.lgpl3Plus;
platforms = platforms.linux;
maintainers = [ maintainers.Technical27 ];
};
}

View file

@ -0,0 +1,37 @@
--- a/auto_cpufreq/core.py
+++ b/auto_cpufreq/core.py
@@ -68,32 +68,8 @@ dist_name = distro.id()
# display running version of auto-cpufreq
def app_version():
-
- print("auto-cpufreq version:")
-
- # snap package
- if os.getenv("PKG_MARKER") == "SNAP":
- print(getoutput("echo Snap: $SNAP_VERSION"))
- # aur package
- elif dist_name in ["arch", "manjaro", "garuda"]:
- aur_pkg_check = call("pacman -Qs auto-cpufreq > /dev/null", shell=True)
- if aur_pkg_check == 1:
- print(
- "Git commit:",
- check_output(["git", "describe", "--always"]).strip().decode(),
- )
- else:
- print(getoutput("pacman -Qi auto-cpufreq | grep Version"))
- else:
- # source code (auto-cpufreq-installer)
- try:
- print(
- "Git commit:",
- check_output(["git", "describe", "--always"]).strip().decode(),
- )
- except Exception as e:
- print(repr(e))
- pass
+ print("auto-cpufreq version: @version@")
+ print("Git commit: v@version@")
def app_res_use():

View file

@ -0,0 +1,168 @@
diff --git a/auto_cpufreq/core.py b/auto_cpufreq/core.py
index 83d0d64..04b5035 100644
--- a/auto_cpufreq/core.py
+++ b/auto_cpufreq/core.py
@@ -204,35 +204,13 @@ def get_current_gov():
def cpufreqctl():
- """
- deploy cpufreqctl script
- """
-
- # detect if running on a SNAP
- if os.getenv("PKG_MARKER") == "SNAP":
- pass
- else:
- # deploy cpufreqctl.auto-cpufreq script
- if os.path.isfile("/usr/bin/cpufreqctl"):
- shutil.copy(
- SCRIPTS_DIR / "cpufreqctl.sh", "/usr/bin/cpufreqctl.auto-cpufreq"
- )
- else:
- shutil.copy(
- SCRIPTS_DIR / "cpufreqctl.sh", "/usr/bin/cpufreqctl.auto-cpufreq"
- )
+ # scripts are already in the correct place
+ pass
def cpufreqctl_restore():
- """
- remove cpufreqctl.auto-cpufreq script
- """
- # detect if running on a SNAP
- if os.getenv("PKG_MARKER") == "SNAP":
- pass
- else:
- if os.path.isfile("/usr/bin/cpufreqctl.auto-cpufreq"):
- os.remove("/usr/bin/cpufreqctl.auto-cpufreq")
+ # no need to restore
+ pass
def footer(l=79):
@@ -276,76 +254,13 @@ def remove_complete_msg():
def deploy_daemon():
- print("\n" + "-" * 21 + " Deploying auto-cpufreq as a daemon " + "-" * 22 + "\n")
-
- # deploy cpufreqctl script func call
- cpufreqctl()
-
- print("* Turn off bluetooth on boot")
- btconf = Path("/etc/bluetooth/main.conf")
- try:
- orig_set = "AutoEnable=true"
- change_set = "AutoEnable=false"
- with btconf.open(mode="r+") as f:
- content = f.read()
- f.seek(0)
- f.truncate()
- f.write(content.replace(orig_set, change_set))
- except Exception as e:
- print(f"\nERROR:\nWas unable to turn off bluetooth on boot\n{repr(e)}")
-
- 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"
- )
-
- print("\n* Deploy auto-cpufreq remove script")
- shutil.copy(SCRIPTS_DIR / "auto-cpufreq-remove.sh", "/usr/bin/auto-cpufreq-remove")
-
- call("/usr/bin/auto-cpufreq-install", shell=True)
+ # prevent needless copying and system changes
+ pass
# remove auto-cpufreq daemon
def remove():
-
- # check if auto-cpufreq is installed
- if not os.path.exists("/usr/bin/auto-cpufreq-remove"):
- print("\nauto-cpufreq daemon is not installed.\n")
- sys.exit(1)
-
- print("\n" + "-" * 21 + " Removing auto-cpufreq daemon " + "-" * 22 + "\n")
-
- print("* Turn on bluetooth on boot")
- btconf = "/etc/bluetooth/main.conf"
- try:
- orig_set = "AutoEnable=true"
- change_set = "AutoEnable=false"
- with open(btconf, "r+") as f:
- content = f.read()
- f.seek(0)
- f.truncate()
- f.write(content.replace(change_set, orig_set))
- except Exception as e:
- print(f"\nERROR:\nWas unable to turn on bluetooth on boot\n{repr(e)}")
-
- # run auto-cpufreq daemon install script
- call("/usr/bin/auto-cpufreq-remove", shell=True)
-
- # remove auto-cpufreq-remove
- os.remove("/usr/bin/auto-cpufreq-remove")
-
- # delete stats file
- if auto_cpufreq_stats_path.exists():
- if auto_cpufreq_stats_file is not None:
- auto_cpufreq_stats_file.close()
-
- auto_cpufreq_stats_path.unlink()
-
- # restore original cpufrectl script
- cpufreqctl_restore()
-
+ pass
def gov_check():
for gov in get_avail_gov():
diff --git a/scripts/cpufreqctl.sh b/scripts/cpufreqctl.sh
index 63a2b5b..e157efe 100755
--- a/scripts/cpufreqctl.sh
+++ b/scripts/cpufreqctl.sh
@@ -467,35 +467,21 @@ fi
if [ $OPTION = "--install" ]
then
- echo 'installing helpers...'
- cp $0 /usr/bin/
- echo 'installing policy...'
- cp $(dirname "$(readlink -f "$0")")/konkor.cpufreq.policy /usr/share/polkit-1/actions/
- echo 'installing fonts...'
- mkdir -p /usr/share/fonts/truetype/cpufreq
- cp $(dirname "$(readlink -f "$0")")/fonts/cpufreq.ttf /usr/share/fonts/truetype/cpufreq/
- echo "done"
+ echo "install is disabled in the nix package"
exit
fi
if [ $OPTION = "--update-fonts" ]
then
- fc-cache -f
+ echo "update-fonts is disabled in the nix package"
exit
fi
if [ $OPTION = "--uninstall" ]
then
- echo 'uninstalling cpufreqctl helper...'
- rm /usr/bin/cpufreqctl
- echo 'uninstalling policy...'
- rm /usr/share/polkit-1/actions/konkor.cpufreq.policy
- echo 'uninstalling fonts...'
- rm -rf /usr/share/fonts/truetype/cpufreq
- echo "done"
+ echo "uninstall is disabled in the nix package"
exit
fi
if [ $OPTION = "--reset" ]
then
- echo 'reset to default values...'
- dconf reset -f "/org/gnome/shell/extensions/cpufreq/"
+ echo "reset is disabled in the nix package"
exit
fi