-
-
Notifications
You must be signed in to change notification settings - Fork 14.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
emacsPackages: combine elpa-* and nongnu-* update scripts
They are identical except for the parameters they use. Let's merge them in a single script. Now they can be called via `./update-package-sets <package sets>`.
- Loading branch information
1 parent
284fb15
commit d755534
Showing
5 changed files
with
54 additions
and
24 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
6 changes: 0 additions & 6 deletions
6
pkgs/applications/editors/emacs/elisp-packages/update-elpa-devel
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
6 changes: 0 additions & 6 deletions
6
pkgs/applications/editors/emacs/elisp-packages/update-nongnu-devel
This file was deleted.
Oops, something went wrong.
54 changes: 54 additions & 0 deletions
54
pkgs/applications/editors/emacs/elisp-packages/update-package-sets
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
#! /usr/bin/env nix-shell | ||
#! nix-shell --show-trace ./emacs2nix.nix -i bash | ||
|
||
usage(){ | ||
cat<<-EOF | ||
Usage: update-package-sets 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") | ||
# Do not include duplicates | ||
if [[ ! ${SETS[@]} =~ $1 ]]; then | ||
SETS+=( "$1" ) | ||
fi | ||
shift | ||
;; | ||
"melpa" | "melpa-stable") | ||
# Let's warn the user of the correct script and go on | ||
echo "This script does not generate the MELPA package set." | ||
echo "Use update-melpa script instead." | ||
shift | ||
;; | ||
*) | ||
echo "Unknown package set: $1" | ||
usage | ||
exit 1 | ||
;; | ||
esac | ||
done | ||
|
||
for SET in "${SETS[@]}"; do | ||
echo "${SET}: updating..." | ||
update_set "${SET}" | ||
echo "${SET}: updated" | ||
done | ||
} | ||
|
||
main "$@" |