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