storm: 0.8.2 -> 1.0.1

For this package to be useful you need to wrap it in a fhs-user-env and/or
create a nixos module. Previous version had become completely broken/useless
though.
This commit is contained in:
Edward Tjörnhammar 2016-07-13 06:45:33 +02:00
parent 6423ded1bc
commit 60e5b599d5
No known key found for this signature in database
GPG key ID: 7B82CE4A866B6845

View file

@ -1,49 +1,65 @@
{ stdenv, fetchurl, zip, unzip, jzmq, jdk, lib, python, logsDir ? "", confFile ? "", extraLibraryPaths ? [], extraJars ? [] }:
{ stdenv, lib, fetchurl, zip, unzip, makeWrapper
, jzmq, jdk, python
, logsDir ? "", confFile ? "", extraLibraryPaths ? [], extraJars ? [] }:
stdenv.mkDerivation {
name = "storm-0.8.2";
stdenv.mkDerivation rec {
name = "apache-storm-" + version;
version = "1.0.1";
src = fetchurl {
url = https://dl.dropbox.com/u/133901206/storm-0.8.2.zip;
sha256 = "8761aea0b54e5bab4a68b259bbe6b5b2f8226204488b5559eba57a0c458b2bbc";
url =
"mirror://apache/storm/${name}/${name}.tar.gz";
sha256 = "1gr00s0fhf8ci0faf3x5dinkiw9mlnc1x1vqki8cfszvij6w0x0m";
};
buildInputs = [ zip unzip jzmq ];
installPhase = ''
# Remove junk
rm -f lib/jzmq*
mkdir -p $out/bin
mv bin/storm $out/bin/
rm -R bin conf logs
mkdir -p $out/share/${name}
mv public $out/docs
mv examples $out/share/${name}/.
# Fix shebang header for python scripts
sed -i -e "s|#!/usr/bin/.*python|#!${python}/bin/python|" $out/bin/storm;
rm -f lib/jzmq* || exit 1
mv lib $out/.
mv external extlib* $out/lib/.
mv conf bin $out/.
mv log4j2 $out/conf/.
'';
mkdir -p $out/conf
cp -av * $out
cd $out;
${if logsDir != "" then ''ln -s ${logsDir} logs'' else ""}
# Extract, delete from zip; and optionally append to defaults.yaml
unzip storm-*.jar defaults.yaml;
zip -d storm-*.jar defaults.yaml;
echo 'java.library.path: "${jzmq}/lib:${lib.concatStringsSep ":" extraLibraryPaths}"' >> defaults.yaml;
fixupPhase = ''
# Fix python reference
sed -i \
-e '19iPYTHON=${python}/bin/python' \
-e 's|#!/usr/bin/.*python|#!${python}/bin/python|' \
$out/bin/storm
sed -i \
-e 's|#!/usr/bin/.*python|#!${python}/bin/python|' \
-e "s|STORM_CONF_DIR = .*|STORM_CONF_DIR = os.getenv('STORM_CONF_DIR','$out/conf')|" \
-e 's|STORM_LOG4J2_CONF_DIR =.*|STORM_LOG4J2_CONF_DIR = os.path.join(STORM_CONF_DIR, "log4j2")|' \
$out/bin/storm.py
# Default jdk location
sed -i -e 's|#.*export JAVA_HOME=.*|export JAVA_HOME="${jdk.home}"|' \
$out/conf/storm-env.sh
unzip $out/lib/storm-core-${version}.jar defaults.yaml;
zip -d $out/lib/storm-core-${version}.jar defaults.yaml;
sed -i \
-e 's|java.library.path: .*|java.library.path: "${jzmq}/lib:${lib.concatStringsSep ":" extraLibraryPaths}"|' \
-e 's|storm.log4j2.conf.dir: .*|storm.log4j2.conf.dir: "conf/log4j2"|' \
defaults.yaml
${if confFile != "" then ''cat ${confFile} >> defaults.yaml'' else ""}
mv defaults.yaml conf;
mv defaults.yaml $out/conf;
# Link to jzmq jar and extra jars
cd lib;
cd $out/lib;
ln -s ${jzmq}/share/java/*.jar;
${lib.concatMapStrings (jar: "ln -s ${jar};\n") extraJars}
'';
dontStrip = true;
meta = {
homepage = "http://storm-project.net";
meta = with stdenv.lib; {
homepage = "http://storm.apache.org";
description = "Distributed realtime computation system";
license = stdenv.lib.licenses.epl10;
maintainers = [ lib.maintainers.vizanto ];
license = licenses.asl20;
maintainers = with maintainers; [ edwtjo vizanto ];
};
}