git/Dothem

178 lines
3.5 KiB
Plaintext
Raw Normal View History

#!/bin/sh
2009-04-19 12:12:57 +00:00
NWD=contrib/workdir/git-new-workdir
2009-04-26 05:05:45 +00:00
inst_prefix=$(
IFS=:
for p in $PATH
do
probed=${p%/git-active/bin}
if test "$probed" != "$p"
then
echo "$probed"
exit
fi
done
echo $HOME
)
force= with_dash= M= install= nodoc= notest= bootstrap= branches= jobs=
2009-10-12 00:22:32 +00:00
scratch=
while case "$1" in
2009-04-30 05:11:24 +00:00
--pedantic | --locale=* | --loose) M="$M $1" ;;
2009-04-19 12:12:57 +00:00
--force) force=$1 ;;
--dash) with_dash=y ;;
--noinstall) install=noinstall ;;
--nodoc) nodoc=y ;;
--notest) notest=y ;;
2009-05-17 07:54:38 +00:00
--test=*) test="$1" ;;
2009-10-12 00:22:32 +00:00
--scratch) scratch=y ;;
2009-04-19 12:12:57 +00:00
--bootstrap) bootstrap=y ;;
--base=*) BUILDBASE=${1#*=} ;;
--branches=*) branches=${1#*=} ;;
-j*) jobs=$1 ;;
2009-04-19 23:08:03 +00:00
-*) echo >&2 "Unknown option: $1"; exit 1 ;;
*) break ;;
esac
do
shift
done
2009-07-06 17:05:17 +00:00
sh -c 'asciidoc --version >/dev/null 2>&1' || nodoc=y
test -f /bin/dash || with_dash=
if test -z "$BUILDBASE"
then
if test -d "$inst_prefix/buildfarm"
then
BUILDBASE="$inst_prefix/buildfarm"
elif test -d "../buildfarm"
then
BUILDBASE=../buildfarm
else
echo >&2 "Buildbase unknown"
exit 1
fi
fi
2009-09-08 00:51:24 +00:00
test -n "$branches" || branches='next master maint jch pu'
2009-04-19 12:12:57 +00:00
test -n "$jobs" || jobs=-j2
for branch in $branches
do
echo "** $branch **"
revision=$(git show-ref -s --verify "refs/heads/$branch") || {
echo "** No $branch"
continue
}
2009-04-19 12:12:57 +00:00
if test ! -d "$BUILDBASE/$branch"
then
if test -z "$bootstrap"
then
echo "** No $BUILDBASE/$branch"
continue
fi
"$NWD" . "$BUILDBASE/$branch" $branch &&
ln -s "$(pwd)/Meta" "$BUILDBASE/$branch/Meta" || {
2009-04-19 12:12:57 +00:00
echo "** Failed to bootstrap $BUILDBASE/$branch"
continue
}
fi
private=$(git rev-parse -q --verify private-$branch 2>/dev/null)
case $? in 0|1) ;; *) exit $? ;; esac
2009-04-26 05:05:45 +00:00
if test -f "$inst_prefix/git-$branch/bin/git" &&
installed=$($inst_prefix/git-$branch/bin/git version) &&
if version=$(expr "$installed" : '.*\.g\([0-9a-f]*\)$')
then
:
elif version=v$(expr "$installed" : \
'git version \(.*\)\.rc[0-9]*$')
then
version="$version"-$(expr "$installed" : \
'git version .*\.\(rc[0-9]*\)$')
else
version=v$(expr "$installed" : 'git version \(.*\)')
fi &&
version=$(git rev-parse --verify "$version^0" 2>/dev/null) &&
test "z$version" = "z$revision"
then
echo "* up-to-date version \"$installed\" is already installed from $branch"
test -n "$force" || continue
fi
(
2009-03-06 08:24:33 +00:00
case "$branch, $branches " in
jch,*' next '*)
if git diff --quiet --exit-code jch next
then
dotest=
else
dotest=test
fi
;;
2009-03-06 08:24:33 +00:00
*)
dotest=test ;;
esac
test -z "$notest" || dotest=
2009-03-06 08:24:33 +00:00
cd "$BUILDBASE/$branch"
git reset --hard &&
2009-04-19 12:12:57 +00:00
case "$(git symbolic-ref HEAD)" in
"refs/heads/$branch")
: ;;
*)
git checkout "$branch" &&
git reset --hard || exit
esac &&
2009-10-12 00:22:32 +00:00
case "$scratch" in
'')
;;
y)
Meta/Make clean
;;
esac &&
case "$private" in
'')
;;
?*)
git merge --squash --no-commit "$private" || {
2009-04-19 12:12:57 +00:00
echo >&2 "** Cannot apply private edition changes"
git reset --hard
}
;;
esac &&
2009-09-08 00:51:24 +00:00
save=$(git rev-parse HEAD) &&
2010-01-06 08:31:20 +00:00
Meta/Make $M ${test+"$test"} $jobs -- ${with_dash:+SHELL_PATH=/bin/dash} $dotest &&
2010-01-06 08:31:20 +00:00
{
test -n "$nodoc" ||
2010-01-06 08:31:20 +00:00
if test "$save" = "$(git rev-parse HEAD)"
then
Meta/Make $M $jobs -- doc &&
2010-01-06 08:31:20 +00:00
Meta/Make $M -- install-man install-html
else
echo >&2 "Head moved--not installing docs"
fi
} &&
2009-04-19 12:12:57 +00:00
{
test z$install = znoinstall ||
2009-09-08 00:51:24 +00:00
if test "$save" = "$(git rev-parse HEAD)"
then
Meta/Make $M -- install
else
echo >&2 "Head moved--not installing"
fi
} || exit $?
git reset --hard
) </dev/null || exit $?
done