Re: [RFC PATCH v7 4/9] gitweb: Prepare for splitting gitweb
- From
Jonathan Nieder <jrnieder@gmail.com>
- Date
- Dec 24, 2010, 09:29 UTC
- Message-ID
- <20101224092932.GA31537@burratino>
- In-Reply-To
- <20101222235618.7998.17447.stgit@localhost.localdomain>
Jakub Narebski wrote:
Show 7 quoted lines
> Prepare gitweb for having been split into modules that are to be > installed alongside gitweb in 'lib/' subdirectory, by adding > > use lib __DIR__.'/lib'; > > to gitweb.perl (to main gitweb script), and preparing for putting > modules (relative path) in $(GITWEB_MODULES) in gitweb/Makefile.
Spelled out, this means modules would typically go in
/usr/share/gitweb/lib
Is that the right place? I suspect something like
/usr/lib/gitweb/
could make sense in some installations for two reasons:
- even braindamaged webserver configurations would not serve lib/ as static files in that case;
- if some modules are implemented in C for speed, they would need to go in /usr/lib anyway to follow usual filesystem conventions.
Does the Makefile let us override the directory with such a setting?
Show 9 quoted lines
> While at it pass GITWEBLIBDIR in addition to GITWEB_TEST_INSTALLED to > allow testing installed version of gitweb and installed version of > modules (for future tests which would check individual (sub)modules). > > Using __DIR__ from Dir::Self module (not in core, that's why currently > gitweb includes excerpt of code from Dir::Self defining __DIR__) was > chosen over using FindBin-based solution (in core since perl 5.00307, > while gitweb itself requires at least perl 5.8.0) because FindBin uses > BEGIN block
This explanation and the code below leave me nervous that the answer might be "no". ;-)
[...]
Show 17 quoted lines
> --- a/gitweb/gitweb.perl
> +++ b/gitweb/gitweb.perl
> @@ -10,6 +10,14 @@
> use 5.008;
> use strict;
> use warnings;
> +
> +use File::Spec;
> +# __DIR__ is taken from Dir::Self __DIR__ fragment
> +sub __DIR__ () {
> + File::Spec->rel2abs(join '', (File::Spec->splitpath(__FILE__))[0, 1]);
> +}
> +use lib __DIR__ . '/lib';
> +
> use CGI qw(:standard :escapeHTML -nosticky);
> use CGI::Util qw(unescape);
> use CGI::Carp qw(fatalsToBrowser);