get_source.sh

Wed, 21 Oct 2020 02:49:45 +0100

author
andrew
date
Wed, 21 Oct 2020 02:49:45 +0100
changeset 2560
0080765dcdd2
parent 1741
abafc84654a6
child 1859
8b0588603185
permissions
-rw-r--r--

Added tag jdk8u272-ga for changeset 6464ce0569e7

ohair@276 1 #!/bin/sh
ohair@276 2
ohair@276 3 #
mduigou@1146 4 # Copyright (c) 2010, 2014, 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. Oracle designates this
ohair@276 10 # particular file as subject to the "Classpath" exception as provided
ohair@276 11 # by Oracle in the LICENSE file that accompanied this code.
ohair@276 12 #
ohair@276 13 # This code is distributed in the hope that it will be useful, but WITHOUT
ohair@276 14 # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
ohair@276 15 # FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
ohair@276 16 # version 2 for more details (a copy is included in the LICENSE file that
ohair@276 17 # accompanied this code).
ohair@276 18 #
ohair@276 19 # You should have received a copy of the GNU General Public License version
ohair@276 20 # 2 along with this work; if not, write to the Free Software Foundation,
ohair@276 21 # Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
ohair@276 22 #
ohair@276 23 # Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
ohair@276 24 # or visit www.oracle.com if you need additional information or have any
ohair@276 25 # questions.
ohair@276 26 #
ohair@276 27
mduigou@1147 28 to_stderr() {
mduigou@1147 29 echo "$@" >&2
mduigou@1147 30 }
mduigou@1147 31
mduigou@1147 32 error() {
mduigou@1147 33 to_stderr "ERROR: $1"
mduigou@1147 34 exit ${2:-126}
mduigou@1147 35 }
mduigou@1147 36
mduigou@1147 37 warning() {
mduigou@1147 38 to_stderr "WARNING: $1"
mduigou@1147 39 }
mduigou@1147 40
mduigou@1147 41 version_field() {
mduigou@1147 42 # rev is typically omitted for minor and major releases
mduigou@1147 43 field=`echo ${1}.0 | cut -f ${2} -d .`
mduigou@1147 44 if expr 1 + $field >/dev/null 2> /dev/null; then
mduigou@1147 45 echo $field
mduigou@1147 46 else
mduigou@1147 47 echo -1
mduigou@1147 48 fi
mduigou@1147 49 }
mduigou@1147 50
mduigou@1146 51 # Version check
mduigou@1146 52
mduigou@1146 53 # required
mduigou@1146 54 reqdmajor=1
mduigou@1147 55 reqdminor=4
mduigou@1146 56 reqdrev=0
mduigou@1146 57
mduigou@1146 58 # requested
mduigou@1146 59 rqstmajor=2
mduigou@1146 60 rqstminor=6
mduigou@1146 61 rqstrev=3
mduigou@1146 62
mduigou@1147 63
mduigou@1146 64 # installed
mduigou@1147 65 hgwhere="`command -v hg`"
mduigou@1146 66 if [ "x$hgwhere" = "x" ]; then
mduigou@1147 67 error "Could not locate Mercurial command"
mduigou@1146 68 fi
mduigou@1146 69
mduigou@1741 70 hgversion="`LANGUAGE=en hg --version 2> /dev/null | sed -n -e 's@^Mercurial Distributed SCM (version \([^+]*\).*)\$@\1@p'`"
mduigou@1146 71 if [ "x${hgversion}" = "x" ] ; then
mduigou@1147 72 error "Could not determine Mercurial version of $hgwhere"
mduigou@1146 73 fi
mduigou@1146 74
mduigou@1147 75 hgmajor="`version_field $hgversion 1`"
mduigou@1147 76 hgminor="`version_field $hgversion 2`"
mduigou@1147 77 hgrev="`version_field $hgversion 3`"
mduigou@1147 78
mduigou@1147 79 if [ $hgmajor -eq -1 -o $hgminor -eq -1 -o $hgrev -eq -1 ] ; then
mduigou@1147 80 error "Could not determine Mercurial version of $hgwhere from \"$hgversion\""
mduigou@1147 81 fi
mduigou@1147 82
mduigou@1146 83
mduigou@1146 84 # Require
mduigou@1146 85 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
mduigou@1147 86 error "Mercurial version $reqdmajor.$reqdminor.$reqdrev or later is required. $hgwhere is version $hgversion"
mduigou@1146 87 fi
mduigou@1146 88
mduigou@1147 89
mduigou@1146 90 # Request
mduigou@1146 91 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
mduigou@1147 92 warning "Mercurial version $rqstmajor.$rqstminor.$rqstrev or later is recommended. $hgwhere is version $hgversion"
mduigou@1146 93 fi
mduigou@1146 94
mduigou@1147 95
mduigou@1146 96 # Get clones of all absent nested repositories (harmless if already exist)
mduigou@1146 97 sh ./common/bin/hgforest.sh clone "$@" || exit $?
ohair@276 98
ohair@276 99 # Update all existing repositories to the latest sources
ohrstrom@538 100 sh ./common/bin/hgforest.sh pull -u

mercurial