spacemacs/.circleci/update/upd_built_in

43 lines
1.2 KiB
Bash
Executable File

#!/usr/bin/env bash
## Upd_built_in updater script for Spacemacs' built-in files
##
## Copyright (c) 2014-2021 Sylvain Benner & Contributors
##
## Author: Eugene Yaremenko
## URL: https://github.com/syl20bnr/spacemacs
##
## This file is not part of GNU Emacs.
##
## License: GPLv3
skip_when_non_official_repo
echo_headline "Downloading and replacing files"
built_in_manifest=".ci/built_in_manifest"
lines=$(cat "${built_in_manifest}")
while read line; do
url=$(echo $line | cut -f1 -d " ")
target=$(echo $line | cut -f2 -d " ")
curl "${url}" --output "${target}"
if [ $? -ne 0 ]; then
echo "Failed to update built in file: ${target} from url: ${url}"
echo "Please update manifest file: ~/.emacs.d/.ci/built_in_manifest"
exit 2
fi
done <"${built_in_manifest}"
git add --all
git commit -m "Built-in files auto-update: $(date -u)"
if [ $? -ne 0 ]; then
echo "Built-in files don't need an update."
exit 0
else
git format-patch -1 HEAD --stdout > /tmp/built_in.patch
if [ $? -ne 0 ]; then
echo "Failed to create built-in patch file."
exit 2
fi
git reset --hard HEAD~1
cat /tmp/built_in.patch
fi