Hi,

I'm a little too late, I see your message when I've finished testing...

On 26/05/2010 21:34, Marc Weber wrote:
> Excerpts from Yury G. Kudryashov's message of Wed May 26 20:20:05 +0200 2010:
>> Marc Weber wrote:
>>
>>> Excerpts from Yury G. Kudryashov's message of Wed May 26 19:35:22 +0200
>>> 2010:
>>>> I'd propose to change wrapProgram globally to move original program to
>>>> .orig/originalName instead of .original-name-wrapped. In this case we
>>>> shall not have such problems (progs assert that they know $0) in the
>>>> future.
>>>
>>>
>>> Which will not work for all cases because some apss might be using
>>> something like this: Calling apps relative to current bin directory:
>>>
>>> exec $(dirname $0)/other-app
>>>
>>> So you may fix git-gui but you may break others.
>>> So should an option be created eg:
>>>
>>>   wrap --keep-name # use .orig/name
>>>   wrap --keep-path # use .name-wrapped
>> OK for me
> 
> Is this all worth the effort? The git patch seems trivial to me.

See the attached patch. The two options have been introduced.
git gui and git citool are fully functional (with ttk the theme is
different than without).

[...]
> So this patch does:
> 
> - move code of wrapProgram into doWrapProgam adding the mkdir command in
>   case the hidden location is a new path. Also adding new arg receiving
>   hidden name.
> 
> - add new function wrapProgramKeeepBasename

s/Keeep/Keep/

> Should it be comitted to stdenv-updates? Does someone know how much will
> be rebuild?
> 
> Caution: I didn't test this patch yet - Just wondering whether its
> important enough to be comitted at all.
-- 
Regards, David
From: David Guibert <[email protected]>
Subject: [PATCH] change wrapProgram to work for git-gui

On 26/05/2010 19:46, Marc Weber wrote:
> Which will not work for all cases because some apss might be using
> something like this: Calling apps relative to current bin directory:
> 
> exec $(dirname $0)/other-app
> 
> So you may fix git-gui but you may break others.
> So should an option be created eg:
> 
>   wrap --keep-name # use .orig/name
>   wrap --keep-path # use .name-wrapped


Signed-off-by: David Guibert <[email protected]>

---
 .../git-and-tools/git/default.nix                  |    5 ++-
 pkgs/build-support/make-wrapper/make-wrapper.sh    |   23 +++++++++++++++++--
 2 files changed, 23 insertions(+), 5 deletions(-)

diff --git a/pkgs/applications/version-management/git-and-tools/git/default.nix 
b/pkgs/applications/version-management/git-and-tools/git/default.nix
index 9f7149d..02ebb21 100644
--- a/pkgs/applications/version-management/git-and-tools/git/default.nix
+++ b/pkgs/applications/version-management/git-and-tools/git/default.nix
@@ -79,9 +79,10 @@ stdenv.mkDerivation rec {
 
    + (if guiSupport then ''
        # Wrap Tcl/Tk programs
-       for prog in bin/gitk libexec/git-core/git-gui
+       for prog in bin/gitk libexec/git-core/git-gui 
libexec/git-core/git-citool
+
        do
-         wrapProgram "$out/$prog"                       \
+         wrapProgram --keep-name "$out/$prog"                       \
                      --set TK_LIBRARY "${tk}/lib/tk8.4" \
                      --prefix PATH : "${tk}/bin"
        done
diff --git a/pkgs/build-support/make-wrapper/make-wrapper.sh 
b/pkgs/build-support/make-wrapper/make-wrapper.sh
index 08146f3..8f6943c 100644
--- a/pkgs/build-support/make-wrapper/make-wrapper.sh
+++ b/pkgs/build-support/make-wrapper/make-wrapper.sh
@@ -93,10 +93,27 @@ filterExisting() {
     done
 }
 
-# Syntax: wrapProgram <PROGRAM> <MAKE-WRAPPER FLAGS...>
+# Syntax: wrapProgram [--keep-name|--keep-path] <PROGRAM> <MAKE-WRAPPER 
FLAGS...>
 wrapProgram() {
-    local prog="$1"
-    local hidden="$(dirname "$prog")/.$(basename "$prog")"-wrapped
+    local maybeOption="$1"
+    local prog
+    local hidden
+    case "$maybeOption" in
+      "--keep-name")
+         shift
+         prog="$1"
+         hidden="$(dirname "$prog")/.wrapped/$(basename "$prog")"
+         mkdir "$(dirname "$hidden")"
+         ;;
+      "--keep-path")
+         shift
+         prog="$1"
+         hidden="$(dirname "$prog")/.$(basename "$prog")"-wrapped
+         ;;
+      *)
+         prog="$1"
+         hidden="$(dirname "$prog")/.$(basename "$prog")"-wrapped
+    esac
     mv $prog $hidden
     makeWrapper $hidden $prog "$@"
 }
-- 
tg: (b5e62a4..) t/make-wrapper (depends on: pu)
_______________________________________________
nix-dev mailing list
[email protected]
https://mail.cs.uu.nl/mailman/listinfo/nix-dev

Reply via email to