{"thread":{"id":"6330","subject":"[PATCH] Makefile: add clean-obsolete-scripts target","startedAt":"2007-01-10T12:20:19Z","lastAt":"2007-01-11T21:41:43Z","messageCount":10,"participants":["Johannes Schindelin","Alex Riesen","Junio C Hamano"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"31384","messageId":"Pine.LNX.4.63.0701101319480.22628@wbgn013.biozentrum.uni-wuerzburg.de","threadId":"6330","inReplyTo":null,"subject":"[PATCH] Makefile: add clean-obsolete-scripts target","fromName":"Johannes Schindelin","fromEmail":"johannes.schindelin@gmx.de","sentAt":"2007-01-10T12:20:19Z","receivedAt":"2007-01-10T12:20:19Z","isPatch":true,"sender":{"key":"johannes.schindelin@gmx.de","avatar":"https://avatars.githubusercontent.com/u/127790?v=4"},"body":"\nOn Cygwin, newly builtins are not recognized, because there exist both\nthe executable binaries (with .exe extension) _and_ the now-obsolete\nscripts (without extension), but the script is executed.\n\n\"make clean-obsolete-scripts\" removes these ambiguities by removing the\nolder of these file pairs.\n\nSigned-off-by: Johannes Schindelin <Johannes.Schindelin@gmx.de>\n---\n Makefile |   19 +++++++++++++++++++\n 1 files changed, 19 insertions(+), 0 deletions(-)\n\ndiff --git a/Makefile b/Makefile\nindex 007ceb2..a46683a 100644\n--- a/Makefile\n+++ b/Makefile\n@@ -905,6 +905,25 @@ dist-doc:\n \n ### Cleaning rules\n \n+clean-obsolete-scripts:\n+\t@if test -n \"$X\"; \\\n+\tthen \\\n+\t\tls *$X '$(DESTDIR_SQ)$(gitexecdir_SQ)'/*$X | while read f; do \\\n+\t\t\tscript=\"`echo \"$$f\" | sed 's/$X\\$$/./'`\"; \\\n+\t\t\tif test -f \"$$script\"; \\\n+\t\t\tthen \\\n+\t\t\t\tif test \"$$script\" -ot \"$$f\"; \\\n+\t\t\t\tthen \\\n+\t\t\t\t\techo removing \"$$script\"; \\\n+\t\t\t\t\trm \"$$script\"; \\\n+\t\t\t\telse \\\n+\t\t\t\t\techo removing \"$$f\"; \\\n+\t\t\t\t\trm \"$$f\"; \\\n+\t\t\t\tfi; \\\n+\t\t\tfi; \\\n+\t\tdone; \\\n+\tfi\n+\n clean:\n \trm -f *.o mozilla-sha1/*.o arm/*.o ppc/*.o compat/*.o xdiff/*.o \\\n \t\t$(LIB_FILE) $(XDIFF_LIB)\n-- \n1.4.4.4.g774d-dirty\n"},{"id":"31388","messageId":"81b0412b0701100453t63b62867ne67819e91f1319b9@mail.gmail.com","threadId":"6330","inReplyTo":"Pine.LNX.4.63.0701101319480.22628@wbgn013.biozentrum.uni-wuerzburg.de","subject":"Re: [PATCH] Makefile: add clean-obsolete-scripts target","fromName":"Alex Riesen","fromEmail":"raa.lkml@gmail.com","sentAt":"2007-01-10T12:53:53Z","receivedAt":"2007-01-10T12:53:53Z","isPatch":true,"sender":{"key":"raa.lkml@gmail.com","avatar":"https://avatars.githubusercontent.com/u/324101?v=4"},"body":"On 1/10/07, Johannes Schindelin <Johannes.Schindelin@gmx.de> wrote:\n>\n> On Cygwin, newly builtins are not recognized, because there exist both\n> the executable binaries (with .exe extension) _and_ the now-obsolete\n> scripts (without extension), but the script is executed.\n>\n> \"make clean-obsolete-scripts\" removes these ambiguities by removing the\n> older of these file pairs.\n\nNot enough. You have to cleanup the build directory too,\notherwise tests fail, and git-hacking on git itself is ... complicated.\n"},{"id":"31390","messageId":"Pine.LNX.4.63.0701101441360.22628@wbgn013.biozentrum.uni-wuerzburg.de","threadId":"6330","inReplyTo":"81b0412b0701100453t63b62867ne67819e91f1319b9@mail.gmail.com","subject":"Re: [PATCH] Makefile: add clean-obsolete-scripts target","fromName":"Johannes Schindelin","fromEmail":"johannes.schindelin@gmx.de","sentAt":"2007-01-10T13:42:43Z","receivedAt":"2007-01-10T13:42:43Z","isPatch":true,"sender":{"key":"johannes.schindelin@gmx.de","avatar":"https://avatars.githubusercontent.com/u/127790?v=4"},"body":"Hi,\n\nOn Wed, 10 Jan 2007, Alex Riesen wrote:\n\n> On 1/10/07, Johannes Schindelin <Johannes.Schindelin@gmx.de> wrote:\n> > \n> > On Cygwin, newly builtins are not recognized, because there exist both\n> > the executable binaries (with .exe extension) _and_ the now-obsolete\n> > scripts (without extension), but the script is executed.\n> > \n> > \"make clean-obsolete-scripts\" removes these ambiguities by removing the\n> > older of these file pairs.\n> \n> Not enough. You have to cleanup the build directory too,\n> otherwise tests fail, and git-hacking on git itself is ... complicated.\n\nDoesn't it handle that?\n\n\tls *$X '$(DESTDIR_SQ)$(gitexecdir_SQ)'/*$X\n\nNote the first \"*$X\". It really should pick up on all executables in the \nbuild directory. Or do I miss something?\n\nCiao,\nDscho\n"},{"id":"31392","messageId":"81b0412b0701100552w5efc29d7uc3a0af1d33fe3ce1@mail.gmail.com","threadId":"6330","inReplyTo":"Pine.LNX.4.63.0701101441360.22628@wbgn013.biozentrum.uni-wuerzburg.de","subject":"Re: [PATCH] Makefile: add clean-obsolete-scripts target","fromName":"Alex Riesen","fromEmail":"raa.lkml@gmail.com","sentAt":"2007-01-10T13:52:27Z","receivedAt":"2007-01-10T13:52:27Z","isPatch":true,"sender":{"key":"raa.lkml@gmail.com","avatar":"https://avatars.githubusercontent.com/u/324101?v=4"},"body":"On 1/10/07, Johannes Schindelin <Johannes.Schindelin@gmx.de> wrote:\n> > Not enough. You have to cleanup the build directory too,\n> > otherwise tests fail, and git-hacking on git itself is ... complicated.\n>\n> Doesn't it handle that?\n>\n>         ls *$X '$(DESTDIR_SQ)$(gitexecdir_SQ)'/*$X\n>\n> Note the first \"*$X\". It really should pick up on all executables in the\n> build directory. Or do I miss something?\n\nNo-no, sorry. I didn't noticed the first *$X, which will of course catch the\nexecs in the current directory.\n"},{"id":"31411","messageId":"7vhcuyaaxq.fsf@assigned-by-dhcp.cox.net","threadId":"6330","inReplyTo":"Pine.LNX.4.63.0701101319480.22628@wbgn013.biozentrum.uni-wuerzburg.de","subject":"Re: [PATCH] Makefile: add clean-obsolete-scripts target","fromName":"Junio C Hamano","fromEmail":"junkio@cox.net","sentAt":"2007-01-10T20:22:57Z","receivedAt":"2007-01-10T20:22:57Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Johannes Schindelin <Johannes.Schindelin@gmx.de> writes:\n\n> On Cygwin, newly builtins are not recognized, because there exist both\n> the executable binaries (with .exe extension) _and_ the now-obsolete\n> scripts (without extension), but the script is executed.\n>\n> \"make clean-obsolete-scripts\" removes these ambiguities by removing the\n> older of these file pairs.\n\nI would prefer it to be rather automatic -- how about this instead?\n\n-- >8 --\ndiff --git a/Makefile b/Makefile\nindex e4f520a..9077941 100644\n--- a/Makefile\n+++ b/Makefile\n@@ -1,5 +1,5 @@\n # The default target of this Makefile is...\n-all:\n+all::\n \n # Define NO_OPENSSL environment variable if you do not have OpenSSL.\n # This also implies MOZILLA_SHA1.\n@@ -605,9 +605,12 @@ export prefix TAR INSTALL DESTDIR SHELL_PATH template_dir\n \n ### Build rules\n \n-all: $(ALL_PROGRAMS) $(BUILT_INS) git$X gitk gitweb/gitweb.cgi\n+all:: $(ALL_PROGRAMS) $(BUILT_INS) git$X gitk gitweb/gitweb.cgi\n+ifneq (,$X)\n+\t$(foreach p,$(patsubst %$X,%,$(filter %$X,$(ALL_PROGRAMS) $(BUILT_INS) git$X)), echo rm -f '$p';) \n+endif\n \n-all:\n+all::\n \t$(MAKE) -C perl PERL_PATH='$(PERL_PATH_SQ)' prefix='$(prefix_SQ)' all\n \t$(MAKE) -C templates\n \n@@ -849,6 +852,9 @@ install: all\n \t\t\t'$(DESTDIR_SQ)$(gitexecdir_SQ)/git$X'; \\\n \tfi\n \t$(foreach p,$(BUILT_INS), rm -f '$(DESTDIR_SQ)$(gitexecdir_SQ)/$p' && ln '$(DESTDIR_SQ)$(gitexecdir_SQ)/git$X' '$(DESTDIR_SQ)$(gitexecdir_SQ)/$p' ;)\n+ifneq (,$X)\n+\t$(foreach p,$(patsubst %$X,%,$(filter %$X,$(ALL_PROGRAMS) $(BUILT_INS) git$X)), echo rm -f '$(DESTDIR_SQ)$(gitexecdir_SQ)/$p';) \n+endif\n \n install-doc:\n \t$(MAKE) -C Documentation install\n"},{"id":"31413","messageId":"81b0412b0701101326p11069c76w2873106cb2d46ebf@mail.gmail.com","threadId":"6330","inReplyTo":"7vhcuyaaxq.fsf@assigned-by-dhcp.cox.net","subject":"Re: [PATCH] Makefile: add clean-obsolete-scripts target","fromName":"Alex Riesen","fromEmail":"raa.lkml@gmail.com","sentAt":"2007-01-10T21:26:34Z","receivedAt":"2007-01-10T21:26:34Z","isPatch":true,"sender":{"key":"raa.lkml@gmail.com","avatar":"https://avatars.githubusercontent.com/u/324101?v=4"},"body":"On 1/10/07, Junio C Hamano <junkio@cox.net> wrote:\n>\n> I would prefer it to be rather automatic -- how about this instead?\n>\n...\n> +ifneq (,$X)\n\nPerfect! :)\n"},{"id":"31425","messageId":"7vy7oa765a.fsf@assigned-by-dhcp.cox.net","threadId":"6330","inReplyTo":"81b0412b0701101326p11069c76w2873106cb2d46ebf@mail.gmail.com","subject":"Re: [PATCH] Makefile: add clean-obsolete-scripts target","fromName":"Junio C Hamano","fromEmail":"junkio@cox.net","sentAt":"2007-01-11T00:34:41Z","receivedAt":"2007-01-11T00:34:41Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"\"Alex Riesen\" <raa.lkml@gmail.com> writes:\n\n> On 1/10/07, Junio C Hamano <junkio@cox.net> wrote:\n>>\n>> I would prefer it to be rather automatic -- how about this instead?\n>>\n> ...\n>> +ifneq (,$X)\n>\n> Perfect! :)\n\nHeh, you couldn't have tested -- I still had \"echo rm -f\" in the\npatch ;-).\n"},{"id":"31438","messageId":"Pine.LNX.4.63.0701110919040.22628@wbgn013.biozentrum.uni-wuerzburg.de","threadId":"6330","inReplyTo":"7vhcuyaaxq.fsf@assigned-by-dhcp.cox.net","subject":"Re: [PATCH] Makefile: add clean-obsolete-scripts target","fromName":"Johannes Schindelin","fromEmail":"johannes.schindelin@gmx.de","sentAt":"2007-01-11T08:22:52Z","receivedAt":"2007-01-11T08:22:52Z","isPatch":true,"sender":{"key":"johannes.schindelin@gmx.de","avatar":"https://avatars.githubusercontent.com/u/127790?v=4"},"body":"Hi,\n\nOn Wed, 10 Jan 2007, Junio C Hamano wrote:\n\n> Johannes Schindelin <Johannes.Schindelin@gmx.de> writes:\n> \n> > On Cygwin, newly builtins are not recognized, because there exist both\n> > the executable binaries (with .exe extension) _and_ the now-obsolete\n> > scripts (without extension), but the script is executed.\n> >\n> > \"make clean-obsolete-scripts\" removes these ambiguities by removing the\n> > older of these file pairs.\n> \n> I would prefer it to be rather automatic -- how about this instead?\n\nI like your method better. However, does it execute an rm -f for _every_ \nbuiltin, even if it does not exist? This is a huge performance eater on \ncygwin. Every fork() is _expensive_.\n\nEven worse: are you sure that it does not remove the _builtins_? Maybe you \nnoticed that I asked for \"git-bla.\" instead of \"git-bla\", since the latter \nwill happily access \"git-bla.exe\" (at least when you do an \"ls git-bla\" \nand \"git-bla.exe\" exists, but not \"git-bla\", it _will_ show \nthe metadata of \"git-bla.exe\", but with the name \"git-bla\").\n\nWill test.\n\nCiao,\nDscho\n"},{"id":"31439","messageId":"Pine.LNX.4.63.0701110929400.22628@wbgn013.biozentrum.uni-wuerzburg.de","threadId":"6330","inReplyTo":"Pine.LNX.4.63.0701110919040.22628@wbgn013.biozentrum.uni-wuerzburg.de","subject":"Re: [PATCH] Makefile: add clean-obsolete-scripts target","fromName":"Johannes Schindelin","fromEmail":"johannes.schindelin@gmx.de","sentAt":"2007-01-11T08:32:04Z","receivedAt":"2007-01-11T08:32:04Z","isPatch":true,"sender":{"key":"johannes.schindelin@gmx.de","avatar":"https://avatars.githubusercontent.com/u/127790?v=4"},"body":"Hi,\n\nOn Thu, 11 Jan 2007, Johannes Schindelin wrote:\n\n> On Wed, 10 Jan 2007, Junio C Hamano wrote:\n> \n> > Johannes Schindelin <Johannes.Schindelin@gmx.de> writes:\n> > \n> > > On Cygwin, newly builtins are not recognized, because there exist both\n> > > the executable binaries (with .exe extension) _and_ the now-obsolete\n> > > scripts (without extension), but the script is executed.\n> > >\n> > > \"make clean-obsolete-scripts\" removes these ambiguities by removing the\n> > > older of these file pairs.\n> > \n> > I would prefer it to be rather automatic -- how about this instead?\n> \n> I like your method better. However, does it execute an rm -f for _every_ \n> builtin, even if it does not exist? This is a huge performance eater on \n> cygwin. Every fork() is _expensive_.\n> \n> Even worse: are you sure that it does not remove the _builtins_? Maybe you \n> noticed that I asked for \"git-bla.\" instead of \"git-bla\", since the latter \n> will happily access \"git-bla.exe\" (at least when you do an \"ls git-bla\" \n> and \"git-bla.exe\" exists, but not \"git-bla\", it _will_ show \n> the metadata of \"git-bla.exe\", but with the name \"git-bla\").\n> \n> Will test.\n\nOkay, I tested. And it works, indeed. No idea why, though. And while it \nlooks a bit strange [*1*], the performance is not as bad as I expected.\n\nCiao,\nDscho\n\n[*1*]\n\n$ make\n[...]\nrm -f git-pack-refs.exe && ln git.exe git-pack-refs.exe\nrm -f 'git-convert-objects';  rm -f 'git-fetch-pack';  rm -f \n'git-fsck-objects';  rm -f 'git-hash-object';  rm -f 'git-index-pack';  rm \n-f 'git-local-fetch';  rm -f 'git-daemon';  rm -f 'git-merge-index';  rm \n-f 'git-mktag';  rm -f 'git-mktree';  rm -f 'git-patch-id';  rm -f \n'git-peek-remote';  rm -f 'git-receive-pack';  rm -f 'git-send-pack';  rm \n-f 'git-shell';  rm -f 'git-show-index';  rm -f 'git-ssh-fetch';  rm -f \n'git-ssh-upload';  rm -f 'git-unpack-file';  rm -f \n'git-update-server-info';  rm -f 'git-upload-pack';  rm -f \n'git-verify-pack';  rm -f 'git-pack-redundant';  rm -f 'git-var';  rm -f \n'git-merge-tree';  rm -f 'git-imap-send';  rm -f 'git-merge-recursive';  \nrm -f 'git-ssh-pull';  rm -f 'git-ssh-push';  rm -f 'git-http-fetch';  rm \n-f 'git-http-push';  rm -f 'git-merge-recur';  rm -f 'git-format-patch';  \nrm -f 'git-show';  rm -f 'git-whatchanged';  rm -f 'git-cherry';  rm -f \n'git-get-tar-commit-id';  rm -f 'git-init';  rm -f 'git-add';  rm -f \n'git-annotate';  rm -f 'git-apply';  rm -f 'git-archive';  rm -f \n'git-blame';  rm -f 'git-branch';  rm -f 'git-cat-file';  rm -f \n'git-checkout-index';  rm -f 'git-check-ref-format';  rm -f \n'git-commit-tree';  rm -f 'git-count-objects';  rm -f 'git-describe';  rm \n-f 'git-diff';  rm -f 'git-diff-files';  rm -f 'git-diff-index';  rm -f \n'git-diff-stages';  rm -f 'git-diff-tree';  rm -f 'git-fmt-merge-msg';  rm \n-f 'git-for-each-ref';  rm -f 'git-grep';  rm -f 'git-init-db';  rm -f \n'git-log';  rm -f 'git-ls-files';  rm -f 'git-ls-tree';  rm -f \n'git-mailinfo';  rm -f 'git-mailsplit';  rm -f 'git-merge-base';  rm -f \n'git-merge-file';  rm -f 'git-mv';  rm -f 'git-name-rev';  rm -f \n'git-pack-objects';  rm -f 'git-prune';  rm -f 'git-prune-packed';  rm -f \n'git-push';  rm -f 'git-read-tree';  rm -f 'git-reflog';  rm -f \n'git-repo-config';  rm -f 'git-rerere';  rm -f 'git-rev-list';  rm -f \n'git-rev-parse';  rm -f 'git-rm';  rm -f 'git-runstatus';  rm -f \n'git-shortlog';  rm -f 'git-show-branch';  rm -f 'git-stripspace';  rm -f \n'git-symbolic-ref';  rm -f 'git-tar-tree';  rm -f 'git-unpack-objects';  \nrm -f 'git-update-index';  rm -f 'git-update-ref';  rm -f \n'git-upload-archive';  rm -f 'git-verify-pack';  rm -f 'git-write-tree';  \nrm -f 'git-show-ref';  rm -f 'git-pack-refs';  rm -f 'git';\n[...]\n"},{"id":"31496","messageId":"20070111214143.GB6058@steel.home","threadId":"6330","inReplyTo":"7vy7oa765a.fsf@assigned-by-dhcp.cox.net","subject":"Re: [PATCH] Makefile: add clean-obsolete-scripts target","fromName":"Alex Riesen","fromEmail":"fork0@t-online.de","sentAt":"2007-01-11T21:41:43Z","receivedAt":"2007-01-11T21:41:43Z","isPatch":true,"sender":{"key":"raa.lkml@gmail.com","avatar":"https://avatars.githubusercontent.com/u/324101?v=4"},"body":"Junio C Hamano, Thu, Jan 11, 2007 01:34:41 +0100:\n> >> I would prefer it to be rather automatic -- how about this instead?\n> > ...\n> >> +ifneq (,$X)\n> >\n> > Perfect! :)\n> \n> Heh, you couldn't have tested -- I still had \"echo rm -f\" in the\n> patch ;-).\n\nDidn't. Just liked the approach :)\n"}]}