{"thread":{"id":"4809","subject":"[PATCH] Replace sed with perl when setting up perl scripts.","startedAt":"2006-07-08T19:37:17Z","lastAt":"2006-07-08T21:11:12Z","messageCount":2,"participants":["Shawn Pearce","Junio C Hamano"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"23429","messageId":"20060708193717.GA17905@spearce.org","threadId":"4809","inReplyTo":null,"subject":"[PATCH] Replace sed with perl when setting up perl scripts.","fromName":"Shawn Pearce","fromEmail":"spearce@spearce.org","sentAt":"2006-07-08T19:37:17Z","receivedAt":"2006-07-08T19:37:17Z","isPatch":true,"sender":{"key":"spearce@spearce.org","avatar":"https://avatars.githubusercontent.com/u/34844?v=4"},"body":"next appears to be broken on MacOS X:\n\n  INSTLIBDIR=`make -C perl -s --no-print-directory instlibdir` && \\\n  sed -e '1s|#!.*perl|#!/usr/bin/perl|1' \\\n      -e '2i\\\n          use lib (split(/:/, $ENV{GITPERLLIB} || '\\'\"$INSTLIBDIR\"\\''));' \\\n      -e 's|@@INSTLIBDIR@@|'\"$INSTLIBDIR\"'|g' \\\n      -e 's/@@GIT_VERSION@@/1.4.1.g659a/g' \\\n      git-archimport.perl >git-archimport+\n  sed: 1: \"2i use lib (split(/:/,  ...\": command i expects \\ followed by text\n  make: *** [git-archimport] Error 1\n\nI just spent half an hour messing around with the relevant Makefile\nrule to try and get sed to be happy with this and I can't find the\nmagic necessary.  So I ported the sed to perl.  :-)\n\n-->>-\nReplace sed with perl when setting up perl scripts.\n\nThe sed magic to insert 'use lib' at the start of all\nGIT Perl scripts wasn't working correctly on Mac OS X.\nReplacing the sed invocations with perl invocations is\nmuch more portable.\n\nThe replacement also has no negative impact on the build\nas GIT cannot be compiled without the Git perl module,\nwhich implies that perl is available and works.\n---\n Makefile |   11 ++++++-----\n 1 files changed, 6 insertions(+), 5 deletions(-)\n\ndiff --git a/Makefile b/Makefile\nindex 8d429a0..e83d298 100644\n--- a/Makefile\n+++ b/Makefile\n@@ -557,11 +557,12 @@ common-cmds.h: Documentation/git-*.txt\n $(patsubst %.perl,%,$(SCRIPT_PERL)): % : %.perl\n \trm -f $@ $@+\n \tINSTLIBDIR=`$(MAKE) -C perl -s --no-print-directory instlibdir` && \\\n-\tsed -e '1s|#!.*perl|#!$(PERL_PATH_SQ)|1' \\\n-\t    -e '2i\\\n-\t        use lib (split(/:/, $$ENV{GITPERLLIB} || '\\'\"$$INSTLIBDIR\"\\''));' \\\n-\t    -e 's|@@INSTLIBDIR@@|'\"$$INSTLIBDIR\"'|g' \\\n-\t    -e 's/@@GIT_VERSION@@/$(GIT_VERSION)/g' \\\n+\t$(PERL_PATH) -e '$$_=<>;print q{#!$(PERL_PATH_SQ)},qq{\\n};' \\\n+\t    -e 'print q{use lib (split(/:/, $$ENV{GITPERLLIB} || '\\'\"$$INSTLIBDIR\"\\''));},qq{\\n};' \\\n+\t    -e 'while(<>){' \\\n+\t    -e 's|@@INSTLIBDIR@@|'\"$$INSTLIBDIR\"'|g;' \\\n+\t    -e 's/@@GIT_VERSION@@/$(GIT_VERSION)/g;' \\\n+\t    -e 'print;}' \\\n \t    $@.perl >$@+\n \tchmod +x $@+\n \tmv $@+ $@\n-- \n1.4.1.gc48f\n"},{"id":"23438","messageId":"7vu05rpztb.fsf@assigned-by-dhcp.cox.net","threadId":"4809","inReplyTo":"20060708193717.GA17905@spearce.org","subject":"Re: [PATCH] Replace sed with perl when setting up perl scripts.","fromName":"Junio C Hamano","fromEmail":"junkio@cox.net","sentAt":"2006-07-08T21:11:12Z","receivedAt":"2006-07-08T21:11:12Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Please try the replacement patch I sent to the list earlier in\nresponse to Johannes's patch to the same problem.\n"}]}