From 2c64c7fe9d2ff29d2701fab2c4a7623a0c40b4c8 Mon Sep 17 00:00:00 2001 From: Michel Alexandre Salim Date: Fri, 11 May 2012 03:36:13 +0000 Subject: [PATCH] - update leiningen to 1.7.1 - apply patch (applied upstream) to assume rlwrap is present - update expression to depend on rlwrap - rebase the nix-specific patch to apply cleanly svn path=/nixpkgs/trunk/; revision=34056 --- .../tools/build-managers/leiningen/builder.sh | 7 ++- .../build-managers/leiningen/default.nix | 18 +++++--- .../leiningen/lein-rlwrap.patch | 45 +++++++++++++++++++ .../tools/build-managers/leiningen/lein.patch | 9 ++-- 4 files changed, 68 insertions(+), 11 deletions(-) create mode 100644 pkgs/development/tools/build-managers/leiningen/lein-rlwrap.patch diff --git a/pkgs/development/tools/build-managers/leiningen/builder.sh b/pkgs/development/tools/build-managers/leiningen/builder.sh index 2ee86d86d77..df7ace8e4f3 100644 --- a/pkgs/development/tools/build-managers/leiningen/builder.sh +++ b/pkgs/development/tools/build-managers/leiningen/builder.sh @@ -12,11 +12,16 @@ cp -v $src $out_bin cp -v $jarsrc $out/lib cp -v $clojuresrc $out/lib -patch --verbose $out_bin -p0 < $patches +for p in $patches; +do + patch --verbose $out_bin -p0 < $p +done chmod -v 755 $out_bin patchShebangs $out +wrapProgram $out_bin --prefix PATH ":" ${rlwrap}/bin + echo "Testing out \"lein version\"..." $out_bin version echo "Success." diff --git a/pkgs/development/tools/build-managers/leiningen/default.nix b/pkgs/development/tools/build-managers/leiningen/default.nix index efdb578a61b..e5a20b46046 100644 --- a/pkgs/development/tools/build-managers/leiningen/default.nix +++ b/pkgs/development/tools/build-managers/leiningen/default.nix @@ -1,18 +1,18 @@ -{stdenv, fetchurl, openjdk}: +{stdenv, fetchurl, makeWrapper, openjdk, rlwrap}: stdenv.mkDerivation rec { pname = "leiningen"; - version = "1.7.0"; + version = "1.7.1"; name = "${pname}-${version}"; src = fetchurl { - url = "https://raw.github.com/technomancy/leiningen/1.7.0/bin/lein-pkg"; - sha256 = "1339f6ffc7bae3171174fc9eae990f5b9710ff2804038e931d531632c57f189c"; + url = "https://raw.github.com/technomancy/leiningen/${version}/bin/lein-pkg"; + sha256 = "7684b899edd6004abafd8e26d2b43d5691217f1aaca535fb94bde1594c8129a5"; }; jarsrc = fetchurl { - url = "https://github.com/downloads/technomancy/leiningen/leiningen-1.7.0-standalone.jar"; - sha256 = "501eaa1c2a19ca4ffc2fde1776552cb513d69ee874abb547c40cee92156e50bf"; + url = "https://github.com/downloads/technomancy/leiningen/leiningen-${version}-standalone.jar"; + sha256 = "5d167b7572b9652d44c2b58a13829704842d976fd2236530ef552194e6c12150"; }; clojuresrc = fetchurl { @@ -20,10 +20,14 @@ stdenv.mkDerivation rec { sha256 = "b38853254a2df9138b2e2c12be0dca3600fa7e2a951fed05fc3ba2d9141a3fb0"; }; - patches = [ ./lein.patch ]; + patches = [ ./lein-rlwrap.patch ./lein.patch ]; + + inherit rlwrap; builder = ./builder.sh; + buildInputs = [ makeWrapper ]; + propagatedBuildInputs = [ openjdk ]; meta = { diff --git a/pkgs/development/tools/build-managers/leiningen/lein-rlwrap.patch b/pkgs/development/tools/build-managers/leiningen/lein-rlwrap.patch new file mode 100644 index 00000000000..208199f355d --- /dev/null +++ b/pkgs/development/tools/build-managers/leiningen/lein-rlwrap.patch @@ -0,0 +1,45 @@ +From f14307932a316952fae8517c0fcb0962cd204e9a Mon Sep 17 00:00:00 2001 +From: Michel Alexandre Salim +Date: Fri, 4 May 2012 10:56:38 +0700 +Subject: [PATCH] lein-pkg: require rlwrap unconditionally, unless run inside + Emacs or a dumb terminal; chmod to 755 as this is an + executable script + +--- + bin/lein-pkg | 10 ++++++---- + 1 file changed, 6 insertions(+), 4 deletions(-) + mode change 100644 => 100755 bin/lein-pkg + +diff --git a/bin/lein-pkg b/bin/lein-pkg +old mode 100644 +new mode 100755 +index 8563da6..1b90ebe +--- lein-pkg.orig ++++ lein-pkg +@@ -3,6 +3,11 @@ + # This variant of the lein script is meant for downstream packagers. + # It has all the cross-platform stuff stripped out as well as the + # logic for running from checkouts and self-upgrading. ++# ++# Note to packagers: ++# rlwrap is now required unless running inside Emacs or in a dumb ++# terminal (this is to improve the 'lein repl' experience). ++# Make sure that your packaging pulls in rlwrap as a dependency + + export LEIN_VERSION="1.7.1" + +@@ -103,10 +108,7 @@ fi + + # Use rlwrap if appropriate + if ([ -z $INSIDE_EMACS ] && [ "$TERM" != "dumb" ]); then +- which rlwrap > /dev/null +- if [ $? -eq 0 ]; then +- RLWRAP="rlwrap -r -m -q '\"'" # custom quote chars +- fi ++ RLWRAP="rlwrap -r -m -q '\"'" # custom quote chars + RLWRAP_CLJ_WORDS_FILE=${RLWRAP_CLJ_WORDS_FILE:-"${HOME}/.clj_completions"} + RLWRAP_CLJ_WORDS_OPTION="" + if [ -r "${RLWRAP_CLJ_WORDS_FILE}" ]; then +-- +1.7.9.5 + diff --git a/pkgs/development/tools/build-managers/leiningen/lein.patch b/pkgs/development/tools/build-managers/leiningen/lein.patch index 2edf1370ff4..b62701e2519 100644 --- a/pkgs/development/tools/build-managers/leiningen/lein.patch +++ b/pkgs/development/tools/build-managers/leiningen/lein.patch @@ -1,6 +1,6 @@ ---- lein-pkg 2012-02-28 15:26:40.000000000 -0800 -+++ lein-pkg-nix 2012-02-28 17:17:02.000000000 -0800 -@@ -71,30 +71,14 @@ +--- lein-pkg 2012-05-04 11:02:41.524912828 +0700 ++++ lein-pkg-nix 2012-05-04 11:03:11.062543558 +0700 +@@ -76,30 +76,14 @@ LEIN_PLUGIN_PATH="$(echo "$DEV_PLUGINS" | tr \\n :)" LEIN_USER_PLUGIN_PATH="$(echo "$(unique_user_plugins)" | tr \\n :)" CLASSPATH="$CLASSPATH:$LEIN_PLUGIN_PATH:$LEIN_USER_PLUGIN_PATH:test/:src/:resources/" @@ -30,3 +30,6 @@ - CLASSPATH="$CLASSPATH":/usr/share/java/leiningen-$LEIN_VERSION.jar -fi +CLASSPATH="$CLASSPATH:$(dirname $0)/../lib/*" + + if [ $DEBUG ]; then + echo $CLASSPATH