Making perl scripts include the correct Git.pm

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



  Hi,

  the discussion of the topic became so scatterred that it's rather
difficult to follow now and I get a feeling that we are kind of running
in circles now, so this is my attempt to summarize it:

  Desired behaviour when running Git's perl scripts (ordered by
degree of necessity):

  (D1) When running installed script, it should include Git.pm from the
same installation.

  (D2) When running the testsuite, it should include Git.pm from the
source tree.

  (D3) When running script directly from source tree, it should include
Git.pm from the source tree.


  (i) The original solution passed -I on the #!/usr/bin/perl line, but
that was ugly, was prone to hit various OS limits on the shebang line
and violated both (D2) and (D3).


  (ii) My proposed second solution was to add an autogenerated line to
the Git's perl scripts saying something like:

	use lib ('instlibdir', 'srclibdir');

This fulfills all (D1), (D2) and (D3), but is perceived by Junio as
"disgusting".


  (iii) The currently used solution is to effectively

	use lib ('instlibdir');

to the Git's perl scripts. This violated (D3) and (D2) too, since
use lib is the last from all the @INC modifiers to be seen and thus
overrides and $PERL5LIB set in the testsuite.


  (iv) Variation of (iii), probably Junio's original intention when
implementing it:

	push @INC, 'instlibdir';

This fulfills (D2). It does not fulfill (D3) per se since the user
has to set $PERL5LIB manually when running Git without installing it,
but it is at least fulfillable. However, most importantly this does
not even fulfill (D1) since if you e.g. consider user-local installation
of Git over system-wide installation of Git, local perl scripts will
use the globally installed Git.pm.


  (v) If you throw away user-friendly (D3) requirement and insist
on (iii) being disgusting, this is a newly proposed possible variation
"(iv) meets (i)":

	#!/usr/bin/perl -Imarker
	@INC = map { $_ eq 'marker' ? 'instlibdir' : $_ } @INC;

(I think this is more disgusting than (iii), but tastes differ. ;)


  So, what's the way out?


  PS: Is this the only remaining problem with Git.pm or do we have
anything else to cope with, esp. before it gets considered to be a
next material?

-- 
				Petr "Pasky" Baudis
Stuff: http://pasky.or.cz/
Snow falling on Perl. White noise covering line noise.
Hides all the bugs too. -- J. Putnam
-
: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]