hadoop-common-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cutt...@apache.org
Subject svn commit: r452633 - in /lucene/hadoop/trunk: ./ bin/ src/ src/java/org/apache/hadoop/ src/java/org/apache/hadoop/util/ src/webapps/dfs/ src/webapps/job/ src/webapps/task/
Date Tue, 03 Oct 2006 21:30:39 GMT
Author: cutting
Date: Tue Oct  3 14:30:38 2006
New Revision: 452633

URL: http://svn.apache.org/viewvc?view=rev&rev=452633
Log:
HADOOP-567.  Record version and revision information in builds.  Contributed by Owen.

Added:
    lucene/hadoop/trunk/src/java/org/apache/hadoop/HadoopVersionAnnotation.java
    lucene/hadoop/trunk/src/java/org/apache/hadoop/util/VersionInfo.java
    lucene/hadoop/trunk/src/saveVersion.sh   (with props)
Modified:
    lucene/hadoop/trunk/CHANGES.txt
    lucene/hadoop/trunk/bin/hadoop
    lucene/hadoop/trunk/build.xml
    lucene/hadoop/trunk/src/webapps/dfs/dfshealth.jsp
    lucene/hadoop/trunk/src/webapps/job/jobtracker.jsp
    lucene/hadoop/trunk/src/webapps/task/tasktracker.jsp

Modified: lucene/hadoop/trunk/CHANGES.txt
URL: http://svn.apache.org/viewvc/lucene/hadoop/trunk/CHANGES.txt?view=diff&rev=452633&r1=452632&r2=452633
==============================================================================
--- lucene/hadoop/trunk/CHANGES.txt (original)
+++ lucene/hadoop/trunk/CHANGES.txt Tue Oct  3 14:30:38 2006
@@ -116,6 +116,14 @@
     Since these formats are always sorted, block compression can
     provide a big advantage.  (cutting)
 
+29. HADOOP-567. Record version and revision information in builds.  A
+    package manifest is added to the generated jar file containing
+    version information, and a VersionInfo utility is added that
+    includes further information, including the build date and user,
+    and the subversion revision and repository.  A 'bin/hadoop
+    version' comand is added to show this information, and it is also
+    added to various web interfaces.  (omalley via cutting)
+
 
 Release 0.6.2 - 2006-09-18
 

Modified: lucene/hadoop/trunk/bin/hadoop
URL: http://svn.apache.org/viewvc/lucene/hadoop/trunk/bin/hadoop?view=diff&rev=452633&r1=452632&r2=452633
==============================================================================
--- lucene/hadoop/trunk/bin/hadoop (original)
+++ lucene/hadoop/trunk/bin/hadoop Tue Oct  3 14:30:38 2006
@@ -33,6 +33,7 @@
   echo "  jobtracker        run the MapReduce job Tracker node" 
   echo "  tasktracker       run a MapReduce task Tracker node" 
   echo "  job               manipulate MapReduce jobs" 
+  echo "  version           print the version"
   echo "  jar <jar>         run a jar file"
   echo "  distcp <srcurl> <desturl> copy file or directories recursively"
   echo " or"
@@ -131,6 +132,8 @@
   CLASS=org.apache.hadoop.mapred.TaskTracker
 elif [ "$COMMAND" = "job" ] ; then
   CLASS=org.apache.hadoop.mapred.JobClient
+elif [ "$COMMAND" = "version" ] ; then
+  CLASS=org.apache.hadoop.util.VersionInfo
 elif [ "$COMMAND" = "jar" ] ; then
   CLASS=org.apache.hadoop.util.RunJar
 elif [ "$COMMAND" = "distcp" ] ; then

Modified: lucene/hadoop/trunk/build.xml
URL: http://svn.apache.org/viewvc/lucene/hadoop/trunk/build.xml?view=diff&rev=452633&r1=452632&r2=452633
==============================================================================
--- lucene/hadoop/trunk/build.xml (original)
+++ lucene/hadoop/trunk/build.xml Tue Oct  3 14:30:38 2006
@@ -120,6 +120,10 @@
       <fileset dir="${conf.dir}" includes="**/*.template"/>
       <mapper type="glob" from="*.template" to="*"/>
     </copy>
+
+    <exec executable="sh">
+       <arg line="src/saveVersion.sh ${version}"/>
+    </exec>
   </target>
 
   <!-- ====================================================== -->
@@ -218,6 +222,13 @@
     </tar>
     <jar jarfile="${build.dir}/${final.name}.jar"
          basedir="${build.classes}">
