HADOOP-18604. Add compile platform in the hadoop version output. (#5327). Contributed by Ayush Saxena.

Signed-off-by: Chris Nauroth <cnauroth@apache.org>
This commit is contained in:
Ayush Saxena 2023-01-28 14:19:19 +05:30 committed by GitHub
parent b677d40ab5
commit 952d707240
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 14 additions and 0 deletions

View File

@ -93,6 +93,10 @@ protected String _getProtocVersion() {
return info.getProperty("protocVersion", "Unknown"); return info.getProperty("protocVersion", "Unknown");
} }
protected String _getCompilePlatform() {
return info.getProperty("compilePlatform", "Unknown");
}
private static VersionInfo COMMON_VERSION_INFO = new VersionInfo("common"); private static VersionInfo COMMON_VERSION_INFO = new VersionInfo("common");
/** /**
* Get the Hadoop version. * Get the Hadoop version.
@ -167,12 +171,21 @@ public static String getProtocVersion(){
return COMMON_VERSION_INFO._getProtocVersion(); return COMMON_VERSION_INFO._getProtocVersion();
} }
/**
* Returns the OS platform used for the build.
* @return the OS platform
*/
public static String getCompilePlatform() {
return COMMON_VERSION_INFO._getCompilePlatform();
}
public static void main(String[] args) { public static void main(String[] args) {
LOG.debug("version: "+ getVersion()); LOG.debug("version: "+ getVersion());
System.out.println("Hadoop " + getVersion()); System.out.println("Hadoop " + getVersion());
System.out.println("Source code repository " + getUrl() + " -r " + System.out.println("Source code repository " + getUrl() + " -r " +
getRevision()); getRevision());
System.out.println("Compiled by " + getUser() + " on " + getDate()); System.out.println("Compiled by " + getUser() + " on " + getDate());
System.out.println("Compiled on platform " + getCompilePlatform());
System.out.println("Compiled with protoc " + getProtocVersion()); System.out.println("Compiled with protoc " + getProtocVersion());
System.out.println("From source with checksum " + getSrcChecksum()); System.out.println("From source with checksum " + getSrcChecksum());
System.out.println("This command was run using " + System.out.println("This command was run using " +

View File

@ -24,3 +24,4 @@ date=${version-info.build.time}
url=${version-info.scm.uri} url=${version-info.scm.uri}
srcChecksum=${version-info.source.md5} srcChecksum=${version-info.source.md5}
protocVersion=${hadoop.protobuf.version} protocVersion=${hadoop.protobuf.version}
compilePlatform=${os.detected.classifier}