Last active
August 29, 2015 14:02
-
-
Save akiatoji/6d67a7fa470e1218dc5b to your computer and use it in GitHub Desktop.
Homebrew Pig 0.12.x with Hadoop 2.4
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# If you installed Hadoop and Pig with Homebrew on OS X, then get this error: | |
# | |
# ERROR org.apache.hadoop.mapreduce.lib.jobcontrol.JobControl - Error whiletrying to run jobs.java.lang.IncompatibleClassChangeError: Found interface org.apache.hadoop.mapreduce.JobContext, but class was expected. | |
# | |
# Then this formula is for you. It downloads pig src, then builds it for >Hadoop 2.3 | |
# | |
# | |
require 'formula' | |
class Pig < Formula | |
homepage 'http://pig.apache.org/' | |
url 'http://www.apache.org/dyn/closer.cgi?path=pig/pig-0.12.0/pig-0.12.0-src.tar.gz' | |
sha1 '2700daafeccd8cd5612366dbd66acfb30486aa24' | |
patch :DATA | |
def install | |
system 'ant clean jar-all -Dhadoopversion=23' | |
system 'cp build/*.jar .' | |
system '(cd contrib/piggybank/java; ant clean jar)' | |
system 'cp contrib/piggybank/java/piggybank.jar .' | |
bin.install 'bin/pig' | |
prefix.install ["pig-0.12.1-SNAPSHOT.jar", "pig-0.12.1-SNAPSHOT-withouthadoop.jar", "piggybank.jar"] | |
end | |
def caveats; <<-EOS.undent | |
You may need to set JAVA_HOME: | |
export JAVA_HOME="$(/usr/libexec/java_home)" | |
EOS | |
end | |
end | |
# There's something weird with Pig's launch script, it doesn't find the correct | |
# path. This patch finds PIG_HOME from the pig binary path's symlink. | |
__END__ | |
diff -u a/bin/pig b/bin/pig | |
--- a/bin/pig 2011-09-30 08:55:58.000000000 +1000 | |
+++ b/bin/pig 2011-11-28 11:18:36.000000000 +1100 | |
@@ -55,11 +55,8 @@ | |
# resolve links - $0 may be a softlink | |
this="${BASH_SOURCE-$0}" | |
- | |
-# convert relative path to absolute path | |
-bin=$(cd -P -- "$(dirname -- "$this")">/dev/null && pwd -P) | |
-script="$(basename -- "$this")" | |
-this="$bin/$script" | |
+here=$(dirname $this) | |
+this="$here"/$(readlink $this) | |
# the root of the Pig installation | |
export PIG_HOME=`dirname "$this"`/.. | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment