HADOOP-8924. Revert r1435372 that missed some files
git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/trunk@1435379 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
98db9f5930
commit
f8cca2df8a
@ -447,9 +447,6 @@ Release 2.0.3-alpha - Unreleased
|
||||
HADOOP-9216. CompressionCodecFactory#getCodecClasses should trim the
|
||||
result of parsing by Configuration. (Tsuyoshi Ozawa via todd)
|
||||
|
||||
HADOOP-8924. Add maven plugin alternative to shell script to save
|
||||
package-info.java. (Alejandro Abdelnur, Chris Nauroth via suresh)
|
||||
|
||||
OPTIMIZATIONS
|
||||
|
||||
HADOOP-8866. SampleQuantiles#query is O(N^2) instead of O(N). (Andrew Wang
|
||||
|
67
hadoop-common-project/hadoop-common/dev-support/saveVersion.sh
Executable file
67
hadoop-common-project/hadoop-common/dev-support/saveVersion.sh
Executable file
@ -0,0 +1,67 @@
|
||||
#!/bin/sh
|
||||
|
||||
# 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.
|
||||
|
||||
|
||||
# This file is used to generate the package-info.java class that
|
||||
# records the version, revision, branch, user, timestamp, and url
|
||||
unset LANG
|
||||
unset LC_CTYPE
|
||||
unset LC_TIME
|
||||
version=$1
|
||||
build_dir=$2
|
||||
user=`whoami | tr '\n\r' '\n'`
|
||||
date=`date`
|
||||
cwd=`pwd`
|
||||
if git rev-parse HEAD 2>/dev/null > /dev/null ; then
|
||||
revision=`git log -1 --pretty=format:"%H"`
|
||||
hostname=`hostname`
|
||||
branch=`git branch | sed -n -e 's/^* //p'`
|
||||
url="git://${hostname}${cwd}"
|
||||
elif [ -d .svn ]; then
|
||||
revision=`svn info | sed -n -e 's/Last Changed Rev: \(.*\)/\1/p'`
|
||||
url=`svn info | sed -n -e 's/^URL: \(.*\)/\1/p'`
|
||||
# Get canonical branch (branches/X, tags/X, or trunk)
|
||||
branch=`echo $url | sed -n -e 's,.*\(branches/.*\)$,\1,p' \
|
||||
-e 's,.*\(tags/.*\)$,\1,p' \
|
||||
-e 's,.*trunk$,trunk,p'`
|
||||
else
|
||||
revision="Unknown"
|
||||
branch="Unknown"
|
||||
url="file://$cwd"
|
||||
fi
|
||||
|
||||
which md5sum > /dev/null
|
||||
if [ "$?" = "0" ] ; then
|
||||
srcChecksum=`find src/main/java -name '*.java' | LC_ALL=C sort | xargs md5sum | md5sum | cut -d ' ' -f 1`
|
||||
else
|
||||
srcChecksum="Not Available"
|
||||
fi
|
||||
|
||||
mkdir -p $build_dir/org/apache/hadoop
|
||||
cat << EOF | \
|
||||
sed -e "s/VERSION/$version/" -e "s/USER/$user/" -e "s/DATE/$date/" \
|
||||
-e "s|URL|$url|" -e "s/REV/$revision/" \
|
||||
-e "s|BRANCH|$branch|" -e "s/SRCCHECKSUM/$srcChecksum/" \
|
||||
> $build_dir/org/apache/hadoop/package-info.java
|
||||
/*
|
||||
* Generated by src/saveVersion.sh
|
||||
*/
|
||||
@HadoopVersionAnnotation(version="VERSION", revision="REV", branch="BRANCH",
|
||||
user="USER", date="DATE", url="URL",
|
||||
srcChecksum="SRCCHECKSUM")
|
||||
package org.apache.hadoop;
|
||||
EOF
|
@ -244,51 +244,7 @@
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
<!--
|
||||
Include all files in src/main/resources. By default, do not apply property
|
||||
substitution (filtering=false), but do apply property substitution to
|
||||
common-version-info.properties (filtering=true). This will substitute the
|
||||
version information correctly, but prevent Maven from altering other files
|
||||
like core-default.xml.
|
||||
-->
|
||||
<resources>
|
||||
<resource>
|
||||
<directory>${basedir}/src/main/resources</directory>
|
||||
<excludes>
|
||||
<exclude>common-version-info.properties</exclude>
|
||||
</excludes>
|
||||
<filtering>false</filtering>
|
||||
</resource>
|
||||
<resource>
|
||||
<directory>${basedir}/src/main/resources</directory>
|
||||
<includes>
|
||||
<include>common-version-info.properties</include>
|
||||
</includes>
|
||||
<filtering>true</filtering>
|
||||
</resource>
|
||||
</resources>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.apache.hadoop</groupId>
|
||||
<artifactId>hadoop-maven-plugins</artifactId>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>version-info</id>
|
||||
<goals>
|
||||
<goal>version-info</goal>
|
||||
</goals>
|
||||
<configuration>
|
||||
<source>
|
||||
<directory>${basedir}/src/main</directory>
|
||||
<includes>
|
||||
<include>java/**/*.java</include>
|
||||
<include>proto/**/*.proto</include>
|
||||
</includes>
|
||||
</source>
|
||||
</configuration>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-surefire-plugin</artifactId>
|
||||
@ -332,6 +288,22 @@
|
||||
</target>
|
||||
</configuration>
|
||||
</execution>
|
||||
<execution>
|
||||
<id>save-version</id>
|
||||
<phase>generate-sources</phase>
|
||||
<goals>
|
||||
<goal>run</goal>
|
||||
</goals>
|
||||
<configuration>
|
||||
<target>
|
||||
<mkdir dir="${project.build.directory}/generated-sources/java"/>
|
||||
<exec executable="sh">
|
||||
<arg
|
||||
line="${basedir}/dev-support/saveVersion.sh ${project.version} ${project.build.directory}/generated-sources/java"/>
|
||||
</exec>
|
||||
</target>
|
||||
</configuration>
|
||||
</execution>
|
||||
<execution>
|
||||
<id>generate-test-sources</id>
|
||||
<phase>generate-test-sources</phase>
|
||||
|
@ -0,0 +1,74 @@
|
||||
/*
|
||||
* 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.
|
||||
*/
|
||||
package org.apache.hadoop;
|
||||
|
||||
import java.lang.annotation.*;
|
||||
|
||||
import org.apache.hadoop.classification.InterfaceAudience;
|
||||
import org.apache.hadoop.classification.InterfaceStability;
|
||||
|
||||
/**
|
||||
* A package attribute that captures the version of Hadoop that was compiled.
|
||||
*/
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
@Target(ElementType.PACKAGE)
|
||||
@InterfaceAudience.LimitedPrivate({"HDFS", "MapReduce"})
|
||||
@InterfaceStability.Unstable
|
||||
public @interface HadoopVersionAnnotation {
|
||||
|
||||
/**
|
||||
* Get the Hadoop version
|
||||
* @return the version string "0.6.3-dev"
|
||||
*/
|
||||
String version();
|
||||
|
||||
/**
|
||||
* Get the username that compiled Hadoop.
|
||||
*/
|
||||
String user();
|
||||
|
||||
/**
|
||||
* Get the date when Hadoop was compiled.
|
||||
* @return the date in unix 'date' format
|
||||
*/
|
||||
String date();
|
||||
|
||||
/**
|
||||
* Get the url for the subversion repository.
|
||||
*/
|
||||
String url();
|
||||
|
||||
/**
|
||||
* Get the subversion revision.
|
||||
* @return the revision number as a string (eg. "451451")
|
||||
*/
|
||||
String revision();
|
||||
|
||||
/**
|
||||
* Get the branch from which this was compiled.
|
||||
* @return The branch name, e.g. "trunk" or "branches/branch-0.20"
|
||||
*/
|
||||
String branch();
|
||||
|
||||
/**
|
||||
* Get a checksum of the source files from which
|
||||
* Hadoop was compiled.
|
||||
* @return a string that uniquely identifies the source
|
||||
**/
|
||||
String srcChecksum();
|
||||
}
|
@ -20,78 +20,41 @@
|
||||
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
import org.apache.hadoop.HadoopVersionAnnotation;
|
||||
import org.apache.hadoop.classification.InterfaceAudience;
|
||||
import org.apache.hadoop.classification.InterfaceStability;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.util.Properties;
|
||||
|
||||
/**
|
||||
* This class returns build information about Hadoop components.
|
||||
* This class finds the package info for Hadoop and the HadoopVersionAnnotation
|
||||
* information.
|
||||
*/
|
||||
@InterfaceAudience.Private
|
||||
@InterfaceStability.Unstable
|
||||
public class VersionInfo {
|
||||
private static final Log LOG = LogFactory.getLog(VersionInfo.class);
|
||||
|
||||
private Properties info;
|
||||
|
||||
protected VersionInfo(String component) {
|
||||
info = new Properties();
|
||||
String versionInfoFile = component + "-version-info.properties";
|
||||
try {
|
||||
InputStream is = Thread.currentThread().getContextClassLoader()
|
||||
.getResourceAsStream(versionInfoFile);
|
||||
info.load(is);
|
||||
} catch (IOException ex) {
|
||||
LogFactory.getLog(getClass()).warn("Could not read '" +
|
||||
versionInfoFile + "', " + ex.toString(), ex);
|
||||
}
|
||||
private static Package myPackage;
|
||||
private static HadoopVersionAnnotation version;
|
||||
|
||||
static {
|
||||
myPackage = HadoopVersionAnnotation.class.getPackage();
|
||||
version = myPackage.getAnnotation(HadoopVersionAnnotation.class);
|
||||
}
|
||||
|
||||
protected String _getVersion() {
|
||||
return info.getProperty("version", "Unknown");
|
||||
/**
|
||||
* Get the meta-data for the Hadoop package.
|
||||
* @return
|
||||
*/
|
||||
static Package getPackage() {
|
||||
return myPackage;
|
||||
}
|
||||
|
||||
protected String _getRevision() {
|
||||
return info.getProperty("revision", "Unknown");
|
||||
}
|
||||
|
||||
protected String _getBranch() {
|
||||
return info.getProperty("branch", "Unknown");
|
||||
}
|
||||
|
||||
protected String _getDate() {
|
||||
return info.getProperty("date", "Unknown");
|
||||
}
|
||||
|
||||
protected String _getUser() {
|
||||
return info.getProperty("user", "Unknown");
|
||||
}
|
||||
|
||||
protected String _getUrl() {
|
||||
return info.getProperty("url", "Unknown");
|
||||
}
|
||||
|
||||
protected String _getSrcChecksum() {
|
||||
return info.getProperty("srcChecksum", "Unknown");
|
||||
}
|
||||
|
||||
protected String _getBuildVersion(){
|
||||
return getVersion() +
|
||||
" from " + _getRevision() +
|
||||
" by " + _getUser() +
|
||||
" source checksum " + _getSrcChecksum();
|
||||
}
|
||||
|
||||
private static VersionInfo COMMON_VERSION_INFO = new VersionInfo("common");
|
||||
|
||||
/**
|
||||
* Get the Hadoop version.
|
||||
* @return the Hadoop version string, eg. "0.6.3-dev"
|
||||
*/
|
||||
public static String getVersion() {
|
||||
return COMMON_VERSION_INFO._getVersion();
|
||||
return version != null ? version.version() : "Unknown";
|
||||
}
|
||||
|
||||
/**
|
||||
@ -99,7 +62,7 @@ public static String getVersion() {
|
||||
* @return the revision number, eg. "451451"
|
||||
*/
|
||||
public static String getRevision() {
|
||||
return COMMON_VERSION_INFO._getRevision();
|
||||
return version != null ? version.revision() : "Unknown";
|
||||
}
|
||||
|
||||
/**
|
||||
@ -107,7 +70,7 @@ public static String getRevision() {
|
||||
* @return The branch name, e.g. "trunk" or "branches/branch-0.20"
|
||||
*/
|
||||
public static String getBranch() {
|
||||
return COMMON_VERSION_INFO._getBranch();
|
||||
return version != null ? version.branch() : "Unknown";
|
||||
}
|
||||
|
||||
/**
|
||||
@ -115,7 +78,7 @@ public static String getBranch() {
|
||||
* @return the compilation date in unix date format
|
||||
*/
|
||||
public static String getDate() {
|
||||
return COMMON_VERSION_INFO._getDate();
|
||||
return version != null ? version.date() : "Unknown";
|
||||
}
|
||||
|
||||
/**
|
||||
@ -123,14 +86,14 @@ public static String getDate() {
|
||||
* @return the username of the user
|
||||
*/
|
||||
public static String getUser() {
|
||||
return COMMON_VERSION_INFO._getUser();
|
||||
return version != null ? version.user() : "Unknown";
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the subversion URL for the root Hadoop directory.
|
||||
*/
|
||||
public static String getUrl() {
|
||||
return COMMON_VERSION_INFO._getUrl();
|
||||
return version != null ? version.url() : "Unknown";
|
||||
}
|
||||
|
||||
/**
|
||||
@ -138,7 +101,7 @@ public static String getUrl() {
|
||||
* built.
|
||||
**/
|
||||
public static String getSrcChecksum() {
|
||||
return COMMON_VERSION_INFO._getSrcChecksum();
|
||||
return version != null ? version.srcChecksum() : "Unknown";
|
||||
}
|
||||
|
||||
/**
|
||||
@ -146,11 +109,14 @@ public static String getSrcChecksum() {
|
||||
* revision, user and date.
|
||||
*/
|
||||
public static String getBuildVersion(){
|
||||
return COMMON_VERSION_INFO._getBuildVersion();
|
||||
return VersionInfo.getVersion() +
|
||||
" from " + VersionInfo.getRevision() +
|
||||
" by " + VersionInfo.getUser() +
|
||||
" source checksum " + VersionInfo.getSrcChecksum();
|
||||
}
|
||||
|
||||
public static void main(String[] args) {
|
||||
LOG.debug("version: "+ getVersion());
|
||||
LOG.debug("version: "+ version);
|
||||
System.out.println("Hadoop " + getVersion());
|
||||
System.out.println("Subversion " + getUrl() + " -r " + getRevision());
|
||||
System.out.println("Compiled by " + getUser() + " on " + getDate());
|
||||
|
@ -1,25 +0,0 @@
|
||||
#
|
||||
# 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.
|
||||
#
|
||||
|
||||
version=${pom.version}
|
||||
revision=${version-info.scm.commit}
|
||||
branch=${version-info.scm.branch}
|
||||
user=${user.name}
|
||||
date=${version-info.build.time}
|
||||
url=${version-info.scm.uri}
|
||||
srcChecksum=${version-info.source.md5}
|
@ -769,11 +769,6 @@
|
||||
<artifactId>maven-pdf-plugin</artifactId>
|
||||
<version>1.1</version>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.apache.hadoop</groupId>
|
||||
<artifactId>hadoop-maven-plugins</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</pluginManagement>
|
||||
|
||||
|
@ -45,29 +45,6 @@
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
<!--
|
||||
Include all files in src/main/resources. By default, do not apply property
|
||||
substitution (filtering=false), but do apply property substitution to
|
||||
yarn-version-info.properties (filtering=true). This will substitute the
|
||||
version information correctly, but prevent Maven from altering other files
|
||||
like yarn-default.xml.
|
||||
-->
|
||||
<resources>
|
||||
<resource>
|
||||
<directory>${basedir}/src/main/resources</directory>
|
||||
<excludes>
|
||||
<exclude>yarn-version-info.properties</exclude>
|
||||
</excludes>
|
||||
<filtering>false</filtering>
|
||||
</resource>
|
||||
<resource>
|
||||
<directory>${basedir}/src/main/resources</directory>
|
||||
<includes>
|
||||
<include>yarn-version-info.properties</include>
|
||||
</includes>
|
||||
<filtering>true</filtering>
|
||||
</resource>
|
||||
</resources>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.apache.rat</groupId>
|
||||
@ -87,27 +64,6 @@
|
||||
</excludes>
|
||||
</configuration>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.apache.hadoop</groupId>
|
||||
<artifactId>hadoop-maven-plugins</artifactId>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>version-info</id>
|
||||
<goals>
|
||||
<goal>version-info</goal>
|
||||
</goals>
|
||||
<configuration>
|
||||
<source>
|
||||
<directory>${basedir}/src/main</directory>
|
||||
<includes>
|
||||
<include>java/**/*.java</include>
|
||||
<include>proto/**/*.proto</include>
|
||||
</includes>
|
||||
</source>
|
||||
</configuration>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<artifactId>maven-jar-plugin</artifactId>
|
||||
<executions>
|
||||
@ -171,6 +127,20 @@
|
||||
<goal>exec</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
<execution>
|
||||
<id>generate-version</id>
|
||||
<phase>generate-sources</phase>
|
||||
<configuration>
|
||||
<executable>scripts/saveVersion.sh</executable>
|
||||
<arguments>
|
||||
<argument>${project.version}</argument>
|
||||
<argument>${project.build.directory}</argument>
|
||||
</arguments>
|
||||
</configuration>
|
||||
<goals>
|
||||
<goal>exec</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
|
||||
|
62
hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/scripts/saveVersion.sh
Executable file
62
hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/scripts/saveVersion.sh
Executable file
@ -0,0 +1,62 @@
|
||||
#!/bin/sh
|
||||
|
||||
# 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.
|
||||
|
||||
|
||||
# This file is used to generate the package-info.java class that
|
||||
# records the version, revision, branch, user, timestamp, and url
|
||||
unset LANG
|
||||
unset LC_CTYPE
|
||||
unset LC_TIME
|
||||
version=$1
|
||||
build_dir=$2
|
||||
user=`whoami`
|
||||
date=`date`
|
||||
dir=`pwd`
|
||||
cwd=`dirname $dir`
|
||||
if git rev-parse HEAD 2>/dev/null > /dev/null ; then
|
||||
revision=`git log -1 --pretty=format:"%H" ../`
|
||||
hostname=`hostname`
|
||||
branch=`git branch | sed -n -e 's/^* //p'`
|
||||
url="git://${hostname}${cwd}"
|
||||
elif [ -d .svn ]; then
|
||||
revision=`svn info ../ | sed -n -e 's/Last Changed Rev: \(.*\)/\1/p'`
|
||||
url=`svn info ../ | sed -n -e 's/^URL: \(.*\)/\1/p'`
|
||||
# Get canonical branch (branches/X, tags/X, or trunk)
|
||||
branch=`echo $url | sed -n -e 's,.*\(branches/.*\)$,\1,p' \
|
||||
-e 's,.*\(tags/.*\)$,\1,p' \
|
||||
-e 's,.*trunk$,trunk,p'`
|
||||
else
|
||||
revision="Unknown"
|
||||
branch="Unknown"
|
||||
url="file://$cwd"
|
||||
fi
|
||||
srcChecksum=`find ../ -name '*.java' | grep -v generated-sources | LC_ALL=C sort | xargs md5sum | md5sum | cut -d ' ' -f 1`
|
||||
|
||||
mkdir -p $build_dir/generated-sources/version/org/apache/hadoop/yarn/
|
||||
cat << EOF | \
|
||||
sed -e "s/VERSION/$version/" -e "s/USER/$user/" -e "s/DATE/$date/" \
|
||||
-e "s|URL|$url|" -e "s/REV/$revision/" \
|
||||
-e "s|BRANCH|$branch|" -e "s/SRCCHECKSUM/$srcChecksum/" \
|
||||
> $build_dir/generated-sources/version/org/apache/hadoop/yarn/package-info.java
|
||||
/*
|
||||
* Generated by saveVersion.sh
|
||||
*/
|
||||
@YarnVersionAnnotation(version="VERSION", revision="REV", branch="BRANCH",
|
||||
user="USER", date="DATE", url="URL",
|
||||
srcChecksum="SRCCHECKSUM")
|
||||
package org.apache.hadoop.yarn;
|
||||
EOF
|
@ -20,7 +20,7 @@
|
||||
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
import org.apache.hadoop.util.VersionInfo;
|
||||
import org.apache.hadoop.yarn.YarnVersionAnnotation;
|
||||
import org.apache.hadoop.classification.InterfaceAudience;
|
||||
import org.apache.hadoop.classification.InterfaceStability;
|
||||
|
||||
@ -30,20 +30,31 @@
|
||||
*/
|
||||
@InterfaceAudience.Private
|
||||
@InterfaceStability.Unstable
|
||||
public class YarnVersionInfo extends VersionInfo {
|
||||
public class YarnVersionInfo {
|
||||
private static final Log LOG = LogFactory.getLog(YarnVersionInfo.class);
|
||||
|
||||
private static YarnVersionInfo YARN_VERSION_INFO = new YarnVersionInfo();
|
||||
|
||||
protected YarnVersionInfo() {
|
||||
super("yarn");
|
||||
private static Package myPackage;
|
||||
private static YarnVersionAnnotation version;
|
||||
|
||||
static {
|
||||
myPackage = YarnVersionAnnotation.class.getPackage();
|
||||
version = myPackage.getAnnotation(YarnVersionAnnotation.class);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the meta-data for the Yarn package.
|
||||
* @return
|
||||
*/
|
||||
static Package getPackage() {
|
||||
return myPackage;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the Yarn version.
|
||||
* @return the Yarn version string, eg. "0.6.3-dev"
|
||||
*/
|
||||
public static String getVersion() {
|
||||
return YARN_VERSION_INFO._getVersion();
|
||||
return version != null ? version.version() : "Unknown";
|
||||
}
|
||||
|
||||
/**
|
||||
@ -51,7 +62,7 @@ public static String getVersion() {
|
||||
* @return the revision number, eg. "451451"
|
||||
*/
|
||||
public static String getRevision() {
|
||||
return YARN_VERSION_INFO._getRevision();
|
||||
return version != null ? version.revision() : "Unknown";
|
||||
}
|
||||
|
||||
/**
|
||||
@ -59,7 +70,7 @@ public static String getRevision() {
|
||||
* @return The branch name, e.g. "trunk" or "branches/branch-0.20"
|
||||
*/
|
||||
public static String getBranch() {
|
||||
return YARN_VERSION_INFO._getBranch();
|
||||
return version != null ? version.branch() : "Unknown";
|
||||
}
|
||||
|
||||
/**
|
||||
@ -67,7 +78,7 @@ public static String getBranch() {
|
||||
* @return the compilation date in unix date format
|
||||
*/
|
||||
public static String getDate() {
|
||||
return YARN_VERSION_INFO._getDate();
|
||||
return version != null ? version.date() : "Unknown";
|
||||
}
|
||||
|
||||
/**
|
||||
@ -75,14 +86,14 @@ public static String getDate() {
|
||||
* @return the username of the user
|
||||
*/
|
||||
public static String getUser() {
|
||||
return YARN_VERSION_INFO._getUser();
|
||||
return version != null ? version.user() : "Unknown";
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the subversion URL for the root Yarn directory.
|
||||
*/
|
||||
public static String getUrl() {
|
||||
return YARN_VERSION_INFO._getUrl();
|
||||
return version != null ? version.url() : "Unknown";
|
||||
}
|
||||
|
||||
/**
|
||||
@ -90,7 +101,7 @@ public static String getUrl() {
|
||||
* built.
|
||||
**/
|
||||
public static String getSrcChecksum() {
|
||||
return YARN_VERSION_INFO._getSrcChecksum();
|
||||
return version != null ? version.srcChecksum() : "Unknown";
|
||||
}
|
||||
|
||||
/**
|
||||
@ -98,11 +109,14 @@ public static String getSrcChecksum() {
|
||||
* revision, user and date.
|
||||
*/
|
||||
public static String getBuildVersion(){
|
||||
return YARN_VERSION_INFO._getBuildVersion();
|
||||
return YarnVersionInfo.getVersion() +
|
||||
" from " + YarnVersionInfo.getRevision() +
|
||||
" by " + YarnVersionInfo.getUser() +
|
||||
" source checksum " + YarnVersionInfo.getSrcChecksum();
|
||||
}
|
||||
|
||||
public static void main(String[] args) {
|
||||
LOG.debug("version: "+ getVersion());
|
||||
LOG.debug("version: "+ version);
|
||||
System.out.println("Yarn " + getVersion());
|
||||
System.out.println("Subversion " + getUrl() + " -r " + getRevision());
|
||||
System.out.println("Compiled by " + getUser() + " on " + getDate());
|
||||
|
@ -1,25 +0,0 @@
|
||||
#
|
||||
# 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.
|
||||
#
|
||||
|
||||
version=${pom.version}
|
||||
revision=${version-info.scm.commit}
|
||||
branch=${version-info.scm.branch}
|
||||
user=${user.name}
|
||||
date=${version-info.build.time}
|
||||
url=${version-info.scm.uri}
|
||||
srcChecksum=${version-info.source.md5}
|
1
pom.xml
1
pom.xml
@ -87,7 +87,6 @@ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xs
|
||||
<module>hadoop-project</module>
|
||||
<module>hadoop-project-dist</module>
|
||||
<module>hadoop-assemblies</module>
|
||||
<module>hadoop-maven-plugins</module>
|
||||
<module>hadoop-common-project</module>
|
||||
<module>hadoop-hdfs-project</module>
|
||||
<module>hadoop-yarn-project</module>
|
||||
|
Loading…
Reference in New Issue
Block a user