2013-09-05 18:05:17 -04:00
|
|
|
#!/usr/bin/env bash
|
2008-02-04 21:32:22 -05:00
|
|
|
|
2010-05-24 13:02:28 -04:00
|
|
|
# This file is used to generate the annotation of package info that
|
|
|
|
# records the user, url, revision and timestamp.
|
|
|
|
|
2008-02-04 21:32:22 -05:00
|
|
|
# Licensed to the Apache Software Foundation (ASF) under one or more
|
|
|
|
# contributor license agreements. See the NOTICE file distributed with
|
|
|
|
# this work for additional information regarding copyright ownership.
|
|
|
|
# The ASF licenses this file to You under the Apache License, Version 2.0
|
|
|
|
# (the "License"); you may not use this file except in compliance with
|
|
|
|
# the License. You may obtain a copy of the License at
|
|
|
|
#
|
|
|
|
# http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
#
|
|
|
|
# Unless required by applicable law or agreed to in writing, software
|
|
|
|
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
|
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
|
|
# See the License for the specific language governing permissions and
|
|
|
|
# limitations under the License.
|
|
|
|
|
2008-06-18 23:42:45 -04:00
|
|
|
unset LANG
|
|
|
|
unset LC_CTYPE
|
2013-09-05 18:05:17 -04:00
|
|
|
|
2008-02-04 21:32:22 -05:00
|
|
|
version=$1
|
2010-02-22 18:49:24 -05:00
|
|
|
outputDirectory=$2
|
2013-08-26 16:52:12 -04:00
|
|
|
|
2013-09-05 18:05:17 -04:00
|
|
|
pushd .
|
2013-08-26 16:52:12 -04:00
|
|
|
cd ..
|
|
|
|
|
2009-02-03 15:33:49 -05:00
|
|
|
user=`whoami`
|
|
|
|
date=`date`
|
|
|
|
cwd=`pwd`
|
|
|
|
if [ -d .svn ]; then
|
2009-01-31 00:33:55 -05:00
|
|
|
revision=`svn info | sed -n -e 's/Last Changed Rev: \(.*\)/\1/p'`
|
2014-01-06 13:25:19 -05:00
|
|
|
url=`svn info | sed -n -e 's/^URL: \(.*\)/\1/p'`
|
2010-05-23 01:30:27 -04:00
|
|
|
elif [ -d .git ]; then
|
2009-02-03 15:33:49 -05:00
|
|
|
revision=`git log -1 --pretty=format:"%H"`
|
|
|
|
hostname=`hostname`
|
|
|
|
url="git://${hostname}${cwd}"
|
|
|
|
else
|
|
|
|
revision="Unknown"
|
|
|
|
url="file://$cwd"
|
2009-01-31 00:33:55 -05:00
|
|
|
fi
|
2013-08-26 16:52:12 -04:00
|
|
|
popd
|
|
|
|
|
2010-05-24 13:02:28 -04:00
|
|
|
mkdir -p "$outputDirectory/org/apache/hadoop/hbase"
|
|
|
|
cat >"$outputDirectory/org/apache/hadoop/hbase/package-info.java" <<EOF
|
2008-02-04 21:32:22 -05:00
|
|
|
/*
|
|
|
|
* Generated by src/saveVersion.sh
|
|
|
|
*/
|
2010-05-24 13:02:28 -04:00
|
|
|
@VersionAnnotation(version="$version", revision="$revision",
|
|
|
|
user="$user", date="$date", url="$url")
|
2008-02-04 21:32:22 -05:00
|
|
|
package org.apache.hadoop.hbase;
|
|
|
|
EOF
|
2013-08-26 16:52:12 -04:00
|
|
|
|