Path: blob/jdk8u272-b10-aarch32-20201026/get_source.sh
40176 views
#!/bin/sh12#3# Copyright (c) 2010, 2014, Oracle and/or its affiliates. All rights reserved.4# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.5#6# This code is free software; you can redistribute it and/or modify it7# under the terms of the GNU General Public License version 2 only, as8# published by the Free Software Foundation. Oracle designates this9# particular file as subject to the "Classpath" exception as provided10# by Oracle in the LICENSE file that accompanied this code.11#12# This code is distributed in the hope that it will be useful, but WITHOUT13# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or14# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License15# version 2 for more details (a copy is included in the LICENSE file that16# accompanied this code).17#18# You should have received a copy of the GNU General Public License version19# 2 along with this work; if not, write to the Free Software Foundation,20# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.21#22# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA23# or visit www.oracle.com if you need additional information or have any24# questions.25#2627to_stderr() {28echo "$@" >&229}3031error() {32to_stderr "ERROR: $1"33exit ${2:-126}34}3536warning() {37to_stderr "WARNING: $1"38}3940version_field() {41# rev is typically omitted for minor and major releases42field=`echo ${1}.0 | cut -f ${2} -d .`43if expr 1 + $field >/dev/null 2> /dev/null; then44echo $field45else46echo -147fi48}4950# Version check5152# required53reqdmajor=154reqdminor=455reqdrev=05657# requested58rqstmajor=259rqstminor=660rqstrev=3616263# installed64hgwhere="`command -v hg`"65if [ "x$hgwhere" = "x" ]; then66error "Could not locate Mercurial command"67fi6869hgversion="`LANGUAGE=en hg --version 2> /dev/null | sed -n -e 's@^Mercurial Distributed SCM (version \([^+]*\).*)\$@\1@p'`"70if [ "x${hgversion}" = "x" ] ; then71error "Could not determine Mercurial version of $hgwhere"72fi7374hgmajor="`version_field $hgversion 1`"75hgminor="`version_field $hgversion 2`"76hgrev="`version_field $hgversion 3`"7778if [ $hgmajor -eq -1 -o $hgminor -eq -1 -o $hgrev -eq -1 ] ; then79error "Could not determine Mercurial version of $hgwhere from \"$hgversion\""80fi818283# Require84if [ $hgmajor -lt $reqdmajor -o \( $hgmajor -eq $reqdmajor -a $hgminor -lt $reqdminor \) -o \( $hgmajor -eq $reqdmajor -a $hgminor -eq $reqdminor -a $hgrev -lt $reqdrev \) ] ; then85error "Mercurial version $reqdmajor.$reqdminor.$reqdrev or later is required. $hgwhere is version $hgversion"86fi878889# Request90if [ $hgmajor -lt $rqstmajor -o \( $hgmajor -eq $rqstmajor -a $hgminor -lt $rqstminor \) -o \( $hgmajor -eq $rqstmajor -a $hgminor -eq $rqstminor -a $hgrev -lt $rqstrev \) ] ; then91warning "Mercurial version $rqstmajor.$rqstminor.$rqstrev or later is recommended. $hgwhere is version $hgversion"92fi939495# Get clones of all absent nested repositories (harmless if already exist)96sh ./common/bin/hgforest.sh clone "$@" || exit $?9798# Update all existing repositories to the latest sources99sh ./common/bin/hgforest.sh pull -u100101102