Add support for local settings in the Git jobs
This commit is contained in:
parent
e7b4f70c44
commit
73a95e5c92
|
@ -28,13 +28,8 @@
|
||||||
|
|
||||||
#variables
|
#variables
|
||||||
PREFIX="/usr/local"
|
PREFIX="/usr/local"
|
||||||
GIT_BRANCH="master"
|
|
||||||
GIT_REMOTE="https://git.defora.org"
|
|
||||||
DATADIR="$PREFIX/share"
|
|
||||||
MIRROR="doc:doc"
|
|
||||||
PROGNAME_GIT_DOC="deforaos-git-doc"
|
|
||||||
#executables
|
#executables
|
||||||
CONFIGURE="/usr/local/bin/configure"
|
CONFIGURE="configure"
|
||||||
GIT="git"
|
GIT="git"
|
||||||
GIT_CLONE="$GIT clone -q"
|
GIT_CLONE="$GIT clone -q"
|
||||||
GIT_SUBMODULE="$GIT submodule -q"
|
GIT_SUBMODULE="$GIT submodule -q"
|
||||||
|
@ -42,6 +37,18 @@ MAKE="make"
|
||||||
MKTEMP="mktemp"
|
MKTEMP="mktemp"
|
||||||
RM="/bin/rm -f"
|
RM="/bin/rm -f"
|
||||||
RSYNC="rsync -a"
|
RSYNC="rsync -a"
|
||||||
|
#settings
|
||||||
|
DATADIR="$PREFIX/share"
|
||||||
|
GIT_BRANCH="master"
|
||||||
|
GIT_REMOTE=
|
||||||
|
MIRROR="doc:doc"
|
||||||
|
PROGNAME="deforaos-git-doc"
|
||||||
|
SYSCONFDIR="$PREFIX/etc"
|
||||||
|
#load local settings
|
||||||
|
[ -f "$SYSCONFDIR/DeforaOS/$PROGNAME.conf" ] &&
|
||||||
|
. "$SYSCONFDIR/DeforaOS/$PROGNAME.conf"
|
||||||
|
[ -f "$HOME/.config/DeforaOS/$PROGNAME.conf" ] &&
|
||||||
|
. "$HOME/.config/DeforaOS/$PROGNAME.conf"
|
||||||
|
|
||||||
|
|
||||||
#functions
|
#functions
|
||||||
|
@ -58,7 +65,7 @@ _git_tests()
|
||||||
fi
|
fi
|
||||||
#clone the repository
|
#clone the repository
|
||||||
$GIT_CLONE --single-branch -b "$GIT_BRANCH" \
|
$GIT_CLONE --single-branch -b "$GIT_BRANCH" \
|
||||||
"$GIT_REMOTE/${repository}.git" "$tmpdir/repository"
|
"$GIT_REMOTE${repository}.git" "$tmpdir/repository"
|
||||||
if [ $? -ne 0 ]; then
|
if [ $? -ne 0 ]; then
|
||||||
echo "$repository: Could not clone" 1>&2
|
echo "$repository: Could not clone" 1>&2
|
||||||
elif [ -d "$tmpdir/repository/doc" ]; then
|
elif [ -d "$tmpdir/repository/doc" ]; then
|
||||||
|
@ -87,12 +94,24 @@ _git_tests()
|
||||||
#usage
|
#usage
|
||||||
_usage()
|
_usage()
|
||||||
{
|
{
|
||||||
echo "Usage: $PROGNAME_GIT_DOC repository" 1>&2
|
echo "Usage: $PROGNAME repository" 1>&2
|
||||||
return 1
|
return 1
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#main
|
#main
|
||||||
|
while getopts "O:" name; do
|
||||||
|
case "$name" in
|
||||||
|
O)
|
||||||
|
export "${OPTARG%%=*}"="${OPTARG#*=}"
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
_usage
|
||||||
|
exit $?
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
done
|
||||||
|
shift $((OPTIND - 1))
|
||||||
if [ $# -ne 1 ]; then
|
if [ $# -ne 1 ]; then
|
||||||
_usage
|
_usage
|
||||||
exit $?
|
exit $?
|
||||||
|
|
|
@ -27,14 +27,22 @@
|
||||||
|
|
||||||
|
|
||||||
#variables
|
#variables
|
||||||
GIT_MIRROR="/home/defora/git"
|
|
||||||
GIT_REMOTE="origin"
|
|
||||||
PROGNAME_GIT_MIRROR="deforaos-git-mirror.sh"
|
|
||||||
#executables
|
#executables
|
||||||
GIT="git"
|
GIT="git"
|
||||||
GIT_CLONE="$GIT clone -q"
|
GIT_CLONE="$GIT clone -q"
|
||||||
GIT_FETCH="$GIT fetch -q"
|
GIT_FETCH="$GIT fetch -q"
|
||||||
GIT_RESET="$GIT reset -q"
|
GIT_RESET="$GIT reset -q"
|
||||||
|
GIT_MIRROR=
|
||||||
|
GIT_REMOTE="origin"
|
||||||
|
#settings
|
||||||
|
PREFIX="/usr/local"
|
||||||
|
PROGNAME="deforaos-git-mirror"
|
||||||
|
SYSCONFDIR="$PREFIX/etc"
|
||||||
|
#load local settings
|
||||||
|
[ -f "$SYSCONFDIR/DeforaOS/$PROGNAME.conf" ] &&
|
||||||
|
. "$SYSCONFDIR/DeforaOS/$PROGNAME.conf"
|
||||||
|
[ -f "$HOME/.config/DeforaOS/$PROGNAME.conf" ] &&
|
||||||
|
. "$HOME/.config/DeforaOS/$PROGNAME.conf"
|
||||||
|
|
||||||
|
|
||||||
#functions
|
#functions
|
||||||
|
@ -42,7 +50,7 @@ GIT_RESET="$GIT reset -q"
|
||||||
_git_mirror()
|
_git_mirror()
|
||||||
{
|
{
|
||||||
repository="$1"
|
repository="$1"
|
||||||
mirror="$GIT_MIRROR/${repository}.git"
|
mirror="$GIT_MIRROR${repository}.git"
|
||||||
|
|
||||||
if [ ! -d "$mirror" ]; then
|
if [ ! -d "$mirror" ]; then
|
||||||
#clone the repository
|
#clone the repository
|
||||||
|
@ -62,12 +70,24 @@ _git_mirror()
|
||||||
#usage
|
#usage
|
||||||
_usage()
|
_usage()
|
||||||
{
|
{
|
||||||
echo "Usage: $PROGNAME_GIT_MIRROR repository" 1>&2
|
echo "Usage: $PROGNAME repository" 1>&2
|
||||||
return 1
|
return 1
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#main
|
#main
|
||||||
|
while getopts "O:" name; do
|
||||||
|
case "$name" in
|
||||||
|
O)
|
||||||
|
export "${OPTARG%%=*}"="${OPTARG#*=}"
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
_usage
|
||||||
|
exit $?
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
done
|
||||||
|
shift $((OPTIND - 1))
|
||||||
if [ $# -ne 1 ]; then
|
if [ $# -ne 1 ]; then
|
||||||
_usage
|
_usage
|
||||||
exit $?
|
exit $?
|
||||||
|
|
|
@ -27,17 +27,25 @@
|
||||||
|
|
||||||
|
|
||||||
#variables
|
#variables
|
||||||
GIT_BRANCH="master"
|
|
||||||
GIT_REMOTE="https://git.defora.org"
|
|
||||||
PROGNAME_GIT_TESTS="deforaos-git-tests.sh"
|
|
||||||
#executables
|
#executables
|
||||||
CONFIGURE="/usr/local/bin/configure"
|
CONFIGURE="configure"
|
||||||
GIT="git"
|
GIT="git"
|
||||||
GIT_CLONE="$GIT clone -q"
|
GIT_CLONE="$GIT clone -q"
|
||||||
GIT_SUBMODULE="$GIT submodule -q"
|
GIT_SUBMODULE="$GIT submodule -q"
|
||||||
MAKE="make"
|
MAKE="make"
|
||||||
MKTEMP="mktemp"
|
MKTEMP="mktemp"
|
||||||
RM="/bin/rm -f"
|
RM="rm -f"
|
||||||
|
#settings
|
||||||
|
GIT_BRANCH="master"
|
||||||
|
GIT_REMOTE=
|
||||||
|
PREFIX="/usr/local"
|
||||||
|
PROGNAME="deforaos-git-tests"
|
||||||
|
SYSCONFDIR="$PREFIX/etc"
|
||||||
|
#load local settings
|
||||||
|
[ -f "$SYSCONFDIR/DeforaOS/$PROGNAME.conf" ] &&
|
||||||
|
. "$SYSCONFDIR/DeforaOS/$PROGNAME.conf"
|
||||||
|
[ -f "$HOME/.config/DeforaOS/$PROGNAME.conf" ] &&
|
||||||
|
. "$HOME/.config/DeforaOS/$PROGNAME.conf"
|
||||||
|
|
||||||
|
|
||||||
#functions
|
#functions
|
||||||
|
@ -54,15 +62,15 @@ _git_tests()
|
||||||
fi
|
fi
|
||||||
#clone the repository
|
#clone the repository
|
||||||
$GIT_CLONE --single-branch -b "$GIT_BRANCH" \
|
$GIT_CLONE --single-branch -b "$GIT_BRANCH" \
|
||||||
"$GIT_REMOTE/${repository}.git" "$tmpdir"
|
"$GIT_REMOTE${repository}.git" "$tmpdir"
|
||||||
if [ $? -ne 0 ]; then
|
if [ $? -ne 0 ]; then
|
||||||
echo "$repository: Could not clone" 1>&2
|
echo "$repository: Could not clone" 1>&2
|
||||||
elif [ -d "$tmpdir/tests" ]; then
|
elif [ -d "$tmpdir/tests" ]; then
|
||||||
#update submodules if any
|
#update submodules if any
|
||||||
[ -f "$tmpdir/repository/.gitmodules" ] &&
|
[ -f "$tmpdir/repository/.gitmodules" ] &&
|
||||||
(cd "$tmpdir/repository" &&
|
(cd "$tmpdir/repository" &&
|
||||||
$GIT submodule init &&
|
$GIT_SUBMODULE init &&
|
||||||
$GIT submodule update)
|
$GIT_SUBMODULE update)
|
||||||
#run tests if available
|
#run tests if available
|
||||||
(cd "$tmpdir" && $CONFIGURE && $MAKE tests) || ret=2
|
(cd "$tmpdir" && $CONFIGURE && $MAKE tests) || ret=2
|
||||||
fi
|
fi
|
||||||
|
@ -75,12 +83,24 @@ _git_tests()
|
||||||
#usage
|
#usage
|
||||||
_usage()
|
_usage()
|
||||||
{
|
{
|
||||||
echo "Usage: $PROGNAME_GIT_TESTS repository" 1>&2
|
echo "Usage: $PROGNAME repository" 1>&2
|
||||||
return 1
|
return 1
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#main
|
#main
|
||||||
|
while getopts "O:" name; do
|
||||||
|
case "$name" in
|
||||||
|
O)
|
||||||
|
export "${OPTARG%%=*}"="${OPTARG#*=}"
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
_usage
|
||||||
|
exit $?
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
done
|
||||||
|
shift $((OPTIND - 1))
|
||||||
if [ $# -ne 1 ]; then
|
if [ $# -ne 1 ]; then
|
||||||
_usage
|
_usage
|
||||||
exit $?
|
exit $?
|
||||||
|
|
Loading…
Reference in New Issue
Block a user