+      <manifest>
+        <section name="org/apache/hadoop">
+          <attribute name="Implementation-Title" value="Hadoop"/>
+          <attribute name="Implementation-Version" value="${version}"/>
+          <attribute name="Implementation-Vendor" value="Apache"/>
+        </section>
+      </manifest>
       <fileset file="${conf.dir}/hadoop-default.xml"/>
       <fileset file="${conf.dir}/mapred-default.xml"/>
       <fileset file="${conf.dir}/commons-logging.properties"/>

Added: lucene/hadoop/trunk/src/java/org/apache/hadoop/HadoopVersionAnnotation.java
URL: http://svn.apache.org/viewvc/lucene/hadoop/trunk/src/java/org/apache/hadoop/HadoopVersionAnnotation.java?view=auto&rev=452633
==============================================================================
--- lucene/hadoop/trunk/src/java/org/apache/hadoop/HadoopVersionAnnotation.java (added)
+++ lucene/hadoop/trunk/src/java/org/apache/hadoop/HadoopVersionAnnotation.java Tue Oct  3
14:30:38 2006
@@ -0,0 +1,55 @@
+/*
+ * Copyright 2006 The Apache Software Foundation
+ *
+ * Licensed 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.*;
+
+/**
+ * A package attribute that captures the version of Hadoop that was compiled.
+ * @author Owen O'Malley
+ */
+@Retention(RetentionPolicy.RUNTIME)
+@Target(ElementType.PACKAGE)
+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();
+}

Added: lucene/hadoop/trunk/src/java/org/apache/hadoop/util/VersionInfo.java
URL: http://svn.apache.org/viewvc/lucene/hadoop/trunk/src/java/org/apache/hadoop/util/VersionInfo.java?view=auto&rev=452633
==============================================================================
--- lucene/hadoop/trunk/src/java/org/apache/hadoop/util/VersionInfo.java (added)
+++ lucene/hadoop/trunk/src/java/org/apache/hadoop/util/VersionInfo.java Tue Oct  3 14:30:38
2006
@@ -0,0 +1,87 @@
+/*
+ * Copyright 2006 The Apache Software Foundation
+ *
+ * Licensed 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.util;
+
+import org.apache.hadoop.HadoopVersionAnnotation;
+
+/**
+ * This class finds the package info for Hadoop and the HadoopVersionAnnotation
+ * information.
+ * @author Owen O'Malley
+ */
+public class VersionInfo {
+  private static Package myPackage;
+  private static HadoopVersionAnnotation version;
+  
+  static {
+    myPackage = HadoopVersionAnnotation.class.getPackage();
+    version = myPackage.getAnnotation(HadoopVersionAnnotation.class);
+  }
+
+  /**
+   * Get the meta-data for the Hadoop package.
+   * @return
+   */
+  static Package getPackage() {
+    return myPackage;
+  }
+  
+  /**
+   * Get the Hadoop version.
+   * @return the Hadoop version string, eg. "0.6.3-dev"
+   */
+  public static String getVersion() {
+    return version != null ? version.version() : "Unknown";
+  }
+  
+  /**
+   * Get the subversion revision number for the root directory
+   * @return the revision number, eg. "451451"
+   */
+  public static String getRevision() {
+    return version != null ? version.revision() : "Unknown";
+  }
+  
+  /**
+   * The date that Hadoop was compiled.
+   * @return the compilation date in unix date format
+   */
+  public static String getDate() {
+    return version != null ? version.date() : "Unknown";
+  }
+  
+  /**
+   * The user that compiled Hadoop.
+   * @return the username of the user
+   */
+  public static String getUser() {
+    return version != null ? version.user() : "Unknown";
+  }
+  
+  /**
+   * Get the subversion URL for the root Hadoop directory.
+   */
+  public static String getUrl() {
+    return version != null ? version.url() : "Unknown";
+  }
+  
+  public static void main(String[] args) {
+    System.out.println("Hadoop " + getVersion());
+    System.out.println("Subversion " + getUrl() + " -r " + getRevision());
+    System.out.println("Compiled by " + getUser() + " on " + getDate());
+  }
+}

