git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH] perl/Makefile: move "mkdir -p" to module installation loop for maintainability

From
Junio C Hamano <gitster@pobox.com>
Date
Jun 15, 2012, 23:10 UTC
Message-ID
<7vhauc893k.fsf@alter.siamese.dyndns.org>
In-Reply-To
<20120615230234.GA3547@burratino>
Jonathan Nieder <jrnieder@gmail.com> writes:
Show 24 quoted lines
> In the NO_PERL_MAKEMAKER=YesPlease fallback case, make the
> directory that will contain each module when installing it
> (simulating "install -D") instead of hardcoding "Git/SVN/Memoize
> is the deepest level".  This should make this codepath which is
> not used often on development machines a little easier to
> maintain.
>
> Requested-by: Junio C Hamano <gitster@pobox.com>
> Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
> ---
> Jun 15, 2012 at 02:25:34PM -0700, Junio C Hamano wrote:
>> Jonathan Nieder <jrnieder@gmail.com> writes:
>
>>> +	echo '	mkdir -p blib/lib/Git/SVN/Memoize' >> $@
>>
>> Wouldn't it be much less error prone to maintain if you did not
>> hardcode the "blib/lib/Git/SVN/Memoize is the deepest level" here,
>> and run the "mkdir -p blib/lib/$$(basename $$i)" or something in the
>> loop instead?
>
> Yes, I think so.
>
> Wasn't sure if "install -D" or "dirname" is portable, so this
> patch avoids them.

OK. I suspect others may come up with a cleaner solution, so I'm tempted to hold this in 'pu' for now and use the original one, which was _not wrong_ in any way, for the 1.7.11 final.

Thanks.
Show 44 quoted lines
>  perl/Makefile |   16 ++++++++++++++--
>  1 file changed, 14 insertions(+), 2 deletions(-)
>
> diff --git a/perl/Makefile b/perl/Makefile
> index fe7a4864..2e8f9804 100644
> --- a/perl/Makefile
> +++ b/perl/Makefile
> @@ -34,22 +34,34 @@ modules += Git/SVN/Ra
>  
>  $(makfile): ../GIT-CFLAGS Makefile
>  	echo all: private-Error.pm Git.pm Git/I18N.pm > $@
> -	echo '	mkdir -p blib/lib/Git/SVN/Memoize' >> $@
>  	set -e; \
>  	for i in $(modules); \
>  	do \
> +		if test $$i = $${i%/*}; \
> +		then \
> +			subdir=; \
> +		else \
> +			subdir=/$${i%/*}; \
> +		fi; \
>  		echo '	$(RM) blib/lib/'$$i'.pm' >> $@; \
> +		echo '	mkdir -p blib/lib'$$subdir >> $@; \
>  		echo '	cp '$$i'.pm blib/lib/'$$i'.pm' >> $@; \
>  	done
>  	echo '	$(RM) blib/lib/Error.pm' >> $@
>  	'$(PERL_PATH_SQ)' -MError -e 'exit($$Error::VERSION < 0.15009)' || \
>  	echo '	cp private-Error.pm blib/lib/Error.pm' >> $@
>  	echo install: >> $@
> -	echo '	mkdir -p "$$(DESTDIR)$(instdir_SQ)/Git/SVN/Memoize"' >> $@
>  	set -e; \
>  	for i in $(modules); \
>  	do \
> +		if test $$i = $${i%/*}; \
> +		then \
> +			subdir=; \
> +		else \
> +			subdir=/$${i%/*}; \
> +		fi; \
>  		echo '	$(RM) "$$(DESTDIR)$(instdir_SQ)/'$$i'.pm"' >> $@; \
> +		echo '	mkdir -p "$$(DESTDIR)$(instdir_SQ)'$$subdir >> $@; \
>  		echo '	cp '$$i'.pm "$$(DESTDIR)$(instdir_SQ)/'$$i'.pm"' >> $@; \
>  	done
>  	echo '	$(RM) "$$(DESTDIR)$(instdir_SQ)/Error.pm"' >> $@
Previous: Jonathan NiederNext: Johannes Sixt
Message 6 of 8 in “Re: [PATCH] Fix git-svn in non-MakeMaker builds”
  1. Jonathan NiederJun 15, 2012
  2. 2/1 perl/Makefile.PL: warn about duplicate module list in perl/MakefileJonathan Nieder, Jun 15, 2012
  3. Junio C HamanoJun 15, 2012
  4. Junio C HamanoJun 15, 2012
  5. perl/Makefile: move "mkdir -p" to module installation loop for maintainabilityJonathan Nieder, Jun 15, 2012
  6. Junio C HamanoJun 15, 2012
  7. perl/Makefile: Fix a missing double-quoteJohannes Sixt, Jun 29, 2012
  8. Jonathan NiederJun 29, 2012

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.