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.
27 javaOutputDirectory
="$2/java/"
28 nativeOutputDirectory
="$2/native/utils/"
33 user
=$
(whoami |
sed -n -e "s/\\\/\\\\\\\\/p")
41 revision
=$
( (svn info |
sed -n -e "s/Last Changed Rev: \(.*\)/\1/p") || true
)
42 url
=$
( (svn info |
sed -n -e 's/^URL: \(.*\)/\1/p') || true
)
43 elif [ -d .git
]; then
44 revision
=$
(git log
-1 --no-show-signature --pretty=format
:"%H" || true
)
46 url
="git://${hostname}${cwd}"
48 if [ -z "${revision}" ]; then
49 echo "[WARN] revision info is empty! either we're not in VCS or VCS commands failed." >&2
53 if ! [ -x "$(command -v openssl)" ]; then
54 if ! [ -x "$(command -v gpg)" ]; then
57 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')
60 srcChecksum
=$
(find hbase-
*/src
/main
/ |
grep -e "\.java" -e "\.proto" | LC_ALL
=C
sort |
xargs openssl dgst
-sha512 | openssl dgst
-sha512 |
sed 's/^.* //')
64 mkdir
-p "$javaOutputDirectory/org/apache/hadoop/hbase"
65 cat >"$javaOutputDirectory/org/apache/hadoop/hbase/Version.java" <<EOF
68 * Licensed to the Apache Software Foundation (ASF) under one
69 * or more contributor license agreements. See the NOTICE file
70 * distributed with this work for additional information
71 * regarding copyright ownership. The ASF licenses this file
72 * to you under the Apache License, Version 2.0 (the
73 * "License"); you may not use this file except in compliance
74 * with the License. You may obtain a copy of the License at
76 * http://www.apache.org/licenses/LICENSE-2.0
78 * Unless required by applicable law or agreed to in writing, software
79 * distributed under the License is distributed on an "AS IS" BASIS,
80 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
81 * See the License for the specific language governing permissions and
82 * limitations under the License.
85 * Generated by src/saveVersion.sh
87 package org.apache.hadoop.hbase;
89 import org.apache.yetus.audience.InterfaceAudience;
91 @InterfaceAudience.Private
92 @edu.umd.cs.findbugs.annotations.SuppressWarnings(value="DM_STRING_CTOR",
93 justification="Intentional; to be modified in test")
94 public class Version {
95 public static final String version = new String("$version");
96 public static final String revision = "$revision";
97 public static final String user = "$user";
98 public static final String date = "$date";
99 public static final String url = "$url";
100 public static final String srcChecksum = "$srcChecksum";
104 mkdir
-p "$nativeOutputDirectory"
105 cat > "$nativeOutputDirectory/version.h" <<EOF
108 * Licensed to the Apache Software Foundation (ASF) under one
109 * or more contributor license agreements. See the NOTICE file
110 * distributed with this work for additional information
111 * regarding copyright ownership. The ASF licenses this file
112 * to you under the Apache License, Version 2.0 (the
113 * "License"); you may not use this file except in compliance
114 * with the License. You may obtain a copy of the License at
116 * http://www.apache.org/licenses/LICENSE-2.0
118 * Unless required by applicable law or agreed to in writing, software
119 * distributed under the License is distributed on an "AS IS" BASIS,
120 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
121 * See the License for the specific language governing permissions and
122 * limitations under the License.
125 * Generated by src/saveVersion.sh from hbase-common.
133 static constexpr const char* version = "$version";
134 static constexpr const char* revision = "$revision";
135 static constexpr const char* user = "$user";
136 static constexpr const char* date = "$date";
137 static constexpr const char* url = "$url";
138 static constexpr const char* src_checksum = "$srcChecksum";
140 } /* namespace hbase */