Move git hooks to start of bootstrap.

Signed-off-by: Morgan Tocker <tocker@gmail.com>
This commit is contained in:
Morgan Tocker 2019-08-13 13:46:21 -06:00
Родитель 4602af6931
Коммит 5b76ff2eed
1 изменённых файлов: 10 добавлений и 30 удалений

Просмотреть файл

@ -21,7 +21,6 @@
# 1. Installation of dependencies.
# 2. Installation of Go tools and vendored Go dependencies.
# 3. Detection of installed MySQL and setting MYSQL_FLAVOR.
# 4. Installation of development related steps e.g. creating Git hooks.
BUILD_TESTS=${BUILD_TESTS:-1}
BUILD_PYTHON=${BUILD_PYTHON:-1}
@ -31,15 +30,6 @@ BUILD_JAVA=${BUILD_JAVA:-1}
# 0. Initialization and helper methods.
#
# Run parallel make, based on number of cores available.
case $(uname) in
Linux) NB_CORES=$(grep -c '^processor' /proc/cpuinfo);;
Darwin) NB_CORES=$(sysctl hw.ncpu | awk '{ print $2 }');;
esac
if [ -n "$NB_CORES" ]; then
export MAKEFLAGS="-j$((NB_CORES+1)) -l${NB_CORES}"
fi
function fail() {
echo "ERROR: $1"
exit 1
@ -56,6 +46,14 @@ mkdir -p "$VTROOT/bin"
mkdir -p "$VTROOT/lib"
mkdir -p "$VTROOT/vthook"
# Install git hooks.
echo "creating git hooks"
mkdir -p "$VTTOP/.git/hooks"
ln -sf "$VTTOP/misc/git/pre-commit" "$VTTOP/.git/hooks/pre-commit"
ln -sf "$VTTOP/misc/git/commit-msg" "$VTTOP/.git/hooks/commit-msg"
(cd "$VTTOP" && git config core.hooksPath "$VTTOP/.git/hooks")
# Set up the proper GOPATH for go get below.
if [ "$BUILD_TESTS" == 1 ] ; then
source ./dev.env
@ -369,23 +367,5 @@ if [ "$BUILD_PYTHON" == 1 ] ; then
PYTHONPATH='' $PIP install mysql-connector-python
fi
#
# 4. Installation of development related steps e.g. creating Git hooks.
#
if [ "$BUILD_TESTS" == 1 ] ; then
# Create the Git hooks.
echo "creating git hooks"
mkdir -p "$VTTOP/.git/hooks"
ln -sf "$VTTOP/misc/git/pre-commit" "$VTTOP/.git/hooks/pre-commit"
ln -sf "$VTTOP/misc/git/prepare-commit-msg.bugnumber" "$VTTOP/.git/hooks/prepare-commit-msg"
ln -sf "$VTTOP/misc/git/commit-msg" "$VTTOP/.git/hooks/commit-msg"
(cd "$VTTOP" && git config core.hooksPath "$VTTOP/.git/hooks")
echo
echo "bootstrap finished - run 'source dev.env' in your shell before building."
else
echo
echo "bootstrap finished - run 'source build.env' in your shell before building."
fi
echo
echo "bootstrap finished - run 'source dev.build' or 'source build.env' in your shell before building."