Fri, 14 Jun 2013 13:30:14 +0200
8016520: jdk native build does not fail on compilation error on windows
Reviewed-by: tbell
ohair@276 | 1 | #!/bin/sh |
ohair@276 | 2 | |
ohair@276 | 3 | # |
ohair@436 | 4 | # Copyright (c) 2009, 2012, Oracle and/or its affiliates. All rights reserved. |
ohair@276 | 5 | # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
ohair@276 | 6 | # |
ohair@276 | 7 | # This code is free software; you can redistribute it and/or modify it |
ohair@276 | 8 | # under the terms of the GNU General Public License version 2 only, as |
ohair@276 | 9 | # published by the Free Software Foundation. |
ohair@276 | 10 | # |
ohair@276 | 11 | # This code is distributed in the hope that it will be useful, but WITHOUT |
ohair@276 | 12 | # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
ohair@276 | 13 | # FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
ohair@276 | 14 | # version 2 for more details (a copy is included in the LICENSE file that |
ohair@276 | 15 | # accompanied this code). |
ohair@276 | 16 | # |
ohair@276 | 17 | # You should have received a copy of the GNU General Public License version |
ohair@276 | 18 | # 2 along with this work; if not, write to the Free Software Foundation, |
ohair@276 | 19 | # Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
ohair@276 | 20 | # |
ohair@276 | 21 | # Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
ohair@276 | 22 | # or visit www.oracle.com if you need additional information or have any |
ohair@276 | 23 | # questions. |
ohair@276 | 24 | # |
ohair@276 | 25 | |
ohair@276 | 26 | # Shell script for a fast parallel forest command |
ohair@436 | 27 | command="$1" |
ohair@436 | 28 | pull_extra_base="$2" |
ohair@276 | 29 | |
ohair@276 | 30 | tmp=/tmp/forest.$$ |
ohair@276 | 31 | rm -f -r ${tmp} |
ohair@276 | 32 | mkdir -p ${tmp} |
ohair@276 | 33 | |
ohair@276 | 34 | # Remove tmp area on A. B. Normal termination |
ohair@276 | 35 | trap 'rm -f -r ${tmp}' KILL |
ohair@276 | 36 | trap 'rm -f -r ${tmp}' EXIT |
ohair@276 | 37 | |
ohair@276 | 38 | # Only look in specific locations for possible forests (avoids long searches) |
ohair@276 | 39 | pull_default="" |
ohair@436 | 40 | repos="" |
ohair@436 | 41 | repos_extra="" |
ohair@436 | 42 | if [ "${command}" = "clone" -o "${command}" = "fclone" ] ; then |
jjg@645 | 43 | subrepos="corba jaxp jaxws langtools jdk hotspot nashorn" |
ohair@276 | 44 | if [ -f .hg/hgrc ] ; then |
ohair@276 | 45 | pull_default=`hg paths default` |
ohair@436 | 46 | if [ "${pull_default}" = "" ] ; then |
ohair@436 | 47 | echo "ERROR: Need initial clone with 'hg paths default' defined" |
ohair@436 | 48 | exit 1 |
ohair@436 | 49 | fi |
ohair@276 | 50 | fi |
ohair@276 | 51 | if [ "${pull_default}" = "" ] ; then |
ohair@436 | 52 | echo "ERROR: Need initial repository to use this script" |
ohair@276 | 53 | exit 1 |
ohair@276 | 54 | fi |
ohair@276 | 55 | for i in ${subrepos} ; do |
ohair@276 | 56 | if [ ! -f ${i}/.hg/hgrc ] ; then |
ohair@276 | 57 | repos="${repos} ${i}" |
ohair@276 | 58 | fi |
ohair@276 | 59 | done |
ohair@436 | 60 | if [ "${pull_extra_base}" != "" ] ; then |
jcoomes@475 | 61 | subrepos_extra="jdk/src/closed jdk/make/closed jdk/test/closed hotspot/make/closed hotspot/src/closed hotspot/test/closed deploy install sponsors pubs" |
ohair@437 | 62 | pull_default_tail=`echo ${pull_default} | sed -e 's@^.*://[^/]*/\(.*\)@\1@'` |
ohair@437 | 63 | pull_extra="${pull_extra_base}/${pull_default_tail}" |
ohair@436 | 64 | for i in ${subrepos_extra} ; do |
ohair@436 | 65 | if [ ! -f ${i}/.hg/hgrc ] ; then |
ohair@436 | 66 | repos_extra="${repos_extra} ${i}" |
ohair@436 | 67 | fi |
ohair@436 | 68 | done |
ohair@436 | 69 | fi |
ohair@276 | 70 | at_a_time=2 |
ohair@436 | 71 | # Any repos to deal with? |
ohair@436 | 72 | if [ "${repos}" = "" -a "${repos_extra}" = "" ] ; then |
ohair@436 | 73 | echo "No repositories to clone." |
ohair@436 | 74 | exit |
ohair@436 | 75 | fi |
ohair@276 | 76 | else |
ohair@276 | 77 | hgdirs=`ls -d ./.hg ./*/.hg ./*/*/.hg ./*/*/*/.hg ./*/*/*/*/.hg 2>/dev/null` |
ohair@276 | 78 | # Derive repository names from the .hg directory locations |
ohair@276 | 79 | for i in ${hgdirs} ; do |
ohair@276 | 80 | repos="${repos} `echo ${i} | sed -e 's@/.hg$@@'`" |
ohair@276 | 81 | done |
ohair@276 | 82 | at_a_time=8 |
ohair@436 | 83 | # Any repos to deal with? |
ohair@436 | 84 | if [ "${repos}" = "" ] ; then |
ohair@436 | 85 | echo "No repositories to process." |
ohair@436 | 86 | exit |
ohair@436 | 87 | fi |
ohair@276 | 88 | fi |
ohair@276 | 89 | |
ohair@436 | 90 | # Echo out what repositories we will clone |
ohair@436 | 91 | echo "# Repos: ${repos} ${repos_extra}" |
ohair@276 | 92 | |
ohair@276 | 93 | # Run the supplied command on all repos in parallel, save output until end |
ohair@276 | 94 | n=0 |
ohair@276 | 95 | for i in ${repos} ; do |
ohair@276 | 96 | echo "Starting on ${i}" |
ohair@276 | 97 | n=`expr ${n} '+' 1` |
ohair@276 | 98 | ( |
ohair@276 | 99 | ( |
ohair@436 | 100 | if [ "${command}" = "clone" -o "${command}" = "fclone" ] ; then |
ohair@462 | 101 | pull_newrepo="`echo ${pull_default}/${i} | sed -e 's@\([^:]/\)//*@\1@g'`" |
ohair@462 | 102 | cline="hg clone ${pull_newrepo} ${i}" |
ohair@276 | 103 | echo "# ${cline}" |
ohair@276 | 104 | ( eval "${cline}" ) |
ohair@276 | 105 | else |
ohair@276 | 106 | cline="hg $*" |
ohair@276 | 107 | echo "# cd ${i} && ${cline}" |
ohair@276 | 108 | ( cd ${i} && eval "${cline}" ) |
ohair@276 | 109 | fi |
ohair@276 | 110 | echo "# exit code $?" |
ohair@276 | 111 | ) > ${tmp}/repo.${n} 2>&1 ; cat ${tmp}/repo.${n} ) & |
ohair@276 | 112 | if [ `expr ${n} '%' ${at_a_time}` -eq 0 ] ; then |
ohair@276 | 113 | sleep 5 |
ohair@276 | 114 | fi |
ohair@276 | 115 | done |
ohair@446 | 116 | # Wait for all hg commands to complete |
ohair@446 | 117 | wait |
ohair@446 | 118 | |
ohair@436 | 119 | if [ "${repos_extra}" != "" ] ; then |
ohair@436 | 120 | for i in ${repos_extra} ; do |
ohair@436 | 121 | echo "Starting on ${i}" |
ohair@436 | 122 | n=`expr ${n} '+' 1` |
ohair@436 | 123 | ( |
ohair@436 | 124 | ( |
ohair@462 | 125 | pull_newextrarepo="`echo ${pull_extra}/${i} | sed -e 's@\([^:]/\)//*@\1@g'`" |
ohair@462 | 126 | cline="hg clone ${pull_newextrarepo} ${i}" |
ohair@436 | 127 | echo "# ${cline}" |
ohair@436 | 128 | ( eval "${cline}" ) |
ohair@436 | 129 | echo "# exit code $?" |
ohair@436 | 130 | ) > ${tmp}/repo.${n} 2>&1 ; cat ${tmp}/repo.${n} ) & |
ohair@436 | 131 | if [ `expr ${n} '%' ${at_a_time}` -eq 0 ] ; then |
ohair@436 | 132 | sleep 5 |
ohair@436 | 133 | fi |
ohair@436 | 134 | done |
ohair@446 | 135 | # Wait for all hg commands to complete |
ohair@446 | 136 | wait |
ohair@436 | 137 | fi |
ohair@276 | 138 | |
ohair@276 | 139 | # Cleanup |
ohair@276 | 140 | rm -f -r ${tmp} |
ohair@276 | 141 | |
ohair@276 | 142 | # Terminate with exit 0 all the time (hard to know when to say "failed") |
ohair@276 | 143 | exit 0 |
ohair@276 | 144 |