Quellcode durchsuchen

Merge -r 704731:704722 from trunk to branch-0.19 to fix HADOOP-4150.

git-svn-id: https://svn.apache.org/repos/asf/hadoop/core/branches/branch-0.19@704733 13f79535-47bb-0310-9956-ffa450edef68
Arun Murthy vor 16 Jahren
Ursprung
Commit
be4c671390
4 geänderte Dateien mit 89 neuen und 40 gelöschten Zeilen
  1. 3 0
      CHANGES.txt
  2. 43 2
      build.xml
  3. 29 26
      src/c++/librecordio/Makefile
  4. 14 12
      src/c++/librecordio/test/Makefile

+ 3 - 0
CHANGES.txt

@@ -439,6 +439,9 @@ Release 0.19.0 - Unreleased
 
     HADOOP-3790. Add more unit tests for testing HDFS file append.  (szetszwo)
 
+    HADOOP-4150. Include librecordio in hadoop releases. (Giridharan Kesavan
+    via acmurthy) 
+
   OPTIMIZATIONS
 
     HADOOP-3556. Removed lock contention in MD5Hash by changing the 

+ 43 - 2
build.xml

@@ -49,8 +49,10 @@
   <property name="c++.pipes.src" value="${c++.src}/pipes"/>
   <property name="c++.examples.pipes.src" value="${examples.dir}/pipes"/>
   <property name="libhdfs.src" value="${c++.src}/libhdfs"/>
+  <property name="librecordio.src" value="${c++.src}/librecordio"/>
   <property name="tools.src" value="${basedir}/src/tools"/>
 
+  <property name="xercescroot" value=""/> 
   <property name="build.dir" value="${basedir}/build"/>
   <property name="build.classes" value="${build.dir}/classes"/>
   <property name="build.src" value="${build.dir}/src"/>
@@ -59,6 +61,7 @@
   <property name="build.examples" value="${build.dir}/examples"/>
   <property name="build.anttasks" value="${build.dir}/ant"/>
   <property name="build.libhdfs" value="${build.dir}/libhdfs"/>
+  <property name="build.librecordio" value="${build.dir}/librecordio"/>
   <!-- convert spaces to _ so that mac os doesn't break things -->
   <exec executable="sed" inputstring="${os.name}" 
         outputproperty="nonspace.os">
@@ -106,6 +109,7 @@
   <property name="libhdfs.test.conf.dir" value="${libhdfs.src}/tests/conf"/>
   <property name="libhdfs.test.dir" value="${test.build.dir}/libhdfs"/>
 
+  <property name="librecordio.test.dir" value="${test.build.dir}/librecordio"/>
   <property name="web.src.dir" value="${basedir}/src/web"/>
   <property name="src.webapps" value="${basedir}/src/webapps"/>
 
@@ -929,7 +933,7 @@
   <!-- ================================================================== -->
   <!--                                                                    -->
   <!-- ================================================================== -->
-  <target name="package" depends="compile, jar, javadoc, examples, tools-jar, jar-test, ant-tasks, package-libhdfs"
+  <target name="package" depends="compile, jar, javadoc, examples, tools-jar, jar-test, ant-tasks, package-libhdfs, package-librecordio"
 	  description="Build distribution">
     <mkdir dir="${dist.dir}"/>
     <mkdir dir="${dist.dir}/lib"/>
@@ -1135,7 +1139,44 @@
   		<arg line="-sf libhdfs.so.${libhdfs.version} libhdfs.so"/>
   	</exec>
   </target>
-		
+<!-- ================================================================== -->
+<!-- librecordio targets.                                               -->
+<!-- ================================================================== -->		
+
+  <target name="compile-librecordio" depends="init" if="librecordio" >
+     <mkdir dir="${build.librecordio}"/>
+     <exec dir="${librecordio.src}" executable="${make.cmd}" failonerror="true">
+        <env key="XERCESCROOT" value="${xercescroot}"/>
+        <env key="LIBRECORDIO_BUILD_DIR" value="${build.librecordio}"/>
+     </exec>
+  </target>
+  	
+  <target name="test-librecordio" depends="compile-librecordio, compile-core" if="librecordio">
+    <delete dir="${librecordio.test.dir}"/>
+    <mkdir dir="${librecordio.test.dir}"/>
+    <exec dir="${librecordio.src}/test" executable="${make.cmd}" failonerror="true">
+        <env key="HADOOP_HOME" value="${basedir}"/>
+	<env key="XERCESCROOT" value="${xercescroot}"/>
+        <env key="LIBRECORDIO_BUILD_DIR" value="${build.librecordio}"/> 	
+        <env key="LIBRECORDIO_TEST_DIR" value="${librecordio.test.dir}"/>
+      		<arg value="all"/>		
+    </exec>
+  </target>
+
+  <target name="package-librecordio" depends="compile-librecordio" if="librecordio">
+    <mkdir dir="${dist.dir}/librecordio"/> 
+    <copy todir="${dist.dir}/librecordio">
+       <fileset dir="${build.librecordio}" casesensitive="yes" followsymlinks="false">
+          <exclude name="**/tests/**"/>
+          <exclude name="*.so"/> 
+          <exclude name="*.o"/>
+       </fileset>
+    </copy>
+    <chmod perm="ugo+x" type="file">
+       <fileset dir="${dist.dir}/librecordio"/>
+    </chmod>
+  </target>
+ 
   <target name="create-c++-configure" depends="init" if="compile.c++">
     <exec executable="autoreconf" dir="${c++.utils.src}" searchpath="yes" 
           failonerror="yes">

