Add Dothem script
[git/spearce.git] / Dothem
blobdfcf8bcf0a16cda26ec39e1d18dde45eb2149c5e
1 #!/bin/sh
3 : ${J=-j2}
4 : ${BUILDBASE=../buildfarm}
5 : ${branches='next master maint pu jch'}
7 force= with_dash= M= install=
8 while case "$1" in
9 -pedantic) M=$1 ;;
10 -force) force=$1 ;;
11 -dash) with_dash=y ;;
12 -noinstall) install=noinstall ;;
13 *) break ;;
14 esac
16 shift
17 done
18 test -f /bin/dash || with_dash=
20 for branch in $branches
22 echo "** $branch **"
23 revision=$(git show-ref -s --verify "refs/heads/$branch") || {
24 echo "** No $branch"
25 continue
27 test -d "$BUILDBASE/$branch" || {
28 echo "** No $BUILDBASE/$branch"
29 continue
32 private=$(git rev-parse -q --verify private-$branch 2>/dev/null)
33 case $? in 0|1) ;; *) exit $? ;; esac
35 if installed=$($HOME/git-$branch/bin/git version) &&
36 if version=$(expr "$installed" : '.*\.g\([0-9a-f]*\)$')
37 then
39 elif version=v$(expr "$installed" : \
40 'git version \(.*\)\.rc[0-9]*$')
41 then
42 version="$version"-$(expr "$installed" : \
43 'git version .*\.\(rc[0-9]*\)$')
44 else
45 version=v$(expr "$installed" : 'git version \(.*\)')
46 fi &&
47 version=$(git rev-parse --verify "$version^0" 2>/dev/null) &&
48 test "z$version" = "z$revision"
49 then
50 echo "* up-to-date version \"$installed\" is already installed from $branch"
51 test -n "$force" || continue
54 echo "** $branch" &&
57 cd "$BUILDBASE/$branch"
58 git checkout "$branch" &&
59 git reset --hard || exit
60 case "$private" in
61 '')
63 ?*)
64 git merge --squash --no-commit "$private" || {
65 echo >&2 "Cannot apply private edition changes"
66 git reset --hard
69 esac &&
71 case "$with_dash" in
73 case "$branch" in
74 master | maint | next | jch)
75 Meta/Make $M -- $J SHELL_PATH=/bin/dash test
77 esac
79 esac &&
81 Meta/Make $M -- $J all &&
82 Meta/Make $M -- $J test &&
83 case "$branch" in
84 master | maint | next )
85 Meta/Make $M -- doc
87 jch )
88 Meta/Make $M -- doc install-doc
91 : ;;
92 esac &&
94 test z$install = znoinstall ||
95 Meta/Make $M -- install
96 } || exit $?
98 git reset --hard
99 ) || break;
101 done