Releasing Bugzilla to CPAN

Once in a while we talk about things such as GreyPAN or DarkPAN referring to open source Perl code that is not on CPAN or code that is hidden behind corporate firewalls respectively. It might be interesting to see if we can encourage more of that code to be released to CPAN.

AFAIK Bugzilla is one of the successful Perl projects in terms of user base but it does not have a huge mind share in the Perl community. I am not sure what are the reasons but I think the fact that it is not on CPAN is part of this so I looked at the project a bit.

Getting the source code

Bugzilla has a wiki page for developers where you can find information on how to contribute to the project. They just recently switched from CVS to Bazaar which is a nice distributed vcs. Instructions on how to get the source code can be found on the Bugzilla Bazaar page.

A single command will check out the whole repository just as in git:

bzr co bzr://bzr.mozilla.org/bugzilla/trunk bugzilla

After checking out the source code you'll see there is no Makefile.PL or Build.PL
but there is a t/ directory holding some unit tests. Running

prove t/

revealed that several modules were missing on the Ubuntu 9.04 I was using at the time.
I am using local::lib to maintain a private directory and I installed the missing modules there:

Actually there are "only" 4041 unit tests as historically they did not write many but there are a lot of tests using Selenium that cover a much larger part of the application. See the Bugzilla QA entry for more details.

Code layout

It seems all the code is either in .cgi files or in modules in the Bugzilla name space.
Modules are relative to the root directory (Bugzilla.pm is in the root directory and Bugzilla::* are in ./Bugzilla/ and not in the ./lib subdirectory as usually recommended by the CPAN community) The .cgi scripts are also in the root directory and there are a few .pl as well. Some of those are used for the installation, others I think need to be setup as cron jobs. In either case IMHO they should be in separate subdirectories such as ./cgi and ./script

What next?

I had a short e-mail discussion with the Bugzilla developers and it seems they are not against the idea of releasing Bugzilla to CPAN but there are a few things that need to be addressed. Especially as they don't want to have a Bugzilla package on CPAN with a broken installation.

Creating a simple Makefile.PL or Build.PL is not a big issue but making sure Bugzilla can be installed using a CPAN client would take some time. Luckily the people who usually install Bugzilla are not doing that from CPAN so they won't expect the CPAN package.

In addition they could create a Makefile.PL and replace the install method by a simple call to

die "This is an experimental package. For installation go to http://www.bugzilla.org/"

That would let them upload a few releases to CPAN, starting to enjoy some of the services of CPAN (e.g. they would get an RT queue for Bugzilla :-) without paying the price of extra support work. That might also lead to some people getting interested in helping them change the packaging/installation to make it work both for people using CPAN and those who want to keep using the current way of installation.

I think this is a great idea and hopefully will push us to make more powerful and sophisticated installers for applications distributable from CPAN. I think that issue is the basic gap that causes people to just try to roll their own installation routine. If we have better installers and better agreed practice on this matter this will be very useful not just for bugzilla but for Perl developers everywhere who are looking to solve complex deployment strategies.