+ 29 - 26
src/c++/librecordio/Makefile

@@ -16,40 +16,43 @@
 
 COPTS=-g3 -O0 -Wall
 
-all: librecordio.a test
+all: ${LIBRECORDIO_BUILD_DIR}/librecordio.a
 
-librecordio.a: recordio.o filestream.o binarchive.o csvarchive.o xmlarchive.o \
-	exception.o typeIDs.o fieldTypeInfo.o recordTypeInfo.o utils.o
-	ar cru librecordio.a recordio.o filestream.o binarchive.o csvarchive.o xmlarchive.o \
-	exception.o typeIDs.o fieldTypeInfo.o recordTypeInfo.o utils.o
+COBJS = $(addprefix ${LIBRECORDIO_BUILD_DIR}/, recordio.o filestream.o binarchive.o csvarchive.o xmlarchive.o \
+	exception.o typeIDs.o fieldTypeInfo.o recordTypeInfo.o utils.o)
 
-recordio.o: recordio.cc recordio.hh archive.hh
-	g++ ${COPTS} -c -I${XERCESCROOT}/include -o recordio.o recordio.cc
+CCMD = $(addprefix ${LIBRECORDIO_BUILD_DIR}/, librecordio.a recordio.o filestream.o binarchive.o csvarchive.o xmlarchive.o \
+        exception.o typeIDs.o fieldTypeInfo.o recordTypeInfo.o utils.o)
 
-filestream.o: filestream.cc recordio.hh filestream.hh
-	g++ ${COPTS} -c -o filestream.o filestream.cc
+${LIBRECORDIO_BUILD_DIR}/librecordio.a: ${COBJS}
+	ar cru ${CCMD}
 
-binarchive.o: binarchive.cc recordio.hh binarchive.hh archive.hh
-	g++ ${COPTS} -c -o binarchive.o binarchive.cc
+${LIBRECORDIO_BUILD_DIR}/recordio.o: recordio.cc recordio.hh archive.hh
+	g++ ${COPTS} -c -I${XERCESCROOT}/include -o ${LIBRECORDIO_BUILD_DIR}/recordio.o recordio.cc
 
-csvarchive.o: csvarchive.cc recordio.hh csvarchive.hh archive.hh
-	g++ ${COPTS} -c -o csvarchive.o csvarchive.cc
+${LIBRECORDIO_BUILD_DIR}/filestream.o: filestream.cc recordio.hh filestream.hh
+	g++ ${COPTS} -c -o ${LIBRECORDIO_BUILD_DIR}/filestream.o filestream.cc
 
-xmlarchive.o: xmlarchive.cc recordio.hh xmlarchive.hh archive.hh
-	g++ ${COPTS} -c -I${XERCESCROOT}/include -o xmlarchive.o xmlarchive.cc
+${LIBRECORDIO_BUILD_DIR}/binarchive.o: binarchive.cc recordio.hh binarchive.hh archive.hh
+	g++ ${COPTS} -c -o ${LIBRECORDIO_BUILD_DIR}/binarchive.o binarchive.cc
 
-exception.o: exception.cc exception.hh
-	g++ ${COPTS} -c -o exception.o exception.cc
+${LIBRECORDIO_BUILD_DIR}/csvarchive.o: csvarchive.cc recordio.hh csvarchive.hh archive.hh
+	g++ ${COPTS} -c -o ${LIBRECORDIO_BUILD_DIR}/csvarchive.o csvarchive.cc
 
-typeIDs.o: typeIDs.cc typeIDs.hh
-	g++ ${COPTS} -c -o typeIDs.o typeIDs.cc
-fieldTypeInfo.o: fieldTypeInfo.cc fieldTypeInfo.hh
-	g++ ${COPTS} -c -o fieldTypeInfo.o fieldTypeInfo.cc
-recordTypeInfo.o: recordTypeInfo.cc recordTypeInfo.hh
-	g++ ${COPTS} -c -o recordTypeInfo.o recordTypeInfo.cc
-utils.o: utils.cc utils.hh
-	g++ ${COPTS} -c -o utils.o utils.cc
+${LIBRECORDIO_BUILD_DIR}/xmlarchive.o: xmlarchive.cc recordio.hh xmlarchive.hh archive.hh
+	g++ ${COPTS} -c -I${XERCESCROOT}/include -o ${LIBRECORDIO_BUILD_DIR}/xmlarchive.o xmlarchive.cc
 
