From 9cace280b0dff7d26bdedd1922465de7665fa04d Mon Sep 17 00:00:00 2001 From: Anderson Torres Date: Fri, 25 Oct 2024 22:05:12 -0300 Subject: [PATCH] emacsPackages: squash elpa and nongnu update scripts Now they can be called via `./update-package-sets `. --- .../editors/emacs/elisp-packages/update-elpa | 6 --- .../emacs/elisp-packages/update-elpa-devel | 6 --- .../emacs/elisp-packages/update-nongnu | 6 --- .../emacs/elisp-packages/update-nongnu-devel | 6 --- .../emacs/elisp-packages/update-package-sets | 49 +++++++++++++++++++ 5 files changed, 49 insertions(+), 24 deletions(-) delete mode 100755 pkgs/applications/editors/emacs/elisp-packages/update-elpa delete mode 100755 pkgs/applications/editors/emacs/elisp-packages/update-elpa-devel delete mode 100755 pkgs/applications/editors/emacs/elisp-packages/update-nongnu delete mode 100755 pkgs/applications/editors/emacs/elisp-packages/update-nongnu-devel create mode 100755 pkgs/applications/editors/emacs/elisp-packages/update-package-sets diff --git a/pkgs/applications/editors/emacs/elisp-packages/update-elpa b/pkgs/applications/editors/emacs/elisp-packages/update-elpa deleted file mode 100755 index 6cf3bafd24e16..0000000000000 --- a/pkgs/applications/editors/emacs/elisp-packages/update-elpa +++ /dev/null @@ -1,6 +0,0 @@ -#! /usr/bin/env nix-shell -#! nix-shell --show-trace ./emacs2nix.nix -i bash - -output="elpa-generated.nix" -elpa-packages.sh --names $EMACS2NIX/names.nix -o "$output" -nixfmt "$output" diff --git a/pkgs/applications/editors/emacs/elisp-packages/update-elpa-devel b/pkgs/applications/editors/emacs/elisp-packages/update-elpa-devel deleted file mode 100755 index 356d93167af88..0000000000000 --- a/pkgs/applications/editors/emacs/elisp-packages/update-elpa-devel +++ /dev/null @@ -1,6 +0,0 @@ -#! /usr/bin/env nix-shell -#! nix-shell --show-trace ./emacs2nix.nix -i bash - -output="elpa-devel-generated.nix" -elpa-devel-packages.sh --names $EMACS2NIX/names.nix -o "$output" -nixfmt "$output" diff --git a/pkgs/applications/editors/emacs/elisp-packages/update-nongnu b/pkgs/applications/editors/emacs/elisp-packages/update-nongnu deleted file mode 100755 index 9a4b20716c152..0000000000000 --- a/pkgs/applications/editors/emacs/elisp-packages/update-nongnu +++ /dev/null @@ -1,6 +0,0 @@ -#! /usr/bin/env nix-shell -#! nix-shell --show-trace ./emacs2nix.nix -i bash - -output="nongnu-generated.nix" -nongnu-packages.sh --names $EMACS2NIX/names.nix -o "$output" -nixfmt "$output" diff --git a/pkgs/applications/editors/emacs/elisp-packages/update-nongnu-devel b/pkgs/applications/editors/emacs/elisp-packages/update-nongnu-devel deleted file mode 100755 index a1f5f950d4387..0000000000000 --- a/pkgs/applications/editors/emacs/elisp-packages/update-nongnu-devel +++ /dev/null @@ -1,6 +0,0 @@ -#! /usr/bin/env nix-shell -#! nix-shell --show-trace ./emacs2nix.nix -i bash - -output="nongnu-devel-generated.nix" -nongnu-devel-packages.sh --names $EMACS2NIX/names.nix -o "$output" -nixfmt "$output" diff --git a/pkgs/applications/editors/emacs/elisp-packages/update-package-sets b/pkgs/applications/editors/emacs/elisp-packages/update-package-sets new file mode 100755 index 0000000000000..c9c6ab570c3d0 --- /dev/null +++ b/pkgs/applications/editors/emacs/elisp-packages/update-package-sets @@ -0,0 +1,49 @@ +#! /usr/bin/env nix-shell +#! nix-shell --show-trace ./emacs2nix.nix -i bash + +usage(){ + local PROGNAME="$1" + + cat<<-EOF +Usage: ${PROGNAME} args +args can be at least one from: elpa-devel, elpa, nongnu-devel, nongnu. +EOF +} + +update_set(){ + local PKGSET="$1" + + local output="${PKGSET}-generated.nix" + local script="${PKGSET}-packages.sh" + + eval "${script} --names ${EMACS2NIX}/names.nix -o ${output}" + nixfmt "${output}" +} + +main(){ + local SETS=( ) + + while (( $# )); do + case $1 in + "elpa-devel" | "elpa" | "nongnu-devel" | "nongnu") + if [[ ! ${SETS[@]} =~ $1 ]]; then + SETS+=( "$1" ) + fi + shift + ;; + *) + echo "Unknown package set: $1" + usage "update-package-sets" + exit 1 + ;; + esac + done + + for SET in "${SETS[@]}"; do + echo "${SET}: updating..." + update_set "${SET}" + echo "${SET}: updated" + done +} + +main "$@"