* better way to find Git.pm officially?
@ 2012-03-29 4:58 Randal L. Schwartz
2012-03-29 5:10 ` André Walker
2012-03-29 6:13 ` Jeff King
0 siblings, 2 replies; 4+ messages in thread
From: Randal L. Schwartz @ 2012-03-29 4:58 UTC (permalink / raw)
To: git
I'm using Git.pm in a git subcommand. There doesn't (yet :) seem to be
an official way to *find* the directory Git.pm was installed in to add
it to my @INC, so I can up with this ugly hack:
#!/usr/bin/perl
use strict;
use lib $ENV{GITPERLLIB}
? split(/:/, $ENV{GITPERLLIB})
: do {
chomp(my $exec_path = qx{git --exec-path});
open my $gitsvn, "<", "$exec_path/git-svn" or die "Cannot find
git-svn";
{
last unless local $_ = readline $gitsvn;
redo unless m{\Ause lib.*GITPERLLIB.*\|\| "(.*)"};
"$1";
}
};
use Git;
As in, find the git-svn binary (via git --exec-path), parse its second
line to see where the git installer put the GITPERLLIB, and then add
that myself.
Is there a simpler way? Can we get "git --perl-path" added to the
binary or something?
--
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<merlyn@stonehenge.com> <URL:http://www.stonehenge.com/merlyn/>
Smalltalk/Perl/Unix consulting, Technical writing, Comedy, etc. etc.
See http://methodsandmessages.posterous.com/ for Smalltalk discussion
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: better way to find Git.pm officially?
2012-03-29 4:58 better way to find Git.pm officially? Randal L. Schwartz
@ 2012-03-29 5:10 ` André Walker
2012-03-29 6:13 ` Jeff King
1 sibling, 0 replies; 4+ messages in thread
From: André Walker @ 2012-03-29 5:10 UTC (permalink / raw)
To: Randal L. Schwartz; +Cc: git
On 03/29/2012 01:58 AM, Randal L. Schwartz wrote:
> Is there a simpler way? Can we get "git --perl-path" added to the
> binary or something?
Maybe after the GSoC project? :)
Although a --perl-path would probably become unnecessary for newer
versions. I guess after we publish Git.pm to CPAN, we could install it
like a regular Perl module, and just have the perl scripts use it from
default directories in @INC. Unless this will make too much trouble with
compatibility (i.e., installing Git.pm v1.9 on a machine with git v1.8
installed).
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: better way to find Git.pm officially?
2012-03-29 4:58 better way to find Git.pm officially? Randal L. Schwartz
2012-03-29 5:10 ` André Walker
@ 2012-03-29 6:13 ` Jeff King
2012-03-29 6:45 ` Junio C Hamano
1 sibling, 1 reply; 4+ messages in thread
From: Jeff King @ 2012-03-29 6:13 UTC (permalink / raw)
To: Randal L. Schwartz; +Cc: git
On Wed, Mar 28, 2012 at 09:58:12PM -0700, Randal L. Schwartz wrote:
> As in, find the git-svn binary (via git --exec-path), parse its second
> line to see where the git installer put the GITPERLLIB, and then add
> that myself.
>
> Is there a simpler way? Can we get "git --perl-path" added to the
> binary or something?
I always assumed that it was the responsibility of the user or the
packager to put Git.pm into a sane place that is found by perl's normal
lookup (possibly via the user's PERL5LIB if it is a per-user
installation). Doesn't our use of MakeMaker generally pick such a
suitable directory?
-Peff
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: better way to find Git.pm officially?
2012-03-29 6:13 ` Jeff King
@ 2012-03-29 6:45 ` Junio C Hamano
0 siblings, 0 replies; 4+ messages in thread
From: Junio C Hamano @ 2012-03-29 6:45 UTC (permalink / raw)
To: Jeff King; +Cc: Randal L. Schwartz, git
Jeff King <peff@peff.net> writes:
> I always assumed that it was the responsibility of the user or the
> packager to put Git.pm into a sane place that is found by perl's normal
> lookup (possibly via the user's PERL5LIB if it is a per-user
> installation).
Unfortunately, not really.
See what this target does in our Makefile:
$(patsubst %.perl,%,$(SCRIPT_PERL)): % : %.perl
Our scripts know where INSTLIBDIR is, so that we can redirect INSTLIBDIR
to whatever directory that the packager or the user wants to, which may be
outside the usual PERL5LIB.
Especially with NO_PERL_MAKEMAKER installation, perl/Makefile points at
$(prefix)/lib with INSTLIBDIR, and $(prefix) is by default $(HOME), so...
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2012-03-29 6:46 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-03-29 4:58 better way to find Git.pm officially? Randal L. Schwartz
2012-03-29 5:10 ` André Walker
2012-03-29 6:13 ` Jeff King
2012-03-29 6:45 ` Junio C Hamano
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).