HBASE-20753 fix the email address for security related issues in docs
[hbase.git] / hbase-common / src / saveVersion.sh
blobabb8c5bcff8b85234a0b3f1f6bff49d054254724
1 #!/usr/bin/env bash
3 # This file is used to generate the annotation of package info that
4 # records the user, url, revision and timestamp.
6 # Licensed to the Apache Software Foundation (ASF) under one or more
7 # contributor license agreements. See the NOTICE file distributed with
8 # this work for additional information regarding copyright ownership.
9 # The ASF licenses this file to You under the Apache License, Version 2.0
10 # (the "License"); you may not use this file except in compliance with
11 # the License. You may obtain a copy of the License at
13 # http://www.apache.org/licenses/LICENSE-2.0
15 # Unless required by applicable law or agreed to in writing, software
16 # distributed under the License is distributed on an "AS IS" BASIS,
17 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
18 # See the License for the specific language governing permissions and
19 # limitations under the License.
21 unset LANG
22 unset LC_CTYPE
24 version=$1
25 outputDirectory=$2
27 pushd .
28 cd ..
30 user=`whoami | sed -n -e 's/\\\/\\\\\\\\/p'`
31 if [ "$user" == "" ]
32 then
33 user=`whoami`
35 date=`date`
36 cwd=`pwd`
37 if [ -d .svn ]; then
38 revision=`svn info | sed -n -e 's/Last Changed Rev: \(.*\)/\1/p'`
39 url=`svn info | sed -n -e 's/^URL: \(.*\)/\1/p'`
40 elif [ -d .git ]; then
41 revision=`git log -1 --pretty=format:"%H"`
42 hostname=`hostname`
43 url="git://${hostname}${cwd}"
44 else
45 revision="Unknown"
46 url="file://$cwd"
48 which md5sum > /dev/null
49 if [ "$?" != "0" ] ; then
50 which md5 > /dev/null
51 if [ "$?" != "0" ] ; then
52 srcChecksum="Unknown"
53 else
54 srcChecksum=`find hbase-*/src/main/ | grep -e "\.java" -e "\.proto" | LC_ALL=C sort | xargs md5 | md5 | cut -d ' ' -f 1`
56 else
57 srcChecksum=`find hbase-*/src/main/ | grep -e "\.java" -e "\.proto" | LC_ALL=C sort | xargs md5sum | md5sum | cut -d ' ' -f 1`
59 popd
61 mkdir -p "$outputDirectory/org/apache/hadoop/hbase"
62 cat >"$outputDirectory/org/apache/hadoop/hbase/Version.java" <<EOF
64 * Generated by src/saveVersion.sh
66 package org.apache.hadoop.hbase;
68 import org.apache.yetus.audience.InterfaceAudience;
70 @InterfaceAudience.Private
71 public class Version {
72 public static final String version = "$version";
73 public static final String revision = "$revision";
74 public static final String user = "$user";
75 public static final String date = "$date";
76 public static final String url = "$url";
77 public static final String srcChecksum = "$srcChecksum";
79 EOF