Subject: Re: [spf:guess,iffy] Re: "Integrated Web Client for git" GSoC proposal

From: Jakub Narebski <[email-masked]>
Date: Fri, 16 Apr 2010 11:18:30 +0200

On Thu, 15 April 2010, Sam Vilain wrote:
> On Thu, 2010-04-15 at 02:04 +0200, Jakub Narebski wrote:

> > gitweb was and is meant to be simple, easy to install git web interface
> > (single script + some static files), with minimal dependencies outside
> > Perl core, and running with as old Perl as feasible (good Unicode support
> > is requirement that forces minimal Perl version).

By the way, is the above statement correct?  What should be the *goal*
for gitweb?  Is it running on oldest Perl possible (which IIRC is Perl
5.8.6, because gitweb needs good Unicode support)?  Is it minimal 
required non-core dependencies (core as of Perl 5.8.6)?  Is it being
easy to install (single monolithic script + some minimal number of static
files like CSS, JavaScript, images + perhaps extra files with optional
features like output caching) by hand?  Is it being easy to configure
by hand?

With local::lib it is easy to install Perl modules from CPAN locally
(in home directory), so perhaps we could ease on minimal dependencies
rule.  On the other hand gitweb is web app, and one would have to be
able to configure web server to use locally installed Perl modules,
which might be not possible; this swicthes the problem from "not being
able to install Perl modules as non-root" to "not being able to install
Perl modules that web server can use without help from sysadmin".

One of requirements is backwards compatibility of gitweb links (URLs),
both query string based, and path_info URLs.  Yet another is ability
to *scan* for projects (this is IIRC requirement for git.kernel.org),
rather than using project index file (perhaps (re)generated 
(semi)automatically).

> > 
> > Gitalist requires Catalyst web framework, which while it is (one of)
> > modern Perl web frameworks is not exactly lightweight.
> 
> Ok, I just re-checked the dependencies and my assertion that a pure-perl
> Gitalist would be possible is indeed wrong.  It certainly is though with
> very lightweight frameworks like CGI::Application.  If you are splitting
> the script up, all the best to you, but please do consider something
> like that rather than re-inventing the wheel!

There exists very many web frameworks in Perl[1][2][3][4]: Catalyst
(one of more popular, used by Gitalist), Jifty, CGI::Application (and
its offshot Titanium), Mojolicus, Dancer, Squatting, Web::Simple,...

Nowadays many (all mentioned) of those web frameworks are either built
on top of PSGI / Plack (Perl Superglue for Web Frameworks and Web Servers),
or have PSGI / Plack adapter (see http://plackperl.org).  So another
solution would be to use bare-bones Plack instead of CGI with help
of CGI.pm, perhaps also using one of URI dispatchers[5][6].  Plack/PSGI
looks like the future of Perl web scripting... but is currently quite new,
at version 0.9930.

[1]: http://www.perlfoundation.org/perl5/index.cgi?web_frameworks
[2]: http://plackperl.org/ ("Frameworks" section)
[3]: http://perl.worldken.org/search?q=web+framework
[4]: http://search.cpan.org/search?query=web+framework&mode=all

[5]: http://www.perlfoundation.org/perl5/index.cgi?web_application_dispatchers
[6]: http://github.com/miyagawa/plack-dispatching-samples

As to splitting gitweb into smaller modules (like e.g. SVN::Web)...
Gitweb isn't the largest script in git sources: gitk is.  But splitting
gitk should be much easier - git-gui is already split.  Close after
gitweb is git-svn, which probably also need splitting; and again it
would be easier to split parts of git-svn e.g into Git::SVN module,
as git-svn already depends on Git.pm.

The trouble with splitting is installing split web script.  I have no
idea how to do this in cross-webserver way, cross-distribution and
cross-system way (the filesystem hierarchy used by web server may
differ from distribution to distribution, and from operating system
to operating system).

-- 
Jakub Narebski
Poland