1 | #!/bin/sh |
---|
2 | |
---|
3 | # Licensed to the Apache Software Foundation (ASF) under one or more |
---|
4 | # contributor license agreements. See the NOTICE file distributed with |
---|
5 | # this work for additional information regarding copyright ownership. |
---|
6 | # The ASF licenses this file to You under the Apache License, Version 2.0 |
---|
7 | # (the "License"); you may not use this file except in compliance with |
---|
8 | # the License. You may obtain a copy of the License at |
---|
9 | # |
---|
10 | # http://www.apache.org/licenses/LICENSE-2.0 |
---|
11 | # |
---|
12 | # Unless required by applicable law or agreed to in writing, software |
---|
13 | # distributed under the License is distributed on an "AS IS" BASIS, |
---|
14 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
---|
15 | # See the License for the specific language governing permissions and |
---|
16 | # limitations under the License. |
---|
17 | |
---|
18 | |
---|
19 | # This file is used to generate the BuildStamp.java class that |
---|
20 | # records the user, url, revision and timestamp. |
---|
21 | unset LANG |
---|
22 | unset LC_CTYPE |
---|
23 | version=$1 |
---|
24 | user=`whoami` |
---|
25 | date=`date` |
---|
26 | if [ -d .git ]; then |
---|
27 | revision=`git log -1 --pretty=format:"%H"` |
---|
28 | hostname=`hostname` |
---|
29 | branch=`git branch | sed -n -e 's/^* //p'` |
---|
30 | url="git://$hostname/$cwd on branch $branch" |
---|
31 | else |
---|
32 | revision=`svn info | sed -n -e 's/Last Changed Rev: \(.*\)/\1/p'` |
---|
33 | url=`svn info | sed -n -e 's/URL: \(.*\)/\1/p'` |
---|
34 | fi |
---|
35 | mkdir -p build/src/org/apache/hadoop |
---|
36 | cat << EOF | \ |
---|
37 | sed -e "s/VERSION/$version/" -e "s/USER/$user/" -e "s/DATE/$date/" \ |
---|
38 | -e "s|URL|$url|" -e "s/REV/$revision/" \ |
---|
39 | > build/src/org/apache/hadoop/package-info.java |
---|
40 | /* |
---|
41 | * Generated by src/saveVersion.sh |
---|
42 | */ |
---|
43 | @HadoopVersionAnnotation(version="VERSION", revision="REV", |
---|
44 | user="USER", date="DATE", url="URL") |
---|
45 | package org.apache.hadoop; |
---|
46 | EOF |
---|