3 NWD=contrib/workdir/git-new-workdir
10 probed=${p%/git-active/bin}
11 if test "$probed" != "$p"
20 force= with_dash= test_long= M= install= nodoc= notest= bootstrap= branches= jobs=
21 scratch= noprove= memtrash=--memtrash with_cocci=
23 --pedantic | --locale=* | --loose) M="$M $1" ;;
25 --dash) with_dash=y ;;
26 --cocci) with_cocci=y ;;
27 --no-cocci) with_cocci= ;;
28 --long) test_long=--long ;;
29 --noinstall) install=noinstall ;;
32 --nomemtrash) memtrash= ;;
33 --memtrash) memtrash=--memtrash ;;
34 --test=*) test="$1" ;;
35 --scratch) scratch=y ;;
36 --bootstrap) bootstrap=y ;;
37 --base=*) BUILDBASE=${1#*=} ;;
38 --branches=*) branches=${1#*=} ;;
39 --noprove) noprove=$1 ;;
42 -*) echo >&2 "Unknown option: $1"; exit 1 ;;
49 sh -c 'asciidoc --version >/dev/null 2>&1' || nodoc=y
52 export GIT_TEST_CHAIN_LINT
54 GIT_PROVE_OPTS="${GIT_PROVE_OPTS:+$GIT_PROVE_OPTS }--state=slow,save"
57 test -f /bin/dash || with_dash=
58 if test -z "$BUILDBASE"
60 if test -d "$inst_prefix/buildfarm"
62 BUILDBASE="$inst_prefix/buildfarm"
63 elif test -d "../buildfarm"
65 BUILDBASE=../buildfarm
67 echo >&2 "Buildbase unknown"
71 test -n "$branches" || branches="next $MASTER maint jch seen"
72 test -n "$jobs" || jobs=-j2
76 test -f "$inst_prefix/git-$branch/bin/git" &&
77 installed=$($inst_prefix/git-$branch/bin/git version) &&
78 if version=$(expr "$installed" : '.*\.g\([0-9a-f]*\)$')
81 elif version=v$(expr "$installed" : \
82 'git version \(.*\)\.rc[0-9]*$')
84 version="$version"-$(expr "$installed" : \
85 'git version .*\.\(rc[0-9]*\)$')
87 version=v$(expr "$installed" : 'git version \(.*\)')
89 git rev-parse --verify "$version^0" 2>/dev/null
92 installed_source_trees=" "
93 for branch in $branches
95 if v=$(find_installed $branch) &&
97 v=$(git rev-parse --verify "$v^{tree}" 2>/dev/null)
99 installed_source_trees="$installed_source_trees$v "
103 for branch in $branches
106 revision=$(git show-ref -s --verify "refs/heads/$branch") || {
111 if test ! -d "$BUILDBASE/$branch"
113 if test -z "$bootstrap"
115 echo "** No $BUILDBASE/$branch"
118 "$NWD" . "$BUILDBASE/$branch" $branch &&
119 ln -s "$(pwd)/Meta" "$BUILDBASE/$branch/Meta" || {
120 echo "** Failed to bootstrap $BUILDBASE/$branch"
125 private=$(git rev-parse -q --verify private-$branch 2>/dev/null)
126 case $? in 0|1) ;; *) exit $? ;; esac
128 version=$(find_installed $branch)
129 if test "z$version" = "z$revision"
131 echo "* up-to-date version is already installed from $branch"
132 test -n "$force" || continue
135 vtree=$(git rev-parse --verify "$version^{tree}")
136 rtree=$(git rev-parse --verify "$revision^{tree}")
138 skip_test=$notest skip_doc=$nodoc
143 for xtree in $installed_source_trees $vtree
145 if test "z$xtree" = "z$rtree" ||
146 git diff --quiet "$xtree" "$rtree" -- . \
147 ':!GIT-VERSION-GEN' \
156 dvtree=$(git rev-parse --verify "$version:Documentation/")
157 drtree=$(git rev-parse --verify "$revision:Documentation/")
158 if test "z$dvtree" = "z$drtree"
170 cd "$BUILDBASE/$branch"
177 saveMeta=$(readlink Meta)
180 ln -s "$saveMeta" Meta
184 case "$(git symbolic-ref HEAD)" in
185 "refs/heads/$branch")
188 git checkout "$branch" &&
189 git reset --hard || exit
196 git merge --squash --no-commit "$private" || {
197 echo >&2 "** Cannot apply private edition changes"
203 save=$(git rev-parse HEAD) &&
205 if test -n "$with_cocci"
207 Meta/Make $M $jobs -- coccicheck
210 Meta/Make $M $jobs -- SPARSE_FLAGS=-Wsparse-error sparse &&
212 Meta/Make $M $noprove ${test+"$test"} $jobs $test_long $memtrash \
213 -- ${with_dash:+SHELL_PATH=/bin/dash} "$@" $dotest &&
216 test -n "$skip_doc" ||
217 if test "$save" = "$(git rev-parse HEAD)"
219 Meta/Make $M $jobs -- doc &&
220 Meta/Make $M -- install-man install-html
222 echo >&2 "Head moved--not installing docs"
227 test z$install = znoinstall ||
228 if test "$save" = "$(git rev-parse HEAD)"
230 Meta/Make $M -- ${with_dash:+SHELL_PATH=/bin/dash} "$@" install
232 echo >&2 "Head moved--not installing"
237 ) </dev/null || exit $?
239 installed_source_trees="$installed_source_trees$rtree "