Added: lucene/hadoop/trunk/src/saveVersion.sh
URL: http://svn.apache.org/viewvc/lucene/hadoop/trunk/src/saveVersion.sh?view=auto&rev=452633
==============================================================================
--- lucene/hadoop/trunk/src/saveVersion.sh (added)
+++ lucene/hadoop/trunk/src/saveVersion.sh Tue Oct  3 14:30:38 2006
@@ -0,0 +1,20 @@
+#!/bin/sh
+# This file is used to generate the BuildStamp.java class that
+# records the user, url, revision and timestamp.
+version=$1
+revision=`svn info | sed -n -e 's/Last Changed Rev: \(.*\)/\1/p'`
+url=`svn info | sed -n -e 's/URL: \(.*\)/\1/p'`
+user=`whoami`
+date=`date`
+mkdir -p build/src/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/" \
+      > build/src/org/apache/hadoop/package-info.java
+/*
+ * Generated by src/saveVersion.sh
+ */
+@HadoopVersionAnnotation(version="VERSION", revision="REV", 
+                         user="USER", date="DATE", url="URL")
+package org.apache.hadoop;
+EOF

Propchange: lucene/hadoop/trunk/src/saveVersion.sh
------------------------------------------------------------------------------
    svn:executable = *

Modified: lucene/hadoop/trunk/src/webapps/dfs/dfshealth.jsp
URL: http://svn.apache.org/viewvc/lucene/hadoop/trunk/src/webapps/dfs/dfshealth.jsp?view=diff&rev=452633&r1=452632&r2=452633
==============================================================================
--- lucene/hadoop/trunk/src/webapps/dfs/dfshealth.jsp (original)
+++ lucene/hadoop/trunk/src/webapps/dfs/dfshealth.jsp Tue Oct  3 14:30:38 2006
@@ -5,6 +5,7 @@
   import="java.io.*"
   import="java.util.*"
   import="org.apache.hadoop.dfs.*"
+  import="org.apache.hadoop.util.*"
   import="java.text.DateFormat"
 %>
 <%!
@@ -101,7 +102,12 @@
 <body>
 <h1>NameNode '<%=namenodeLabel%>'</h1>
 
-This NameNode has been up since <%= fsn.getStartTime()%>.<br><br>
+<b>Started:</b> <%= fsn.getStartTime()%><br>
+<b>Version:</b> <%= VersionInfo.getVersion()%>,
+                r<%= VersionInfo.getRevision()%><br>
+<b>Compiled:</b> <%= VersionInfo.getDate()%> by 
+                 <%= VersionInfo.getUser()%><br>
+
 <b><a href="/nn_browsedfscontent.jsp">Browse the filesystem</a></b>
 <hr>
 <h2>Cluster Summary</h2>

Modified: lucene/hadoop/trunk/src/webapps/job/jobtracker.jsp
URL: http://svn.apache.org/viewvc/lucene/hadoop/trunk/src/webapps/job/jobtracker.jsp?view=diff&rev=452633&r1=452632&r2=452633
==============================================================================
--- lucene/hadoop/trunk/src/webapps/job/jobtracker.jsp (original)
+++ lucene/hadoop/trunk/src/webapps/job/jobtracker.jsp Tue Oct  3 14:30:38 2006
@@ -78,8 +78,12 @@
 <body>
 <h1><%= trackerLabel %> Hadoop Map/Reduce Administration</h1>
 
-This JobTracker has been up since <%= new Date(tracker.getStartTime())%>.<br>
-
+<b>Started:</b> <%= new Date(tracker.getStartTime())%><br>
+<b>Version:</b> <%= VersionInfo.getVersion()%>,
+                r<%= VersionInfo.getRevision()%><br>
+<b>Compiled:</b> <%= VersionInfo.getDate()%> by 
+                 <%= VersionInfo.getUser()%><br>
+                   
 <hr>
 <h2>Cluster Summary</h2>
 <center>

Modified: lucene/hadoop/trunk/src/webapps/task/tasktracker.jsp
URL: http://svn.apache.org/viewvc/lucene/hadoop/trunk/src/webapps/task/tasktracker.jsp?view=diff&rev=452633&r1=452632&r2=452633
==============================================================================
--- lucene/hadoop/trunk/src/webapps/task/tasktracker.jsp (original)
+++ lucene/hadoop/trunk/src/webapps/task/tasktracker.jsp Tue Oct  3 14:30:38 2006
@@ -19,7 +19,11 @@
 
 <body>
 <h1><%= trackerName %> Task Tracker Status</h1>
-<img src="/static/hadoop-logo.jpg"/>
+<img src="/static/hadoop-logo.jpg"/><br>
+<b>Version:</b> <%= VersionInfo.getVersion()%>,
+                r<%= VersionInfo.getRevision()%><br>
+<b>Compiled:</b> <%= VersionInfo.getDate()%> by 
+                 <%= VersionInfo.getUser()%><br>
 
 <h2>Running tasks</h2>
 <center>



Mime
View raw message