HBASE-13911 update java/hadoop prereqs for 1.2
[hbase.git] / dev-support / jdiffHBasePublicAPI_common.sh
blob8c7b53ff9fa7bbffbbfcd838b24f0c008b975589
1 #!/bin/bash
2 # Licensed under the Apache License, Version 2.0 (the "License");
3 # you may not use this file except in compliance with the License.
4 # You may obtain a copy of the License at
6 # http://www.apache.org/licenses/LICENSE-2.0
8 # Unless required by applicable law or agreed to in writing, software
9 # distributed under the License is distributed on an "AS IS" BASIS,
10 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11 # See the License for the specific language governing permissions and
12 # limitations under the License.
14 ##########################################################################################################################
16 ### Purpose: To describe whether the directory specified has the old directory format or the new directory format
17 ### Usage: This function takes one argument: The directory in question
18 ### It will set the temporary variable BRANCH_FORMAT. This variable can change with every call, so it is up to the user to
19 ### store it into something else as soon as the function exists
20 ### Example:
21 ### > isNewFormat ./myDevDir/testing/branch/hbase
22 isNewFormat() {
24 echo "Determining if directory $1 is of the 0.94 and before OR 0.95 and after versions";
25 if [[ "$1" = "" ]]; then
26 echo "Directory not specified. Exiting";
28 echo "First, check that $1 exists";
29 if [[ -d $1 ]]; then
30 echo "Directory $1 exists"
31 else
32 echo "Directory $1 does not exist. Exiting";
33 exit 1;
36 if [[ -d "$1/hbase-server" ]]; then
38 echo "The directory $1/hbase-server exists so this is of the new format";
39 export BRANCH_FORMAT=new;
41 else
42 echo "The directory $1/hbase-server does not exist. Therefore, this is of the old format";
43 export BRANCH_FORMAT=old;
47 ### Purpose: To describe whether the argument specified is a git repo or a local directory
48 ### Usage: This function takes one argument: The directory in question
49 ### It will set the temporary variable INPUT_FORMAT. This variable can change with every call, so it is up to the user to
50 ### store it into something else as soon as the function exists
51 ### Example:
52 ### > isGitRepo ./myDevDir/testing/branch/hbase
54 isGitRepo() {
56 echo "Determining if this is a local directory or a git repo.";
57 if [[ "$1" = "" ]]; then
58 echo "No value specified for repo or directory. Exiting."
59 exit 1;
62 if [[ `echo $1 | grep 'http://'` || `echo $1 | grep 'https://'` || `echo $1 | grep 'git://'` ]]; then
63 echo "Looks like $1 is a git repo";
64 export INPUT_FORMAT=git_repo
65 else
66 echo "$1 is a local directory";
67 export INPUT_FORMAT=local_directory