-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On 05/04/2012 10:17 AM, Michel Alexandre Salim wrote:
> On 05/02/2012 11:52 AM, Michel Alexandre Salim wrote:
>> Hi,
> 
>> I've updated the leiningen nixpkg to 1.7.1, and while I'm at it, 
>> fixed the problem with the current expression that Eelco noted
>> when he committed it in February:
> 
> Please hold and not commit this for now; Phil expressed that he 
> prefers rlwrap be made an explicit dependency, since the lein repl 
> experience is much worse without it, so I'll be reworking the
> patch.
> 
OK, the attached patch does the trick. I'm applying a patch for
upstream that simplifies lein-pkg and assumes rlwrap is present (thus
getting rid of the 'which' invocation that caused problem earlier --
we no longer need to replace it with 'type -P'). lein is now invoked
through a wrapper (using makeWrapper) that injects the path to the
rlwrap used during the build.

Cheers,

- -- 
Michel Alexandre Salim
µblog:      http://identi.ca/hircus
            http://twitter.com/hircus
GPG key ID: A36A937A

()  ascii ribbon campaign - against html e-mail
/\  www.asciiribbon.org   - against proprietary attachments
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.12 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iQEcBAEBAgAGBQJPo2MIAAoJEEr1VKujapN6ZW0H/i8jI4NgXoRWWhLuanrBP+9d
/pshYEHCfe1j+J5lJmXvDHal4h6Zq34Ec52J4vCk8HASkQ1CRpQV7EmPXIH2YEyA
xTtPpSdq6cSvvVz/xI8pGkreW4tCDOOn3LCnzv+joEOD1PIZEU0DIrSni+HKzkoK
O4Jao2z1dU9bRYDKRgSztsuXvl1LWixiKqLj/splcJLf1dzeSvb80gry2S+/o1Fn
Qk4rDCDtaHyZoMCae4nK2wALImFbZFkm7YB+tUqglcYhbJepBxCfgNLrVC0Ngtyd
Jo4mrUrmaWTw+7rTiCG/ZvmhlrijU+LKjUBEAqQ3/RwOcLe05Wn4E5QcN+vKVEI=
=o1lv
-----END PGP SIGNATURE-----
>From a6bb9e5fb9b9d5ad171abd5d3fd46d0d7dc62b6d Mon Sep 17 00:00:00 2001
From: Michel Alexandre Salim <[email protected]>
Date: Wed, 2 May 2012 05:56:02 +0200
Subject: [PATCH] - update leiningen to 1.7.1 - apply patch (sent to upstream)
 to assume rlwrap is present - update expression to depend
 on rlwrap - rebase the nix-specific patch to apply cleanly

---
 .../tools/build-managers/leiningen/builder.sh      |    7 ++-
 .../tools/build-managers/leiningen/default.nix     |   18 +++++---
 .../build-managers/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 2ee86d8..df7ace8 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 efdb578..e5a20b4 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 0000000..fcb4aa9
--- /dev/null
+++ b/pkgs/development/tools/build-managers/leiningen/lein-rlwrap.patch
@@ -0,0 +1,45 @@
+From 324b16e0e13112201754b491c9b5e3bb4d4bc460 Mon Sep 17 00:00:00 2001
+From: Michel Alexandre Salim <[email protected]>
+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..d0e3b55
+--- 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 interactive 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 2edf137..b62701e 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
-- 
1.7.9.5

_______________________________________________
nix-dev mailing list
[email protected]
http://lists.science.uu.nl/mailman/listinfo/nix-dev

Reply via email to