+${LIBRECORDIO_BUILD_DIR}/exception.o: exception.cc exception.hh
+	g++ ${COPTS} -c -o ${LIBRECORDIO_BUILD_DIR}/exception.o exception.cc
+
+${LIBRECORDIO_BUILD_DIR}/typeIDs.o: typeIDs.cc typeIDs.hh
+	g++ ${COPTS} -c -o ${LIBRECORDIO_BUILD_DIR}/typeIDs.o typeIDs.cc
+${LIBRECORDIO_BUILD_DIR}/fieldTypeInfo.o: fieldTypeInfo.cc fieldTypeInfo.hh
+	g++ ${COPTS} -c -o ${LIBRECORDIO_BUILD_DIR}/fieldTypeInfo.o fieldTypeInfo.cc
+${LIBRECORDIO_BUILD_DIR}/recordTypeInfo.o: recordTypeInfo.cc recordTypeInfo.hh
+	g++ ${COPTS} -c -o ${LIBRECORDIO_BUILD_DIR}/recordTypeInfo.o recordTypeInfo.cc
+${LIBRECORDIO_BUILD_DIR}/utils.o: utils.cc utils.hh
+	g++ ${COPTS} -c -o ${LIBRECORDIO_BUILD_DIR}/utils.o utils.cc
 recordio.cc: recordio.hh archive.hh exception.hh
 filestream.cc: recordio.hh filestream.hh 
 binarchive.cc: recordio.hh binarchive.hh 
@@ -65,5 +68,5 @@ test: librecordio.a
 	make -C test all
 
 clean:
-	rm -f *~ *.o *.a
+	rm -f ${LIBRECORDIO_BUILD_DIR}/*~ ${LIBRECORDIO_BUILD_DIR}/*.o ${LIBRECORDIO_BUILD_DIR}/*.a
 	make -C test clean

+ 14 - 12
src/c++/librecordio/test/Makefile

@@ -18,21 +18,22 @@ COPTS=-g3 -O0 -Wall
 
 all: test testFromJava
 
-test: test.o test.jr.o
-	g++ -g3 -O0 -o test test.o test.jr.o -L.. -L${XERCESCROOT}/lib -lrecordio -lxerces-c
+test: ${LIBRECORDIO_TEST_DIR}/test.o ${LIBRECORDIO_TEST_DIR}/test.jr.o
+	g++ -g3 -O0 -o ${LIBRECORDIO_TEST_DIR}/test ${LIBRECORDIO_TEST_DIR}/test.o \
+	${LIBRECORDIO_TEST_DIR}/test.jr.o -L${LIBRECORDIO_BUILD_DIR} -L${XERCESCROOT}/lib -lrecordio -lxerces-c
 	
-test.o: test.cc
-	g++ ${COPTS} -c -I.. -o test.o test.cc
+${LIBRECORDIO_TEST_DIR}/test.o: test.cc
+	g++ ${COPTS} -c -I .. -o ${LIBRECORDIO_TEST_DIR}/test.o test.cc
 
-testFromJava: testFromJava.o test.jr.o
-	g++ -g3 -O0 -o testFromJava testFromJava.o test.jr.o -L.. -L${XERCESCROOT}/lib -lrecordio -lxerces-c
+testFromJava: ${LIBRECORDIO_TEST_DIR}/testFromJava.o ${LIBRECORDIO_TEST_DIR}/test.jr.o
+	g++ -g3 -O0 -o ${LIBRECORDIO_TEST_DIR}/testFromJava ${LIBRECORDIO_TEST_DIR}/testFromJava.o ${LIBRECORDIO_TEST_DIR}/test.jr.o \
+	-L${LIBRECORDIO_BUILD_DIR} -L${XERCESCROOT}/lib -lrecordio -lxerces-c
 	
-testFromJava.o: testFromJava.cc
-	g++ ${COPTS} -c -I.. -o testFromJava.o testFromJava.cc
+${LIBRECORDIO_TEST_DIR}/testFromJava.o: testFromJava.cc
+	g++ ${COPTS} -c -I.. -o ${LIBRECORDIO_TEST_DIR}/testFromJava.o testFromJava.cc
 
-
-test.jr.o: test.jr.cc
-	g++ ${COPTS} -c -I.. -o test.jr.o test.jr.cc
+${LIBRECORDIO_TEST_DIR}/test.jr.o: test.jr.cc
+	g++ ${COPTS} -c -I..  -o ${LIBRECORDIO_TEST_DIR}/test.jr.o test.jr.cc
 
 %.jr.cc %.jr.hh: %.jr
 	${HADOOP_HOME}/bin/rcc --language c++ $<
@@ -44,5 +45,6 @@ test.cc: test.hh
 test.hh: test.jr.hh ../recordio.hh ../filestream.hh
 
 clean:
-	rm -f *~ *.o test testFromJava *.jr.*
+	rm -f ${LIBRECORDIO_TEST_DIR}/*~ ${LIBRECORDIO_TEST_DIR}/*.o ${LIBRECORDIO_TEST_DIR}/test \
+	${LIBRECORDIO_TEST_DIR}/testFromJava ${LIBRECORDIO_TEST_DIR}/*.jr.*