Difference between revisions of "OpenGrok"

From CDOT Wiki
Jump to: navigation, search
(Important Info)
(OpenGrok)
 
(11 intermediate revisions by 4 users not shown)
Line 1: Line 1:
== Introduction ==
+
==Introduction==
OpenGrok is the source browser in use my the OpenSolaris communityIt uses Java Servlets running on Java5
+
OpenGrok is a source code searcher similar in idea to MXR.  It is very advanced and written in Java.  It uses Apache Lucene to build a search database for a source code tree.  This tool is perfect for the new mercurial repository as it has built in hg repo parsing.  There is only version number searching capability I think: you can't use, for example, FIREFOX_3_1b1_RELEASE in the History box.  If there is interest in Mozilla adopting this program, I'd be willing to write support for it.  I'd also like to customize the look and feel for the Mozilla web sitesI have a list of things to do in my script.
  
== Features and Benefits ==
+
[[OpenGrok/script|The Script]]
==== File History ====
 
OpenGrok maintains code version history.  I am currently unsure of whether it looks at the CVS versioning information or whether it compares files between indexes. There is also options for many diffs and comparing different, non-concurrent versions.[http://cvs.opensolaris.org/source/history/on/usr/src/uts/sun/io/eri.c Example]
 
  
After a little looking at the OpenSolaris OpenGrok, it seems that the version histories are more Wiki style than CVS style, so they are arbitrary
+
==Setup==
 +
Setting this up is fairly easy if you know your way around a unix shell.  You will need the following tools:
 +
* JDK 1.5+
 +
* Servlet container - JBoss, Glassfish, Tomcat, Jetty, etc.
 +
* Exuberant Ctags
 +
* Mercurial
 +
* Basic unix programs: sed, zip, unzip, nice, bash
  
==== Extendable ====
+
I am assuming you have set up all the required applications installed and configured.
If there are files which cannot be analysed by the included analysers, OpenGrok allows the user to develop their own analysers, I am unsure of whether or not there is a JavaScript analyser allready, maybe even an XPCOM/XUL analyser could be written, but I don't know the first thing about XPCOM/XUL so this maybe allready implemented in another language.
 
  
==== In File Linking ====
+
You are going to need to download the opengrok binary release tarball from [http://opensolaris.org/os/project/opengrok/ OpenGrok].  Untar it (tar zxf opengrok-0.7.tar.gz) and make note of the directory you put it inNext you will configure the following variables in my script:
The indexer hyperlinks all symbols to the file and line number of their declarationIf the symbol is in multiple files it shows a list of all files which have it.
+
<pre>
 +
#Mercurial Repository to use
 +
REPO=http://hg.mozilla.org/mozilla-central <-- Change to your HG Repo
  
==== Integrates Well ====
+
#Base directory for contents
The header and footer are completely customizable.  OpenGrok could be integrated with the current MDC potentially.  The header and footer are implemented through a variable which holds the copmlete html of the header and footer.
+
BASEDIR=/home/jhford/mozilla <-- This is the base directory for the OpenGrok data files and the HG repo
  
== Example Implementation ==
+
#This is the name of the data directory for OpenGrok
[http://cvs.opensolaris.org/source/ OpenSolaris]
+
DATADIR=data-dir <-- This is the folder *name* for opengrok's data
  
== Installation Procedure ==
+
#This is the name of the source directory for OpenGrok
==== Notes ====
+
SRCDIR=src-dir <-- This is the folder *name* for opengrok's copy of HG code
I will be listing notes for my own reference, feel free to use them
 
  
==== Steps ====
+
#OpenGrok install path - Where is opengrok.jar?
* Install Ubuntu Linux as a server from the Ubuntu DVD
+
OGDIR="/home/jhford/opengrok/opengrok-0.7" <-- this is where the OpenGrok tarball files ended up. It is likely where you ran "tar zxf opengrok-0.7.tar.gz"
* Install the following packages
 
  - ctags -> exuberant-ctags
 
  - sun-java5-jdk
 
  - tomcat5 tomcat5-admin tomcat5-webapps
 
    - Installs GNU Java which must be removed
 
  -make (using 3.81, may need 3.80)
 
  -CVS
 
* Run "sudo update-alternatives --config java" and "apt-get remove --purge java-gcj-compat"
 
* Change the tomcat5 config (/etc/default/tomcat5) to point to the new default Java runtime (/usr/lib/jvm/java-1.5.0-sun/)
 
* Setup a Mozilla code directory (mkdir /var/mozilla)
 
* Checkout code via CVS using make from [http://ftp.gnu.org/pub/gnu/make/make-3.80.tar.gz GNU] [http://developer.mozilla.org/en/docs/Mozilla_Source_Code_Via_CVS Guide on CVS Checkout]
 
* Follow guide at the [http://www.opensolaris.org/os/project/opengrok/manual OpenSolaris Project Guide]
 
  
==== Important Info ====
+
#OpenGrok source.war from opengrok tarball
* /var/lib/tomcat5 is the default $CATALINA_HOME
+
OGCONTEXT="grokzilla" <-- this variable defines the grokzilla in http://china:8080/grokzilla
* /etc/default/tomcat5 has some configuration files
+
OGWAR="${OGCONTEXT}.war" <-- Likely, you will never need to change this
* My SRC_ROOT is /var/mozilla
+
 
* My DATA_ROOT is /var/tmp/opengrok_data
+
#Your application server's .war deployment directory
* My run.sh uses a ctags at /usr/bin/ctags not the default
+
WEBAPPDIR="/home/jhford/tomcat/apache-tomcat-6.0.18/webapps" <-- This is where your app server's war deployment folder is or where you want the resulting war file
* File permissions need to be changed [http://tomcat.apache.org/tomcat-5.0-doc/security-manager-howto.html this may help]
+
<pre>
* Setting up the Admin webapp [http://www.onjava.com/pub/a/onjava/2003/06/25/tomcat_tips.html here]
+
 
 +
Then run the script and notice that you have opengrok!  It will likely show up at http://localhost:8080/grokzilla

Latest revision as of 21:37, 12 November 2008

Introduction

OpenGrok is a source code searcher similar in idea to MXR. It is very advanced and written in Java. It uses Apache Lucene to build a search database for a source code tree. This tool is perfect for the new mercurial repository as it has built in hg repo parsing. There is only version number searching capability I think: you can't use, for example, FIREFOX_3_1b1_RELEASE in the History box. If there is interest in Mozilla adopting this program, I'd be willing to write support for it. I'd also like to customize the look and feel for the Mozilla web sites. I have a list of things to do in my script.

The Script

Setup

Setting this up is fairly easy if you know your way around a unix shell. You will need the following tools:

  • JDK 1.5+
  • Servlet container - JBoss, Glassfish, Tomcat, Jetty, etc.
  • Exuberant Ctags
  • Mercurial
  • Basic unix programs: sed, zip, unzip, nice, bash

I am assuming you have set up all the required applications installed and configured.

You are going to need to download the opengrok binary release tarball from OpenGrok. Untar it (tar zxf opengrok-0.7.tar.gz) and make note of the directory you put it in. Next you will configure the following variables in my script:

#Mercurial Repository to use
REPO=http://hg.mozilla.org/mozilla-central <-- Change to your HG Repo

#Base directory for contents
BASEDIR=/home/jhford/mozilla <-- This is the base directory for the OpenGrok data files and the HG repo

#This is the name of the data directory for OpenGrok
DATADIR=data-dir <-- This is the folder *name* for opengrok's data

#This is the name of the source directory for OpenGrok
SRCDIR=src-dir <-- This is the folder *name* for opengrok's copy of HG code

#OpenGrok install path - Where is opengrok.jar?
OGDIR="/home/jhford/opengrok/opengrok-0.7" <-- this is where the OpenGrok tarball files ended up. It is likely where you ran "tar zxf opengrok-0.7.tar.gz"

#OpenGrok source.war from opengrok tarball
OGCONTEXT="grokzilla" <-- this variable defines the grokzilla in http://china:8080/grokzilla 
OGWAR="${OGCONTEXT}.war" <-- Likely, you will never need to change this

#Your application server's .war deployment directory
WEBAPPDIR="/home/jhford/tomcat/apache-tomcat-6.0.18/webapps" <-- This is where your app server's war deployment folder is or where you want the resulting war file
<pre>

Then run the script and notice that you have opengrok!  It will likely show up at http://localhost:8080/grokzilla