HBASE-403 Fix build after move of hbase in svn

A  lib/commons-httpclient-3.0.1.jar
M src/test/org/apache/hadoop/hbase/MiniHBaseCluster.java
    If not null, run shutdown of hbase cluster.
A src/java/org/apache/hadoop/hbase/util/VersionInfo.java
A src/java/org/apache/hadoop/hbase/VersionAnnotation.java
A src/saveVersion.sh
    Bring down the hadoop version publishing system.
M src/java/org/apache/hadoop/hbase/util/InfoServer.java
    Print out problematic path.
M build.xml
    Need to put the hadoop jar in front of hbase else
    complaints that dfs webapps, etc., can't be found.
    (Need to fix HttpStatusServer in hadoop).


git-svn-id: https://svn.apache.org/repos/asf/hadoop/hbase/trunk@618517 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Michael Stack 2008-02-05 02:32:22 +00:00
parent d20233e87b
commit 39bff3580b
7 changed files with 208 additions and 19 deletions

View File

@ -18,6 +18,9 @@
-->
<project name="hbase" default="jar">
<property name="version" value="0.1.0-dev"/>
<property name="final.name" value="${name}-${version}"/>
<!-- Load all the default properties, and any the user wants -->
<!-- to contribute (without having to type -D or edit this file -->
<property file="${user.home}/${name}.build.properties" />
@ -37,7 +40,7 @@
<property name="build.dir" location="${basedir}/build"/>
<property name="build.bin" location="${build.dir}/bin"/>
<property name="build.conf" location="${build.dir}/conf"/>
<property name="build.webapps" location="${build.dir}/webpps"/>
<property name="build.webapps" location="${build.dir}/webapps"/>
<property name="build.lib" location="${build.dir}/lib"/>
<property name="build.classes" location="${build.dir}/classes"/>
<property name="build.test" location="${build.dir}/test"/>
@ -47,8 +50,6 @@
<property name="test.log.dir" value="${test.build.dir}/logs"/>
<property name="test.junit.output.format" value="plain"/>
<!-- all jars together -->
<property name="javac.deprecation" value="off"/>
<property name="javac.debug" value="on"/>
@ -57,15 +58,20 @@
<property name="build.encoding" value="ISO-8859-1"/>
<!-- the normal classpath -->
<fileset id="lib.jars" dir="${basedir}" includes="lib/*.jar"/>
<!--We need to have the hadoop jars ride in front of the hbase classes or we
get the below exceptions:
[junit] java.io.FileNotFoundException: file:/Users/stack/Documents/checkouts/hbase/trunk/build/webapps/dfs
When we move off 0.16.0 hadoop, fix HttpStatusServer
-->
<fileset id="lib.jars" dir="${basedir}" includes="lib/*.jar"/>
<path id="classpath">
<pathelement location="${build.classes}"/>
<fileset refid="lib.jars"/>
<fileset dir="${basedir}/lib/jetty-ext/">
<include name="*jar" />
<fileset dir="${lib.dir}/jetty-ext/">
<include name="*jar" />
</fileset>
<pathelement location="${build.classes}"/>
<pathelement location="${conf.dir}"/>
</path>
@ -75,12 +81,6 @@
<mkdir dir="${build.test}"/>
<mkdir dir="${build.examples}"/>
<!--Version is set only if called from hadoop build.xml. Set a default-->
<condition property="version" value="0.1.0-dev">
<not>
<isset property="version" />
</not>
</condition>
<!--Copy webapps over to build dir. Exclude jsp and generated-src java
classes -->
<mkdir dir="${build.webapps}"/>
@ -94,7 +94,7 @@
<!--Copy bin, lib, and conf. too-->
<mkdir dir="${build.lib}"/>
<copy todir="${build.lib}">
<fileset dir="${basedir}/lib" />
<fileset dir="${lib.dir}" />
</copy>
<mkdir dir="${build.conf}"/>
<copy todir="${build.conf}">
@ -107,6 +107,9 @@
<chmod perm="ugo+x" type="file">
<fileset dir="${build.bin}" />
</chmod>
<exec executable="sh">
<arg line="src/saveVersion.sh ${version}"/>
</exec>
</target>
<target name="javacc" if="javacc.home">
@ -131,7 +134,6 @@
debug="${javac.debug}"
deprecation="${javac.deprecation}">
<classpath refid="classpath"/>
<classpath path="path"/>
</javac>
</target>
@ -185,11 +187,12 @@
<!-- Run unit tests -->
<!-- ================================================================== -->
<path id="test.classpath">
<path refid="classpath"/>
<pathelement location="${build.test}" />
<pathelement location="${src.test}"/>
<pathelement location="${conf.dir}"/>
<pathelement location="${build.dir}"/>
<path refid="classpath"/>
<pathelement location="${build.webapps}"/>
</path>
<target name="compile-test" depends="compile" >

Binary file not shown.

View File

@ -0,0 +1,57 @@
/*
* 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.hbase;
import java.lang.annotation.*;
/**
* A package attribute that captures the version of hbase that was compiled.
* Copied down from hadoop. All is same except name of interface.
*/
@Retention(RetentionPolicy.RUNTIME)
@Target(ElementType.PACKAGE)
public @interface VersionAnnotation {
/**
* 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();
}

View File

@ -178,7 +178,7 @@ public class InfoServer {
private static String getWebAppsPath(final String path) throws IOException {
URL url = InfoServer.class.getClassLoader().getResource(path);
if (url == null)
throw new IOException("webapps not found in CLASSPATH");
throw new IOException("webapps not found in CLASSPATH: " + path);
return url.toString();
}

View File

@ -0,0 +1,88 @@
/*
* 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.hbase.util;
import org.apache.hadoop.hbase.VersionAnnotation;
/**
* This class finds the package info for hbase and the VersionAnnotation
* information. Taken from hadoop. Only name of annotation is different.
*/
public class VersionInfo {
private static Package myPackage;
private static VersionAnnotation version;
static {
myPackage = VersionAnnotation.class.getPackage();
version = myPackage.getAnnotation(VersionAnnotation.class);
}
/**
* Get the meta-data for the hbase package.
* @return
*/
static Package getPackage() {
return myPackage;
}
/**
* Get the hbase version.
* @return the hbase 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 hbase was compiled.
* @return the compilation date in unix date format
*/
public static String getDate() {
return version != null ? version.date() : "Unknown";
}
/**
* The user that compiled hbase.
* @return the username of the user
*/
public static String getUser() {
return version != null ? version.user() : "Unknown";
}
/**
* Get the subversion URL for the root hbase directory.
*/
public static String getUrl() {
return version != null ? version.url() : "Unknown";
}
public static void main(String[] args) {
System.out.println("HBase " + getVersion());
System.out.println("Subversion " + getUrl() + " -r " + getRevision());
System.out.println("Compiled by " + getUser() + " on " + getDate());
}
}

39
src/saveVersion.sh Executable file
View File

@ -0,0 +1,39 @@
#!/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 annotation of package info that
# records the user, url, revision and timestamp.
#
# Copied from hadoop.
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/hbase
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/hbase/package-info.java
/*
* Generated by src/saveVersion.sh
*/
@VersionAnnotation(version="VERSION", revision="REV",
user="USER", date="DATE", url="URL")
package org.apache.hadoop.hbase;
EOF

View File

@ -233,7 +233,9 @@ public class MiniHBaseCluster implements HConstants {
* Shut down the mini HBase cluster
*/
public void shutdown() {
this.hbaseCluster.shutdown();
if (this.hbaseCluster != null) {
this.hbaseCluster.shutdown();
}
if (shutdownDFS) {
StaticTestEnvironment.shutdownDfs(cluster);
}