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 ;;
38 test -f /bin/dash || with_dash=
39 if test -z "$BUILDBASE"
41 if test -d "$inst_prefix/buildfarm"
43 BUILDBASE="$inst_prefix/buildfarm"
44 elif test -d "../buildfarm"
46 BUILDBASE=../buildfarm
48 echo >&2 "Buildbase unknown"
52 test -n "$branches" || branches='next master maint pu jch'
53 test -n "$jobs" || jobs=-j2
55 for branch in $branches
58 revision=$(git show-ref -s --verify "refs/heads/$branch") || {
63 if test ! -d "$BUILDBASE/$branch"
65 if test -z "$bootstrap"
67 echo "** No $BUILDBASE/$branch"
70 "$NWD" . "$BUILDBASE/$branch" $branch &&
71 ln -s "$(pwd)/Meta" "$BUILDBASE/$branch/Meta" || {
72 echo "** Failed to bootstrap $BUILDBASE/$branch"
77 private=$(git rev-parse -q --verify private-$branch 2>/dev/null)
78 case $? in 0|1) ;; *) exit $? ;; esac
80 if test -f "$inst_prefix/git-$branch/bin/git" &&
81 installed=$($inst_prefix/git-$branch/bin/git version) &&
82 if version=$(expr "$installed" : '.*\.g\([0-9a-f]*\)$')
85 elif version=v$(expr "$installed" : \
86 'git version \(.*\)\.rc[0-9]*$')
88 version="$version"-$(expr "$installed" : \
89 'git version .*\.\(rc[0-9]*\)$')
91 version=v$(expr "$installed" : 'git version \(.*\)')
93 version=$(git rev-parse --verify "$version^0" 2>/dev/null) &&
94 test "z$version" = "z$revision"
96 echo "* up-to-date version \"$installed\" is already installed from $branch"
97 test -n "$force" || continue
101 case "$branch, $branches " in
103 if git diff --quiet --exit-code jch next
113 test -z "$notest" || dotest=
115 cd "$BUILDBASE/$branch"
117 case "$(git symbolic-ref HEAD)" in
118 "refs/heads/$branch")
121 git checkout "$branch" &&
122 git reset --hard || exit
129 git merge --squash --no-commit "$private" || {
130 echo >&2 "** Cannot apply private edition changes"
137 test "z$with_dash" != 'zy' ||
138 Meta/Make $M $test -- $jobs SHELL_PATH=/bin/dash $dotest
141 Meta/Make $M $test -- $jobs $dotest &&
144 Meta/Make $M -- doc install-doc
148 test z$install = znoinstall ||
149 Meta/Make $M -- install