All of lore.kernel.org
 help / color / mirror / Atom feed
* Error.pm: add configuration variable in Makefile
@ 2007-02-16 21:00 Michael
  2007-02-16 21:18 ` Junio C Hamano
  2007-02-17 14:38 ` Sergio Callegari
  0 siblings, 2 replies; 4+ messages in thread
From: Michael @ 2007-02-16 21:00 UTC (permalink / raw)
  To: git

When compiling, we check in perl/Makefile.PL if Error.pm is available. If not, 
we use our Error.pm instead. So, after a "make install" the system does have 
an Error.pm. This is fine, unless we are used to create an 
rpm/deb/whatever-it-is by ourselves and install it with the system's package 
manager: in this case, in fact, the git package we are building will have an 
Error.pm only if the package currently installed does not. Of course, once we 
install the new package, the next one won't ship Error.pm because 
perl/Makefile.PL thinks it doesn't need to; but that's obviously wrong, since 
the package manager will delete the old Error.pm when installing the new git 
package.

I guess we should use at least a configuration variable
(USE_PRIVATE_ERROR_PERL?) to let the user decide what to do: either force
the use of Error.pm shipped with git or just go on as we do today.

Something like the following, but less ugly...

---
diff --git a/Makefile b/Makefile
index 40bdcff..ff886df 100644
--- a/Makefile
+++ b/Makefile
@@ -101,6 +101,9 @@ all::
 # Define NO_PERL_MAKEMAKER if you cannot use Makefiles generated by perl's
 # MakeMaker (e.g. using ActiveState under Cygwin).
 #
+# Define USE_PRIVATE_ERROR_PERL if you want to force the use of
+# perl/private-Error.pm (e.g. for packaging purposes).
+#
 
 GIT-VERSION-FILE: .FORCE-GIT-VERSION-FILE
 	@$(SHELL_PATH) ./GIT-VERSION-GEN
@@ -580,6 +583,9 @@ endif
 ifdef NO_PERL_MAKEMAKER
 	export NO_PERL_MAKEMAKER
 endif
+ifdef USE_PRIVATE_ERROR_PERL
+	export USE_PRIVATE_ERROR_PERL
+endif
 
 # Shell quote (do not use $(call) to accommodate ancient setups);
 
diff --git a/perl/Makefile b/perl/Makefile
index 099beda..84b16f9 100644
--- a/perl/Makefile
+++ b/perl/Makefile
@@ -27,6 +27,9 @@ $(makfile): ../GIT-CFLAGS Makefile
 	cp private-Error.pm $(instdir_SQ)/Error.pm' >> $@
 	echo instlibdir: >> $@
 	echo '	echo $(instdir_SQ)' >> $@
+else ifdef USE_PRIVATE_ERROR_PERL
+$(makfile): Makefile.PL ../GIT-CFLAGS
+	'$(PERL_PATH_SQ)' $< useerror PREFIX='$(prefix_SQ)'
 else
 $(makfile): Makefile.PL ../GIT-CFLAGS
 	'$(PERL_PATH_SQ)' $< PREFIX='$(prefix_SQ)'
diff --git a/perl/Makefile.PL b/perl/Makefile.PL
index 9b117fd..f11affc 100644
--- a/perl/Makefile.PL
+++ b/perl/Makefile.PL
@@ -13,7 +13,7 @@ my %pm = ('Git.pm' => '$(INST_LIBDIR)/Git.pm');
 # We come with our own bundled Error.pm. It's not in the set of default
 # Perl modules so install it if it's not available on the system yet.
 eval { require Error };
