Merge pull request #82 from ceph/wip-rm-blkin
[autobuild-ceph.git] / build-hadoop.sh
1 #!/bin/bash -x
2
3 set -e
4
5 HADOOP_ERRORS_IGNORE=""
6
7 #using Java6 openjdk for now.
8 HADOOP_JAVA_HOME="/usr/lib/jvm/java-6-openjdk"
9 export JAVA_HOME=$HADOOP_JAVA_HOME
10
11 #get the libcephfs jar and so files so the build works
12 GETLIBSOUTPUT=`python ../../get-libcephfs-java-jar.py`
13
14 echo $GETLIBSOUTPUT
15
16 HADOOP_ERRORS_IGNORE="\
17 grep -vi \"warning\"" #| \
18 #grep -v \"is not a pointer or array, skip client functions\" | \
19 #grep -v \"is a pointer to type 'string', skip client functions\""
20
21 REV="$(git rev-parse HEAD)"
22
23 DESTDIR_TMP="install.tmp"
24 OUTDIR="../out/output/sha1/$REV"
25 CURRENT_DIR=`pwd`
26
27 install -d -m0766 -- "$DESTDIR_TMP"
28
29 NCPU=$(( 2 * `grep -c processor /proc/cpuinfo` ))
30
31 echo "$0: building..."
32 echo --START-IGNORE-WARNINGS
33 # filter out idl errors "Unable to determine origin..." to avoid gitbuilder failing
34 ionice -c3 nice -n20 ant -Divy.default.ivy.user.dir=$CURRENT_DIR cephfs cephfs-test 2> >( eval ${HADOOP_ERRORS_IGNORE} ) || exit 4
35
36 OUTDIR_TMP="${OUTDIR}.tmp"
37
38 install -d -m0755 -- "$OUTDIR_TMP"
39 tar czf "${OUTDIR_TMP}/hadoop.tgz" -C "${CURRENT_DIR}" .
40 printf '%s\n' "$REV" >"$OUTDIR_TMP/sha1"
41
42 # we're successful, the files are ok to be published; try to be as
43 # atomic as possible about replacing potentially existing OUTDIR
44 if [ -e "$OUTDIR" ]; then
45     rm -rf -- "$OUTDIR.old"
46     mv -- "$OUTDIR" "$OUTDIR.old"
47 fi
48 mv -- "$OUTDIR_TMP" "$OUTDIR"
49 rm -rf -- "$OUTDIR.old"
50
51
52 exit 0
53