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.
32 user
=$
(whoami |
sed -n -e "s/\\\/\\\\\\\\/p")
40 revision
=$
( (svn info |
sed -n -e "s/Last Changed Rev: \(.*\)/\1/p") || true
)
41 url
=$
( (svn info |
sed -n -e 's/^URL: \(.*\)/\1/p') || true
)
42 elif [ -d .git
]; then
43 revision
=$
(git log
-1 --no-show-signature --pretty=format
:"%H" || true
)
45 url
="git://${hostname}${cwd}"
47 if [ -z "${revision}" ]; then
48 echo "[WARN] revision info is empty! either we're not in VCS or VCS commands failed." >&2
52 if ! [ -x "$(command -v openssl)" ]; then
53 if ! [ -x "$(command -v gpg)" ]; then
56 srcChecksum
=$
(find hbase-
*/src
/main
/ |
grep -e "\.java" -e "\.proto" | LC_ALL
=C
sort |
xargs gpg
--print-md sha512 | gpg
--print-md sha512 |
tr '\n' ' ' |
sed 's/[[:space:]]*//g')
59 srcChecksum
=$
(find hbase-
*/src
/main
/ |
grep -e "\.java" -e "\.proto" | LC_ALL
=C
sort |
xargs openssl dgst
-sha512 | openssl dgst
-sha512 |
sed 's/^.* //')
63 mkdir
-p "$outputDirectory/org/apache/hadoop/hbase"
64 cat >"$outputDirectory/org/apache/hadoop/hbase/Version.java" <<EOF
66 * Generated by src/saveVersion.sh
68 package org.apache.hadoop.hbase;
70 import org.apache.yetus.audience.InterfaceAudience;
72 @InterfaceAudience.Private
73 @edu.umd.cs.findbugs.annotations.SuppressWarnings(value="DM_STRING_CTOR",
74 justification="Intentional; to be modified in test")
75 public class Version {
76 public static final String version = new String("$version");
77 public static final String revision = "$revision";
78 public static final String user = "$user";
79 public static final String date = "$date";
80 public static final String url = "$url";
81 public static final String srcChecksum = "$srcChecksum";