-if ($@) {
+if ($@ || $ARGV[0] eq 'useerror') {
 	$pm{'private-Error.pm'} = '$(INST_LIBDIR)/Error.pm';
 }
 

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: Error.pm: add configuration variable in Makefile
  2007-02-16 21:00 Error.pm: add configuration variable in Makefile Michael
@ 2007-02-16 21:18 ` Junio C Hamano
  2007-02-17 14:38 ` Sergio Callegari
  1 sibling, 0 replies; 4+ messages in thread
From: Junio C Hamano @ 2007-02-16 21:18 UTC (permalink / raw)
  To: Michael; +Cc: git

Michael <barra_cuda@katamail.com> writes:

> When compiling, we check in perl/Makefile.PL if Error.pm is available. If not, 
> we use our Error.pm instead. So, after a "make install" the system does have 
> an Error.pm. This is fine, unless we are used to create an 
> rpm/deb/whatever-it-is by ourselves and install it with the system's package 
> manager.

The private copy is only to help people who build from the
source _and_ are lazy enough to install Error.pm from more
official sources (either CPAN or officially pacakged ones).

My preference is to never allow out private copy to leak into
binary packages, and have our binary packages _always_ depend on
the officially packaged ones.

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Error.pm: add configuration variable in Makefile
  2007-02-16 21:00 Error.pm: add configuration variable in Makefile Michael
  2007-02-16 21:18 ` Junio C Hamano
@ 2007-02-17 14:38 ` Sergio Callegari
  2007-02-18  8:45   ` Junio C Hamano
  1 sibling, 1 reply; 4+ messages in thread
From: Sergio Callegari @ 2007-02-17 14:38 UTC (permalink / raw)
  To: git

Michael <barra_cuda <at> katamail.com> writes:

> 
> When compiling, we check in perl/Makefile.PL if Error.pm is available. If not, 
> we use our Error.pm instead. So, after a "make install" the system does have 
> an Error.pm. This is fine, unless we are used to create an 
> rpm/deb/whatever-it-is by ourselves and install it with the system's package 
> manager: in this case, in fact, the git package we are building will have an 
> Error.pm only if the package currently installed does not. Of course, once we 
> install the new package, the next one won't ship Error.pm because 
> perl/Makefile.PL thinks it doesn't need to; but that's obviously wrong, since 
> the package manager will delete the old Error.pm when installing the new git 
> package.
> 
> 

Apart from those making rpm/deb/whatever, I see another scenario where the
current selection logic for systemwide Error.pm and private Error.pm may fail.
This is if one uses GNU Stow for managing software that is not managed by the
distro packaging system... whatever.

A typical upgrade flow would be:

You have Git version X installed in /usr/local/stow/Git-X and stowed.
You now compile version X+1 of git, with prefix /usr/local/stow/Git-X+1
(here the current Error.pm logic thinks that there is no need for the private  
 Error.pm since it finds an Error.pm -- only it is the Error.pm from the Git-X
stowing)
You install Git version X+1 in /usr/local/stow/Git-X+1
You unstow Git version X
You stow Git version X+1
Git version X+1 fails because of missing Error.pm

I.e. identical problem as with a true package manager.
Problem is that the "private" Error.pm is put in a "public" location and not
kept private with the current installation of Git.
  

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Error.pm: add configuration variable in Makefile
  2007-02-17 14:38 ` Sergio Callegari
@ 2007-02-18  8:45   ` Junio C Hamano
  0 siblings, 0 replies; 4+ messages in thread
From: Junio C Hamano @ 2007-02-18  8:45 UTC (permalink / raw)
  To: Sergio Callegari; +Cc: git

Sergio Callegari <scallegari@arces.unibo.it> writes:

> Problem is that the "private" Error.pm is put in a "public" location and not
> kept private with the current installation of Git.

I see.

I do not think anybody minds too much if the private Error.pm is
installed in $(prefix)/share/git-core/perl/ or somesuch, as long
as you arrange things so that Git.pm can find it, so go wild.

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2007-02-18  8:45 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-02-16 21:00 Error.pm: add configuration variable in Makefile Michael
2007-02-16 21:18 ` Junio C Hamano
2007-02-17 14:38 ` Sergio Callegari
2007-02-18  8:45   ` Junio C Hamano

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.