7167593: Changed get_source.sh to allow for getting full oracle jdk repo forest

Thu, 10 May 2012 08:26:26 -0700

author
ohair
date
Thu, 10 May 2012 08:26:26 -0700
changeset 436
955a3e8ed4f0
parent 434
d939bd0ab13c
child 437
8a4e92c10a9a

7167593: Changed get_source.sh to allow for getting full oracle jdk repo forest
Reviewed-by: erikj, asaha, chegar, sla, dholmes, mbykov, coleenp

get_source.sh file | annotate | diff | comparison | revisions
make/scripts/hgforest.sh file | annotate | diff | comparison | revisions
     1.1 --- a/get_source.sh	Wed May 09 16:12:35 2012 -0700
     1.2 +++ b/get_source.sh	Thu May 10 08:26:26 2012 -0700
     1.3 @@ -1,7 +1,7 @@
     1.4  #!/bin/sh
     1.5  
     1.6  #
     1.7 -# Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
     1.8 +# Copyright (c) 2010, 2012, Oracle and/or its affiliates. All rights reserved.
     1.9  # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    1.10  #
    1.11  # This code is free software; you can redistribute it and/or modify it
    1.12 @@ -26,7 +26,7 @@
    1.13  #
    1.14  
    1.15  # Get clones of all nested repositories
    1.16 -sh ./make/scripts/hgforest.sh clone
    1.17 +sh ./make/scripts/hgforest.sh clone $*
    1.18  
    1.19  # Update all existing repositories to the latest sources
    1.20  sh ./make/scripts/hgforest.sh pull -u
     2.1 --- a/make/scripts/hgforest.sh	Wed May 09 16:12:35 2012 -0700
     2.2 +++ b/make/scripts/hgforest.sh	Thu May 10 08:26:26 2012 -0700
     2.3 @@ -1,7 +1,7 @@
     2.4  #!/bin/sh
     2.5  
     2.6  #
     2.7 -# Copyright (c) 2009, 2010, Oracle and/or its affiliates. All rights reserved.
     2.8 +# Copyright (c) 2009, 2012, Oracle and/or its affiliates. All rights reserved.
     2.9  # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    2.10  #
    2.11  # This code is free software; you can redistribute it and/or modify it
    2.12 @@ -24,6 +24,8 @@
    2.13  #
    2.14  
    2.15  # Shell script for a fast parallel forest command
    2.16 +command="$1"
    2.17 +pull_extra_base="$2"
    2.18  
    2.19  tmp=/tmp/forest.$$
    2.20  rm -f -r ${tmp}
    2.21 @@ -35,40 +37,58 @@
    2.22  
    2.23  # Only look in specific locations for possible forests (avoids long searches)
    2.24  pull_default=""
    2.25 -if [ "$1" = "clone" -o "$1" = "fclone" ] ; then
    2.26 +repos=""
    2.27 +repos_extra=""
    2.28 +if [ "${command}" = "clone" -o "${command}" = "fclone" ] ; then
    2.29    subrepos="corba jaxp jaxws langtools jdk hotspot"
    2.30    if [ -f .hg/hgrc ] ; then
    2.31      pull_default=`hg paths default`
    2.32 +    if [ "${pull_default}" = "" ] ; then
    2.33 +      echo "ERROR: Need initial clone with 'hg paths default' defined"
    2.34 +      exit 1
    2.35 +    fi
    2.36    fi
    2.37    if [ "${pull_default}" = "" ] ; then
    2.38 -    echo "ERROR: Need initial clone with 'hg paths default' defined"
    2.39 +    echo "ERROR: Need initial repository to use this script"
    2.40      exit 1
    2.41    fi
    2.42 -  repos=""
    2.43    for i in ${subrepos} ; do
    2.44      if [ ! -f ${i}/.hg/hgrc ] ; then
    2.45        repos="${repos} ${i}"
    2.46      fi
    2.47    done
    2.48 +  if [ "${pull_extra_base}" != "" ] ; then
    2.49 +    subrepos_extra="jdk/src/closed jdk/make/closed jdk/test/closed hotspot/src/closed hotspot/test/closed deploy install sponsors pubs"
    2.50 +    pull_default_base=`echo ${pull_default} | sed -e 's@\(^.*://[^/]*\)/.*@\1@'`
    2.51 +    pull_extra=`echo ${pull_default} | sed -e "s@${pull_default_base}@${pull_extra_base}@"`
    2.52 +    for i in ${subrepos_extra} ; do
    2.53 +      if [ ! -f ${i}/.hg/hgrc ] ; then
    2.54 +        repos_extra="${repos_extra} ${i}"
    2.55 +      fi
    2.56 +    done
    2.57 +  fi
    2.58    at_a_time=2
    2.59 +  # Any repos to deal with?
    2.60 +  if [ "${repos}" = "" -a "${repos_extra}" = "" ] ; then
    2.61 +    echo "No repositories to clone."
    2.62 +    exit
    2.63 +  fi
    2.64  else
    2.65    hgdirs=`ls -d ./.hg ./*/.hg ./*/*/.hg ./*/*/*/.hg ./*/*/*/*/.hg 2>/dev/null`
    2.66    # Derive repository names from the .hg directory locations
    2.67 -  repos=""
    2.68    for i in ${hgdirs} ; do
    2.69      repos="${repos} `echo ${i} | sed -e 's@/.hg$@@'`"
    2.70    done
    2.71    at_a_time=8
    2.72 +  # Any repos to deal with?
    2.73 +  if [ "${repos}" = "" ] ; then
    2.74 +    echo "No repositories to process."
    2.75 +    exit
    2.76 +  fi
    2.77  fi
    2.78  
    2.79 -# Any repos to deal with?
    2.80 -if [ "${repos}" = "" ] ; then
    2.81 -  echo "No repositories to process."
    2.82 -  exit
    2.83 -fi
    2.84 -
    2.85 -# Echo out what repositories we will process
    2.86 -echo "# Repos: ${repos}"
    2.87 +# Echo out what repositories we will clone
    2.88 +echo "# Repos: ${repos} ${repos_extra}"
    2.89  
    2.90  # Run the supplied command on all repos in parallel, save output until end
    2.91  n=0
    2.92 @@ -77,8 +97,8 @@
    2.93    n=`expr ${n} '+' 1`
    2.94    (
    2.95      (
    2.96 -      if [ "$1" = "clone" -o "$1" = "fclone" ] ; then
    2.97 -        cline="hg $* ${pull_default}/${i} ${i}"
    2.98 +      if [ "${command}" = "clone" -o "${command}" = "fclone" ] ; then
    2.99 +        cline="hg clone ${pull_default}/${i} ${i}"
   2.100          echo "# ${cline}"
   2.101          ( eval "${cline}" )
   2.102        else
   2.103 @@ -92,6 +112,22 @@
   2.104      sleep 5
   2.105    fi
   2.106  done
   2.107 +if [ "${repos_extra}" != "" ] ; then
   2.108 +  for i in ${repos_extra} ; do
   2.109 +    echo "Starting on ${i}"
   2.110 +    n=`expr ${n} '+' 1`
   2.111 +    (
   2.112 +      (
   2.113 +          cline="hg clone ${pull_extra}/${i} ${i}"
   2.114 +          echo "# ${cline}"
   2.115 +          ( eval "${cline}" )
   2.116 +        echo "# exit code $?"
   2.117 +      ) > ${tmp}/repo.${n} 2>&1 ; cat ${tmp}/repo.${n} ) &
   2.118 +    if [ `expr ${n} '%' ${at_a_time}` -eq 0 ] ; then
   2.119 +      sleep 5
   2.120 +    fi
   2.121 +  done
   2.122 +fi
   2.123  
   2.124  # Wait for all hg commands to complete
   2.125  wait

mercurial