git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jonathan Nieder <jrnieder@gmail.com>
To: Junio C Hamano <gitster@pobox.com>
Cc: "Adam Roben" <adam@roben.org>,
	git@vger.kernel.org, "Eric Wong" <normalperson@yhbt.net>,
	"Ævar Arnfjörð Bjarmason" <avarab@gmail.com>
Subject: [PATCH] perl/Makefile: move "mkdir -p" to module installation loop for maintainability
Date: Fri, 15 Jun 2012 18:02:34 -0500	[thread overview]
Message-ID: <20120615230234.GA3547@burratino> (raw)
In-Reply-To: <7vwr388dyp.fsf@alter.siamese.dyndns.org>

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.

 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"' >> $@
-- 
1.7.10.4

  reply	other threads:[~2012-06-15 23:02 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <1339781427-10568-1-git-send-email-adam@roben.org>
2012-06-15 18:05 ` [PATCH] Fix git-svn in non-MakeMaker builds Jonathan Nieder
2012-06-15 18:14   ` [PATCH 2/1] perl/Makefile.PL: warn about duplicate module list in perl/Makefile Jonathan Nieder
2012-06-15 20:23     ` Junio C Hamano
2012-06-15 21:25   ` [PATCH] Fix git-svn in non-MakeMaker builds Junio C Hamano
2012-06-15 23:02     ` Jonathan Nieder [this message]
2012-06-15 23:10       ` [PATCH] perl/Makefile: move "mkdir -p" to module installation loop for maintainability Junio C Hamano
2012-06-29  8:07       ` [PATCH jn/perl-makemaker-leading-paths] perl/Makefile: Fix a missing double-quote Johannes Sixt
2012-06-29  8:55         ` Jonathan Nieder

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20120615230234.GA3547@burratino \
    --to=jrnieder@gmail.com \
    --cc=adam@roben.org \
    --cc=avarab@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=normalperson@yhbt.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).