Explorar o código

HADOOP-2196 Fix how hbase sits in hadoop 'package' product

git-svn-id: https://svn.apache.org/repos/asf/lucene/hadoop/trunk@598469 13f79535-47bb-0310-9956-ffa450edef68
Michael Stack %!s(int64=17) %!d(string=hai) anos
pai
achega
a56413c6d1

+ 1 - 0
src/contrib/hbase/CHANGES.txt

@@ -33,6 +33,7 @@ Trunk (unreleased changes)
    HADOOP-2040 Hudson hangs AFTER test has finished
    HADOOP-2274 Excess synchronization introduced by HADOOP-2139 negatively
                impacts performance
+   HADOOP-2196 Fix how hbase sits in hadoop 'package' product
 
   IMPROVEMENTS
     HADOOP-2401 Add convenience put method that takes writable

+ 12 - 1
src/contrib/hbase/bin/hbase-config.sh

@@ -80,7 +80,18 @@ do
 done
  
 # If no hadoop home specified, then we assume its above this directory.
-HADOOP_HOME="${HADOOP_HOME:-$HBASE_HOME/../../../}"
+# Can be in one of two places.  If we've been packaged, then it'll be
+# two levels above us.  If we are running from src at src/contrib/hbase
+# or from the build directory at build/contrib/hbase, then its three
+# levels up.  Look for the hadoop script.
+if [ "$HADOOP_HOME" = "" ]; then
+    if [ -f "$HBASE_HOME/../../bin/hadoop" ]; then
+      HADOOP_HOME="$HBASE_HOME/../../"
+    else
+      HADOOP_HOME="$HBASE_HOME/../../../"
+    fi
+fi
+
 # Allow alternate hadoop conf dir location.
 HADOOP_CONF_DIR="${HADOOP_CONF_DIR:-$HADOOP_HOME/conf}"
 # Allow alternate hbase conf dir location.

+ 37 - 4
src/contrib/hbase/build.xml

@@ -19,10 +19,6 @@
  * limitations under the License.
  */
 -->
-<!-- 
-Before you can run these subtargets directly, you need 
-to call at top-level: ant deploy-contrib compile-core-test
--->
 <project name="hbase" default="jar">
   <import file="../build-contrib.xml"/>
 
@@ -104,6 +100,43 @@ to call at top-level: ant deploy-contrib compile-core-test
     </jar>
   </target>
 
+  <!--Manage our own packaging... install our dependencies,
+  bin, etc.-->
+  <target name="package" depends="jar" unless="skip.contrib"> 
+    <condition property="dist.dir" value="distribution">
+      <not>
+        <isset property="dist.dir" />
+      </not>
+    </condition>
+    <property name="hbase.dist.dir" value="${dist.dir}/contrib/${name}"/>
+    <mkdir dir="${hbase.dist.dir}"/>
+    <copy todir="${hbase.dist.dir}" includeEmptyDirs="false" flatten="true">
+      <fileset dir="${build.dir}">
+        <include name="hadoop-${version}-${name}.jar" />
+      </fileset>
+    </copy>
+    <mkdir dir="${hbase.dist.dir}/webapps"/>
+    <copy todir="${hbase.dist.dir}/webapps">
+      <fileset dir="${build.webapps}" />
+    </copy>
+    <mkdir dir="${hbase.dist.dir}/lib"/>
+    <copy todir="${hbase.dist.dir}/lib">
+      <fileset dir="${build.lib}" />
+    </copy>
+    <mkdir dir="${hbase.dist.dir}/conf" />
+    <copy todir="${hbase.dist.dir}/conf">
+      <fileset dir="${build.conf}" />
+    </copy>
+    <mkdir dir="${hbase.dist.dir}/bin" />
+    <copy todir="${hbase.dist.dir}/bin">
+      <fileset dir="${build.bin}" />
+    </copy>
+    <chmod perm="ugo+x" type="file">
+      <fileset dir="${hbase.dist.dir}/bin" />
+    </chmod>
+  </target>
+
+
   <!-- Override compile-test  target so can generate a hbase 
        test jar that has test and hbase classes. 
    -->