-
-
Notifications
You must be signed in to change notification settings - Fork 14.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
emacsPackages: factor out the functions from update-from-overlay
The functions are useful for other purposes too. So, let's put them on `lib-update-scripts.sh`.
- Loading branch information
1 parent
5483039
commit 0b7aacf
Showing
2 changed files
with
46 additions
and
28 deletions.
There are no files selected for viewing
40 changes: 40 additions & 0 deletions
40
pkgs/applications/editors/emacs/elisp-packages/lib-update-scripts.sh
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,40 @@ | ||
#!/usr/bin/env bash | ||
|
||
# This script is a basic library that concentrates the main tasks of bulk updating: | ||
# - download from Emacs overlay | ||
# - test the packageset | ||
# - commit the changes | ||
|
||
SOURCE=${BASH_SOURCE[0]} | ||
# resolve $SOURCE until the file is no longer a symlink | ||
while [ -L "$SOURCE" ]; do | ||
DIR=$( cd -P "$( dirname "$SOURCE" )" >/dev/null 2>&1 && pwd ) | ||
SOURCE=$(readlink "$SOURCE") | ||
# if $SOURCE was a relative symlink, we need to resolve it relative to the | ||
# path where the symlink file was located | ||
[[ $SOURCE != /* ]] && SOURCE=$DIR/$SOURCE | ||
done | ||
DIR=$( cd -P "$( dirname "$SOURCE" )" >/dev/null 2>&1 && pwd ) | ||
|
||
download_change() { | ||
local FILE_LOCATION="$1" | ||
|
||
local BASEURL="https://raw.githubusercontent.com/nix-community/emacs-overlay/master/repos" | ||
|
||
curl -s -O "${BASEURL}/${FILE_LOCATION}" | ||
} | ||
|
||
commit_change() { | ||
local MESSAGE="$1" | ||
local FILENAME="$2" | ||
local FROM="$3" | ||
|
||
git diff --exit-code "${FILENAME}" > /dev/null || \ | ||
git commit -m "${MESSAGE}: updated at $(date --iso) (from ${FROM})" -- "${FILENAME}" | ||
} | ||
|
||
test_packageset(){ | ||
local PKGSET="$1" | ||
|
||
NIXPKGS_ALLOW_BROKEN=1 nix-instantiate --show-trace ${DIR}/../../../../../ -A "emacsPackages.$PKGSET" | ||
} |
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