[Nix-dev] [nixpkgs] Update leiningen to 1.7.1, fix rlwrap bug

Michel Alexandre Salim michel at sylvestre.me
Wed May 2 06:52:19 CEST 2012


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:

- 'which' is not part of the standard environment in NixOS -- the
default user profile aliases it to 'type -P' instead. The nix-specific
patch for the lein-pkg wrapper script now uses type -P instead of which
- when the upstream wrapper script was updated for Leiningen 1.7.0, a
control-flow mistake was introduced, causing RLWRAP to still be set (to
some command-line options) even if rlwrap is not found. I've now moved
these rlwrap-related settings to within the conditional branch where
rlwrap is found

The second patch not nix-specific, so I've created a pull request for
it, for the 1.x branch:
  https://github.com/technomancy/leiningen/pull/553

It applies cleanly against the 1.7.1 release as well; if this patch is
accepted, we can drop it in nixpkgs once 1.7.2 is out.

Eelco -- how does one get commit access for nixpkgs? I'm an experienced
Fedora developer with an interest in functional programming, and would
love to help out with this most interesting (and, so far, the only
functional) Linux distribution.

Thanks,

-- 
Michel Alexandre Salim

-------------- next part --------------
From 69ffdfa5bce976f0856099c623cc4a6e352665a6 Mon Sep 17 00:00:00 2001
From: Michel Alexandre Salim <michel at sylvestre.me>
Date: Wed, 2 May 2012 05:56:02 +0200
Subject: [PATCH] - update leiningen to 1.7.1 - apply patch (sent to upstream)
 to fix behavior when rlwrap is absent - replace which with
 type -P in nix-specific patch to avoid having to pull  
 'which' as a dependency - rebase the nix-specific patch to
 apply cleanly

---
 .../tools/build-managers/leiningen/builder.sh      |    5 ++++-
 .../tools/build-managers/leiningen/default.nix     |   12 ++++++------
 .../tools/build-managers/leiningen/lein.patch      |   16 ++++++++++++++--
 3 files changed, 24 insertions(+), 9 deletions(-)

diff --git a/pkgs/development/tools/build-managers/leiningen/builder.sh b/pkgs/development/tools/build-managers/leiningen/builder.sh
index 2ee86d8..4e7d9e4 100644
--- a/pkgs/development/tools/build-managers/leiningen/builder.sh
+++ b/pkgs/development/tools/build-managers/leiningen/builder.sh
@@ -12,7 +12,10 @@ 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
diff --git a/pkgs/development/tools/build-managers/leiningen/default.nix b/pkgs/development/tools/build-managers/leiningen/default.nix
index efdb578..b590444 100644
--- a/pkgs/development/tools/build-managers/leiningen/default.nix
+++ b/pkgs/development/tools/build-managers/leiningen/default.nix
@@ -2,17 +2,17 @@
 
 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,7 +20,7 @@ stdenv.mkDerivation rec {
     sha256 = "b38853254a2df9138b2e2c12be0dca3600fa7e2a951fed05fc3ba2d9141a3fb0";
   };
 
-  patches = [ ./lein.patch ];
+  patches = [ ./lein-rlwrap.patch ./lein.patch ];
 
   builder = ./builder.sh;
 
diff --git a/pkgs/development/tools/build-managers/leiningen/lein.patch b/pkgs/development/tools/build-managers/leiningen/lein.patch
index 2edf137..276b634 100644
--- a/pkgs/development/tools/build-managers/leiningen/lein.patch
+++ b/pkgs/development/tools/build-managers/leiningen/lein.patch
@@ -1,5 +1,5 @@
---- lein-pkg	2012-02-28 15:26:40.000000000 -0800
-+++ lein-pkg-nix	2012-02-28 17:17:02.000000000 -0800
+--- lein-pkg.orig	2012-05-02 05:50:00.633655638 +0200
++++ lein-pkg	2012-05-02 06:14:31.133271864 +0200
 @@ -71,30 +71,14 @@
  LEIN_PLUGIN_PATH="$(echo "$DEV_PLUGINS" | tr \\n :)"
  LEIN_USER_PLUGIN_PATH="$(echo "$(unique_user_plugins)" | tr \\n :)"
@@ -30,3 +30,15 @@
 -    CLASSPATH="$CLASSPATH":/usr/share/java/leiningen-$LEIN_VERSION.jar
 -fi
 +CLASSPATH="$CLASSPATH:$(dirname $0)/../lib/*"
+ 
+ if [ $DEBUG ]; then
+     echo $CLASSPATH
+@@ -103,7 +87,7 @@
+ 
+ # Use rlwrap if appropriate
+ if ([ -z $INSIDE_EMACS ] && [ "$TERM" != "dumb" ]); then
+-    which rlwrap &> /dev/null
++    type -P rlwrap &> /dev/null
+     if [ $? -eq 0 ]; then
+         RLWRAP="rlwrap -r -m -q '\"'" # custom quote chars
+         RLWRAP_CLJ_WORDS_FILE=${RLWRAP_CLJ_WORDS_FILE:-"${HOME}/.clj_completions"}
-- 
1.7.9.5



More information about the nix-dev mailing list