Loading configure.ac +1 −1 Original line number Diff line number Diff line Loading @@ -15,7 +15,7 @@ # along with this program. If not, see <http://www.gnu.org/licenses/>. # AC_INIT([git-hooks], [0.1.6]) AC_INIT([git-hooks], [0.1.7]) AM_INIT_AUTOMAKE gitcoredir=`git --exec-path` Loading git-hooks +5 −2 Original line number Diff line number Diff line Loading @@ -19,8 +19,11 @@ set -e real_path(){(cd "`dirname "$1"`" && pwd -P | tr \\n / && basename "$1")} # LIBDIR & HOOKDIR are populated by the install script LIBDIR=`readlink -f $(dirname $0)` LIBDIR=`real_path $(dirname $0)` HOOKDIR="$LIBDIR/hook-scripts" source "$LIBDIR"/string_functions Loading @@ -29,7 +32,7 @@ source "$LIBDIR"/arg_parse_functions BIN=`basename "$0"` GIT="git ${GIT_DIR+--git-dir "${GIT_DIR}"}" GIT_DIR="${GIT_DIR:-`git rev-parse --git-dir`}" GIT_DIR=`readlink -f "$GIT_DIR"` GIT_DIR=`real_path "$GIT_DIR"` GIT_CONFIG="${GIT_CORE:+$GIT_CORE/git-config}" GIT_CONFIG="${GIT_CONFIG:-git config}" HOOKS="update pre-receive post-receive" Loading hook-scripts/post-receive/auto-build +27 −8 Original line number Diff line number Diff line #! /bin/bash # # Copyright (C) 2013 Dom Sekotill # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program. If not, see <http://www.gnu.org/licenses/>. # umask 0002 real_path(){(cd "`dirname "$1"`" && pwd -P | tr \\n / && basename "$1")} config () { git config --get auto-build`printf ".%s" "$@"`; } config-all () { git config --get-all auto-build`printf ".%s" "$@"`; } Loading Loading @@ -83,7 +102,7 @@ _get_config_section () set -o noglob IFS=$'\n' sections=( `git config --list \ | grep -e '^auto-build' \ | sed -e 's/=.*//' -e 's/\.[^.]*$//' -e 's/^auto-build\.\?//' \ | sed -e 's/=.*//' -e 's/\.[^.]*$//' -e 's/^auto-build\.\{0,1\}//' \ | sort -ur ` ) set +o noglob Loading Loading @@ -166,19 +185,19 @@ build () local profile cmd pattern replace_cmd local i dir lock files file dest=`readlink -f "$dest"` dest=`real_path "$dest"` # make sure we start in $GIT_DIR if [ "$GIT_DIR" ]; then cd "$GIT_DIR" export GIT_DIR=`readlink -f "$GIT_DIR"` export GIT_DIR=`real_path "$GIT_DIR"` fi # lock the build dir mkdir -p "`dirname "$dbuild".`" mkdir -p "`dirname "$dbuild".`" --mode 777 while true; do for i in `seq 1 $dmax`; do dir=`readlink -f "$dbuild$i"` dir=`real_path "$dbuild$i"` lock="$dir.lock" until _acquired_lock "$lock"; do _clear_stale_lock "$lock" || break Loading @@ -188,7 +207,7 @@ build () _acquired_lock "$lock" && break sleep 4 done trap "[ -e '$dir' ] && rm -r '$dir'; [ -L '$lock' ] && rm '$lock'" \ trap "[ -e '$dir' ] && rm -rf '$dir'; [ -L '$lock' ] && rm '$lock'" \ RETURN EXIT # create the build dir if it does not exist & remove any stickbits set by Loading Loading @@ -227,7 +246,7 @@ build () # normalise $cmd pushd "$GIT_DIR" >/dev/null eval "cmd=( $cmd )" cmd[0]=`readlink -e "${cmd[0]}" || echo "${cmd[0]}"` cmd[0]=`real_path "${cmd[0]}" || echo "${cmd[0]}"` popd >/dev/null # run the build command Loading Loading @@ -277,7 +296,7 @@ main () mkdir -p "$log_dir" [ -e "$log_current" ] && rm "$log_current" || true ln -s `basename "$log"` "$log_current" build "$ref" "$new" </dev/null &>>"$log" & build "$ref" "$new" </dev/null >>"$log" 2>&1 & fi done } Loading Loading
configure.ac +1 −1 Original line number Diff line number Diff line Loading @@ -15,7 +15,7 @@ # along with this program. If not, see <http://www.gnu.org/licenses/>. # AC_INIT([git-hooks], [0.1.6]) AC_INIT([git-hooks], [0.1.7]) AM_INIT_AUTOMAKE gitcoredir=`git --exec-path` Loading
git-hooks +5 −2 Original line number Diff line number Diff line Loading @@ -19,8 +19,11 @@ set -e real_path(){(cd "`dirname "$1"`" && pwd -P | tr \\n / && basename "$1")} # LIBDIR & HOOKDIR are populated by the install script LIBDIR=`readlink -f $(dirname $0)` LIBDIR=`real_path $(dirname $0)` HOOKDIR="$LIBDIR/hook-scripts" source "$LIBDIR"/string_functions Loading @@ -29,7 +32,7 @@ source "$LIBDIR"/arg_parse_functions BIN=`basename "$0"` GIT="git ${GIT_DIR+--git-dir "${GIT_DIR}"}" GIT_DIR="${GIT_DIR:-`git rev-parse --git-dir`}" GIT_DIR=`readlink -f "$GIT_DIR"` GIT_DIR=`real_path "$GIT_DIR"` GIT_CONFIG="${GIT_CORE:+$GIT_CORE/git-config}" GIT_CONFIG="${GIT_CONFIG:-git config}" HOOKS="update pre-receive post-receive" Loading
hook-scripts/post-receive/auto-build +27 −8 Original line number Diff line number Diff line #! /bin/bash # # Copyright (C) 2013 Dom Sekotill # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program. If not, see <http://www.gnu.org/licenses/>. # umask 0002 real_path(){(cd "`dirname "$1"`" && pwd -P | tr \\n / && basename "$1")} config () { git config --get auto-build`printf ".%s" "$@"`; } config-all () { git config --get-all auto-build`printf ".%s" "$@"`; } Loading Loading @@ -83,7 +102,7 @@ _get_config_section () set -o noglob IFS=$'\n' sections=( `git config --list \ | grep -e '^auto-build' \ | sed -e 's/=.*//' -e 's/\.[^.]*$//' -e 's/^auto-build\.\?//' \ | sed -e 's/=.*//' -e 's/\.[^.]*$//' -e 's/^auto-build\.\{0,1\}//' \ | sort -ur ` ) set +o noglob Loading Loading @@ -166,19 +185,19 @@ build () local profile cmd pattern replace_cmd local i dir lock files file dest=`readlink -f "$dest"` dest=`real_path "$dest"` # make sure we start in $GIT_DIR if [ "$GIT_DIR" ]; then cd "$GIT_DIR" export GIT_DIR=`readlink -f "$GIT_DIR"` export GIT_DIR=`real_path "$GIT_DIR"` fi # lock the build dir mkdir -p "`dirname "$dbuild".`" mkdir -p "`dirname "$dbuild".`" --mode 777 while true; do for i in `seq 1 $dmax`; do dir=`readlink -f "$dbuild$i"` dir=`real_path "$dbuild$i"` lock="$dir.lock" until _acquired_lock "$lock"; do _clear_stale_lock "$lock" || break Loading @@ -188,7 +207,7 @@ build () _acquired_lock "$lock" && break sleep 4 done trap "[ -e '$dir' ] && rm -r '$dir'; [ -L '$lock' ] && rm '$lock'" \ trap "[ -e '$dir' ] && rm -rf '$dir'; [ -L '$lock' ] && rm '$lock'" \ RETURN EXIT # create the build dir if it does not exist & remove any stickbits set by Loading Loading @@ -227,7 +246,7 @@ build () # normalise $cmd pushd "$GIT_DIR" >/dev/null eval "cmd=( $cmd )" cmd[0]=`readlink -e "${cmd[0]}" || echo "${cmd[0]}"` cmd[0]=`real_path "${cmd[0]}" || echo "${cmd[0]}"` popd >/dev/null # run the build command Loading Loading @@ -277,7 +296,7 @@ main () mkdir -p "$log_dir" [ -e "$log_current" ] && rm "$log_current" || true ln -s `basename "$log"` "$log_current" build "$ref" "$new" </dev/null &>>"$log" & build "$ref" "$new" </dev/null >>"$log" 2>&1 & fi done } Loading