./get_source.sh

Print this page
rev 1078 : 8047925: Add mercurial version checks to get_source.sh
Reviewed-by: duke
   1 #!/bin/sh
   2 
   3 #
   4 # Copyright (c) 2010, 2012, Oracle and/or its affiliates. All rights reserved.
   5 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   6 #
   7 # This code is free software; you can redistribute it and/or modify it
   8 # under the terms of the GNU General Public License version 2 only, as
   9 # published by the Free Software Foundation.  Oracle designates this
  10 # particular file as subject to the "Classpath" exception as provided
  11 # by Oracle in the LICENSE file that accompanied this code.
  12 #
  13 # This code is distributed in the hope that it will be useful, but WITHOUT
  14 # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  15 # FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  16 # version 2 for more details (a copy is included in the LICENSE file that
  17 # accompanied this code).
  18 #
  19 # You should have received a copy of the GNU General Public License version
  20 # 2 along with this work; if not, write to the Free Software Foundation,
  21 # Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  22 #
  23 # Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  24 # or visit www.oracle.com if you need additional information or have any
  25 # questions.
  26 #
  27 
  28 # Get clones of all nested repositories
  29 sh ./common/bin/hgforest.sh clone "$@" || exit 1








































  30 
  31 # Update all existing repositories to the latest sources
  32 sh ./common/bin/hgforest.sh pull -u
  33 
   1 #!/bin/sh
   2 
   3 #
   4 # Copyright (c) 2010, 2014, Oracle and/or its affiliates. All rights reserved.
   5 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   6 #
   7 # This code is free software; you can redistribute it and/or modify it
   8 # under the terms of the GNU General Public License version 2 only, as
   9 # published by the Free Software Foundation.  Oracle designates this
  10 # particular file as subject to the "Classpath" exception as provided
  11 # by Oracle in the LICENSE file that accompanied this code.
  12 #
  13 # This code is distributed in the hope that it will be useful, but WITHOUT
  14 # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  15 # FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  16 # version 2 for more details (a copy is included in the LICENSE file that
  17 # accompanied this code).
  18 #
  19 # You should have received a copy of the GNU General Public License version
  20 # 2 along with this work; if not, write to the Free Software Foundation,
  21 # Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  22 #
  23 # Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  24 # or visit www.oracle.com if you need additional information or have any
  25 # questions.
  26 #
  27 
  28 # Version check
  29 
  30 # required
  31 reqdmajor=1
  32 reqdminor=5
  33 reqdrev=0
  34 
  35 # requested
  36 rqstmajor=2
  37 rqstminor=6
  38 rqstrev=3
  39 
  40 # installed
  41 hgwhere="`which hg 2> /dev/null | grep -v '^no hg in '`"
  42 if [ "x$hgwhere" = "x" ]; then
  43   echo "ERROR: Could not locate Mercurial command" >&2
  44   exit 126
  45 fi
  46 
  47 hgversion="`hg --version 2> /dev/null | sed -n -e 's@^Mercurial Distributed SCM (version \(.*\))\$@\1@p'`"
  48 if [ "x${hgversion}" = "x" ] ; then
  49   echo "ERROR: Could not determine Mercurial version" >&2
  50   exit 126
  51 fi
  52 
  53 hgmajor="`echo $hgversion | cut -f 1 -d .`"
  54 hgminor="`echo $hgversion | cut -f 2 -d .`"
  55 hgrev="`echo $hgversion.0 | cut -f 3 -d .`" # rev is omitted for minor and major releases
  56 
  57 # Require
  58 if [ $hgmajor -lt $reqdmajor -o \( $hgmajor -eq $reqdmajor -a $hgminor -lt $reqdminor \) -o \( $hgmajor -eq $reqdmajor -a $hgminor -eq $reqdminor -a $hgrev -lt $reqdrev \) ] ; then
  59   echo "ERROR: Mercurial version $reqdmajor.$reqdminor.$reqdrev or later is required. $hgwhere is version $hgversion" >&2
  60   exit 126
  61 fi
  62 
  63 # Request
  64 if [ $hgmajor -lt $rqstmajor -o \( $hgmajor -eq $rqstmajor -a $hgminor -lt $rqstminor \) -o \( $hgmajor -eq $rqstmajor -a $hgminor -eq $rqstminor -a $hgrev -lt $rqstrev \) ] ; then
  65   echo "WARNING: Mercurial version $rqstmajor.$rqstminor.$rqstrev or later is recommended. $hgwhere is version version $hgversion" >&2
  66 fi
  67 
  68 # Get clones of all absent nested repositories (harmless if already exist)
  69 sh ./common/bin/hgforest.sh clone "$@" || exit $?
  70 
  71 # Update all existing repositories to the latest sources
  72 sh ./common/bin/hgforest.sh pull -u