Code Indexer

From CDOT Wiki
Revision as of 00:08, 9 November 2006 by John64 (talk | contribs) (Almost a complete re-do)
Jump to: navigation, search

Project Name

Source Code Indexing Service Analysis

Project Description

Mozilla’s source code is enormous—millions of lines of C, C++, JavaScript, Perl, Python, Java, C#, etc. Developers currently use the lxr system to quickly search and browse it on-line: http://lxr.mozilla.org. Mozilla is planning a move from CVS to Subversion for revision control, and at the same time wants to evaluate other source indexing services. Two BSD students are working to setup, document, and test other potential services (e.g., fisheye, opengrok, mxr) on one of the Seneca-Mozilla servers (see below). In each case this requires configuration changes and some scripting to get the services to properly integrate with Mozilla’s other on-line tools. When the test services are installed and synched with the live source tree, Mozilla will point its developers to them and get feedback—the students will help collect and synthesize this feedback.

Project Leader(s)

John Ford (John64)

Project Contributor(s)

Options

  • Help with LXR/MXR/Bonsai development.
  • Make a sort-of branch respectful version of OpenGrok
  • [Re]write major portions of how OpenGrok deals with history and changesets and the likes, this is my personal preference.
  • Try to fit Fisheye into the current development model, but it seems this might be more like finding a problem for a solution. That is not to say this is a very good tool!

Links

Pulling CVS

This code will pull the CVS for the branches specified in @branches

#!/usr/bin/perl
use strict;
use warnings;

# Pull CVS from the mozilla project server
my $src_root = "/var/mozilla";

# Where you want to you the HTML for the branch info
# This could be SSI'd, but that is a lot of work to set
# up with the ubuntu packages
my $branchlistpath = "${src_root}/branches.html";

# Where is your run.sh for opengrok? (or equivalent script to start the indexer)
my $opengroker = "/var/opengrok/run.sh";

# Where is your server?
my $cvsserver = ':pserver:anonymous@hera.senecac.on.ca:/cvsroot';

# Branches to be pulled
my @branches = (
  "HEAD",
  "MOZILLA_1_8_BRANCH", 
  "MOZILLA_1_8_0_BRANCH", 
  "AVIARY_1_0_1_20050124_BRANCH",
  "REFLOW_20061031_BRANCH" 
);

# Descriptions for each branch, don't delete old ones for the sake of deleting them
my %descriptions = (
  "HEAD" => "Trunk - development branch",
  "MOZILLA_1_8_BRANCH" => "Firefox 2.0 - development branch",
  "MOZILLA_1_8_0_BRANCH" => "Firefox 1.5 - maintainance branch",
  "MOZILLA_1_7_BRANCH" => "Firefox 1.0 - maintainance branch",
  "AVIARY_1_0_1_20050124_BRANCH" => "Suite - maintainance branch",
  "REFLOW_20061031_BRANCH" => "Reflow Refactoring"
);

# Open the file or
open BRANCHLIST, ">$branchlistpath" or die "Could not open file";

# Number of branches, twice, once for the line, once for the description
my $branchcount = ($#{branches} + 1) * 2;

# Print the begining of the select block  
print BRANCHLIST "<select class=\"q\" name=\"branch\" size=\"${branchcount}\" value=\"\" onClick=\"document.cookie = document.sbox.branch.selectedIndex;\"  />\n";

# Clear out what ever source was there
system ("rm -rf ${src_root}/*");

foreach (@branches){
# Download the makefile, then checkout from the makefile
  system("
    mkdir ${src_root}/$_;
    cd ${src_root}/$_;
    cvs -d ${cvsserver} co -r $_ mozilla/client.mk;
    make -f ${src_root}/${_}/mozilla/client.mk checkout MOZ_CO_PROJECT=all;
  ");
  # This is for an attempt at doing something, it is mostly useless
  print BRANCHLIST "\t<optgroup label=\"$descriptions{$_}\" />\n";
  print BRANCHLIST "\t<option> $_ </option>\n"; 
}

print BRANCHLIST "</select>\n";

system ("bash $opengroker");