[Nix-dev] Re: git-gui: require not using ttk

Marc Weber marco-oweber at gmx.de
Fri May 28 13:50:23 CEST 2010


Hi David, Simon & list,

I comitted your tk changes today

About the other patch:
I kept my changes to make-wrapper.sh because of the doWrapProgam function.

Note this bash syntax: You can safe some typing this way:
+       for prog in bin/gitk libexec/git-core/{git-gui,git-citool}

Is this commit message fine to you?

Marc Weber

commit 49df720ae694e3b777bfb151a9fbce0e52c6e1df
Author: Marc Weber <marco-oweber at gmx.de>
Date:   Fri May 28 13:09:13 2010 +0200

    git & make-wrapper.sh:
    - wrap git-citool
    - wrap git-gui using new function wrapProgramKeepBasename
      which uses the hidden filename bin/.wrapped/NAME instead of bin/.NAME-wrapped
      because it depends on $0 being git-gui
    - add wrapProgramKeepBasename moving common code in doWrapProgam thereby no
      longer passing an argument twice which was ignored anyway.
    
    merged commit done by David Guibert and Marc Weber

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 b7d3490..f328c7b 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,9 @@ 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,git-citool}
        do
-         wrapProgram "$out/$prog"                       \
+         wrapProgramKeepName "$out/$prog"                       \
                      --set TK_LIBRARY "${tk}/lib/${tk.libPrefix}" \
                      --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..9eff54b 100644
--- a/pkgs/build-support/make-wrapper/make-wrapper.sh
+++ b/pkgs/build-support/make-wrapper/make-wrapper.sh
@@ -93,10 +93,23 @@ filterExisting() {
     done
 }
 
+
+# doWrapProgam <HIDDEN_NAME> <PROGRAM> <MAKE-WRAPPER FLAGS...>
+doWrapProgam() {
+    local hidden="$1"
+    local prog="$2"
+    mkdir -p "$(dirname "$hidden")"
+    mv "$prog" "$hidden"
+    makeWrapper "$@"
+}
+
+
 # Syntax: wrapProgram <PROGRAM> <MAKE-WRAPPER FLAGS...>
 wrapProgram() {
-    local prog="$1"
-    local hidden="$(dirname "$prog")/.$(basename "$prog")"-wrapped
-    mv $prog $hidden
-    makeWrapper $hidden $prog "$@"
+  doWrapProgam "$(dirname "$1")/.$(basename "$1")"-wrapped "$@"
+}
+
+# Syntax: wrapProgramKeepName <PROGRAM> <MAKE-WRAPPER FLAGS...>
+wrapProgramKeepName() {
+  doWrapProgam "$(dirname "$1")/.wrapped/$(basename "$1")" "$@"
 }



More information about the nix-dev mailing list