3 NWD=contrib/workdir/git-new-workdir
9 probed=${p%/git-active/bin}
10 if test "$probed" != "$p"
19 force= with_dash= M= install= nodoc= notest= bootstrap= branches= jobs=
21 --pedantic | --locale=* | --loose) M="$M $1" ;;
23 --dash) with_dash=y ;;
24 --noinstall) install=noinstall ;;
27 --test=*) test="$1" ;;
28 --bootstrap) bootstrap=y ;;
29 --base=*) BUILDBASE=${1#*=} ;;
30 --branches=*) branches=${1#*=} ;;
32 -*) echo >&2 "Unknown option: $1"; exit 1 ;;
39 sh -c 'asciidoc --version >/dev/null 2>&1' || nodoc=y
41 test -f /bin/dash || with_dash=
42 if test -z "$BUILDBASE"
44 if test -d "$inst_prefix/buildfarm"
46 BUILDBASE="$inst_prefix/buildfarm"
47 elif test -d "../buildfarm"
49 BUILDBASE=../buildfarm
51 echo >&2 "Buildbase unknown"
55 test -n "$branches" || branches='next master maint jch pu'
56 test -n "$jobs" || jobs=-j2
58 for branch in $branches
61 revision=$(git show-ref -s --verify "refs/heads/$branch") || {
66 if test ! -d "$BUILDBASE/$branch"
68 if test -z "$bootstrap"
70 echo "** No $BUILDBASE/$branch"
73 "$NWD" . "$BUILDBASE/$branch" $branch &&
74 ln -s "$(pwd)/Meta" "$BUILDBASE/$branch/Meta" || {
75 echo "** Failed to bootstrap $BUILDBASE/$branch"
80 private=$(git rev-parse -q --verify private-$branch 2>/dev/null)
81 case $? in 0|1) ;; *) exit $? ;; esac
83 if test -f "$inst_prefix/git-$branch/bin/git" &&
84 installed=$($inst_prefix/git-$branch/bin/git version) &&
85 if version=$(expr "$installed" : '.*\.g\([0-9a-f]*\)$')
88 elif version=v$(expr "$installed" : \
89 'git version \(.*\)\.rc[0-9]*$')
91 version="$version"-$(expr "$installed" : \
92 'git version .*\.\(rc[0-9]*\)$')
94 version=v$(expr "$installed" : 'git version \(.*\)')
96 version=$(git rev-parse --verify "$version^0" 2>/dev/null) &&
97 test "z$version" = "z$revision"
99 echo "* up-to-date version \"$installed\" is already installed from $branch"
100 test -n "$force" || continue
104 case "$branch, $branches " in
106 if git diff --quiet --exit-code jch next
116 test -z "$notest" || dotest=
118 cd "$BUILDBASE/$branch"
120 case "$(git symbolic-ref HEAD)" in
121 "refs/heads/$branch")
124 git checkout "$branch" &&
125 git reset --hard || exit
132 git merge --squash --no-commit "$private" || {
133 echo >&2 "** Cannot apply private edition changes"
139 save=$(git rev-parse HEAD) &&
141 test "z$with_dash" != 'zy' ||
142 Meta/Make $M $test -- $jobs SHELL_PATH=/bin/dash $dotest
145 Meta/Make $M $test -- $jobs $dotest &&
148 Meta/Make $M -- doc install-doc
152 test z$install = znoinstall ||
153 if test "$save" = "$(git rev-parse HEAD)"
155 Meta/Make $M -- install
157 echo >&2 "Head moved--not installing"