Trond Norbye's Weblog

http://blogs.sun.com/trond/date/20090828 Friday August 28, 2009

Support for Monotone VCS

So today I learned about yet another VCS when someone requested support for Monotone. OpenGrok already supports Git, Mercurial, Bazaar, SCCS, Teamware, CVS, RCS, Subversion, Perforce, ClearCase and Razor, so adding yet another system was a trivial thing to do. You need to build OpenGrok from source if you want to try it out right now, or wait for 0.8 to be released :-)

http://blogs.sun.com/trond/date/20090419 Sunday April 19, 2009

Using CVS with pserver access with OpenGrok

Today I pushed two fixes into OpenGrok so that you may use OpenGrok on sources you checked out via the pserver protocol in CVS. From a performance perspective I would not recommend that you use this configuration, but it might be good enough for you if you just want to search your own projects.

With the latest development build of OpenGrok installed into /var/opengrok/bin and /var/tomcat6/webapps/source.war I was able to index and browse the PostgreSQL sources. I checked out PostgreSQL into /var/opengrok/source/pgsql, and executed the following commands:

trond@opensolaris> cd /var/opengrok
trond@opensolaris> java -jar bin/opengrok.jar -c /var/opengrok/bin/ctags \
                              -v -s /var/opengrok/source -d /var/opengrok/data -S -P \
                              -p /opengrok -n -r on -W /etc/opengrok/configuration.xml
trond@opensolaris> java -Xmx2g -jar bin/opengrok.jar -R /etc/opengrok/configuration.xml -U localhost:2424

Please let me know if you have problems getting this to work (or even better, admit that it is 2009 and move on to a more modern SCM system ;-) )

http://blogs.sun.com/trond/date/20090415 Wednesday April 15, 2009

Using Subversion with OpenGrok

In my previous blog entry Using CVS with OpenGrok I showed the steps needed to configure OpenGrok with CVS, and in this entry I will extend that example to include a project using Subversion.

The first thing we need to do is to install a Subversion client and check out the source code. I don't use Subversion for any of my projects, but Knut Anders is working on Apache Derby (hosted in a Subversion repository) so lets use that in this example.

trond@opensolaris> pfexec pkg install SUNWsvn
trond@opensolaris> cd /var/opengrok/source
trond@opensolaris> svn co https://svn.apache.org/repos/asf/db/derby/code/trunk derby

If we use the browser to navigate to http://localhost:8080/source/xref you will see a new directory named derby. The history links and selection box selection box in http://localhost:8080/source/ does however not work for Derby yet, so let's go ahead and update the configuration:

trond@opensolaris> cd /var/opengrok
trond@opensolaris> java -jar /var/opengrok/bin/opengrok.jar -c /var/opengrok/bin/ctags \
                              -v -s /var/opengrok/source -d /var/opengrok/data -S -P \
                              -p /opengrok -n -r on -W /etc/opengrok/configuration.xml

(run look at the man page for a description of the different options).

With the new configuration in place, we can start the index generation:

trond@opensolaris> cd /var/opengrok
trond@opensolaris> java -Xmx2g -jar /var/opengrok/bin/opengrok.jar -R /etc/opengrok/configuration.xml -H

With the new index database in place it is time to update the web application to use the new configuration:

trond@opensolaris> java -Xmx2g -jar /var/opengrok/bin/opengrok.jar -R /etc/opengrok/configuration.xml -n\
                                     -U localhost:2424

Or you could just restart the Tomcat web server:

trond@opensolaris> svcadm restart tomcat6

If you navigate to http://localhost:8080/source/history/derby/README you should get the history for the README file and the annotate link should be available. Subversion supports changesets so you should be able to request history for directories, but the directory information is not cached so this is a potentially slow operation (if you have remote SCM repositories).

http://blogs.sun.com/trond/date/20090410 Friday April 10, 2009

Using CVS with OpenGrok

If you look at the mail archives for OpenGrok it seems that the most popular question out there right now is how to configure OpenGrok with CVS. Personally I have extremely limited experience with cvs, but I guess there is some old projects out there that haven't converted to a distributed scm system yet (check out http://www.selenic.com/mercurial/wiki/index.cgi/RepositoryConversion ;-)). In this blog I'll show you how to configure a project using cvs in OpenGrok.

I don't use cvs, so the first thing we need to do is to install cvs and create a cvs repository for our source. An empty cvs repository doesn't help us, so lets import the OpenGrok sources and use them in the example:

trond@opensolaris> pfexec pkg install SUNWcvs
trond@opensolaris> pfexec zfs create -o mountpoint=/cvsroot rpool/cvsroot
trond@opensolaris> pfexec chown trond:staff /cvsroot
trond@opensolaris> cd /cvsroot
trond@opensolaris> export CVSROOT=`pwd`
trond@opensolaris> cvs init
trond@opensolaris> cd /tmp
trond@opensolaris> hg clone ssh://anon@hg.opensolaris.org/hg/opengrok/trunk opengrok
trond@opensolaris> cd opengrok
trond@opensolaris> rm -rf .hg
trond@opensolaris> cvs import -m "Initial import of OpenGrok" opengrok opengrok-trunk start
trond@opensolaris> rm -rf opengrok

I got my OpenGrok installation in /var/opengrok with the sources in /var/opengrok/source, so let's check out the sources:

trond@opensolaris> cd /var/opengrok/source
trond@opensolaris> cvs co opengrok

The next thing we need to do is to update the configuration with the knowledge of the new project (and it's repository):

trond@opensolaris> cd /var/opengrok
trond@opensolaris> java -jar /var/opengrok/bin/opengrok.jar -c /var/opengrok/bin/ctags \
                              -v -s /var/opengrok/source -d /var/opengrok/data -S -P \
                              -p /opengrok -n -W /etc/opengrok/configuration.xml

(run look at the man page for a description of the different options).

With the new configuration in place, we can start the index generation:

trond@opensolaris> cd /var/opengrok
trond@opensolaris> java -Xmx2g -jar /var/opengrok/bin/opengrok.jar -R /etc/opengrok/configuration.xml

So let's install tomcat and try it out:

trond@opensolaris> pfexec pkg install SUNWtcat
trond@opensolaris> pfexec cp /var/opengrok/source.war /var/tomcat6/webapps
trond@opensolaris> svcadm enable tomcat6

If you navigate to http://localhost:8080/source/history/opengrok/LICENSE.txt you should get the history for the LICENSE file and the annotate link should be available. You should be able to navigate around and look at the change history for the files in your repository. Please note that cvs operates on a pr file basis, so you cannot request history for a directory.

http://blogs.sun.com/trond/date/20080923 Tuesday September 23, 2008

OpenGrok v0.7 beta is out

I have just released the first beta of the next version of OpenGrok, and we really need people to test it out and report bugs. You can download it from the files section on the project page at http://www.opensolaris.org/os/project/opengrok/files/.

Please help us make this the best OpenGrok release so far!

http://blogs.sun.com/trond/date/20080317 Monday March 17, 2008

Bazaar support in OpenGrok

I have just added support for Bazaar repositories in OpenGrok, and thought that I should give you a warning before you start to use it...

First of all I would like to say that I have never used Bazaar in a real project, so I might have done everything totally wrong.

I am not aware of a API that lets me access Bazaar from Java, so I just created a small class that wraps the command line interface. This is the same way the Mercurial support is implemented, and most of the projects available at http://src.opensolaris.org/source use that back-end. Wrapping the binary do have a runtime-penalty, and that is the startup-cost of the binary. To reduce the number of times the binary is executed, OpenGrok already have a cache-layer for the history log (the cache-layer is not used if you try to get history information for a directory).

The biggest problem with Bazaar is that the bzr log -v command is unbelievable slow, and that is the command I need to run to get the history information (I need the files in the changeset). When I tried it on my computer, it used 13 MINUTES on the Bazaar source code itself. I got the repository with the following command:

$ bzr branch http://bazaar-vcs.org/bzr/bzr.dev bzr.dev

As a comparison hg log -v used ~ 2 secs on:

$ hg clone ssh://anon@hg.opensolaris.org/hg/onnv/onnv-gate

I would therefore not recommend that you use the Bazaar support on an OpenGrok server that serves multiple users. If you use it yourself, you should avoid accessing the directory history if you don't need it ;-)

http://blogs.sun.com/trond/date/20080312 Wednesday March 12, 2008

OpenGrok v0.6 is out

I am glad to announce the release of OpenGrok 0.6. This release contains a lot of bug-fixes and some new features. Please see http://src.opensolaris.org/source/history/opengrok/trunk/ for the full change history, and for the list of contributors. The following is just a summary.

New Features:

  • Analyzer-support for Tcl/Tk
  • Analyzer-support for SQL
  • Support for TeamWare repositories

http://blogs.sun.com/trond/date/20080124 Thursday January 24, 2008

OpenGrok and SMF

I have had SMF controlling my OpenGrok server for a long time, but up until today I have always performed the SMF management as root.

When I upgraded my server today I decided to try to figure out what I needed to do in order to create a new profile that I could use to start and stop OpenGrok, and it turned out to be quite easy.

The first thing you need to do is to create the authorizations and the profile by adding them to /etc/security/auth_attr and /etc/security/prof_attr:

/etc/security/auth_attr:
solaris.smf.value.opengrok:::Change OpenGrok value properties::
solaris.smf.manage.opengrok:::Manage OpenGrok service states::

/etc/security/prof_attr:
OpenGrok Administration::::auths=solaris.smf.manage.opengrok,solaris.smf.value.opengrok

The next thing you should do is to add this profile to the users you trust by updating /etc/user_attr

username::::profiles=OpenGrok Administration

(If you don't trust them that much you could give them just one of the authorizations)

You should now be ready to import the OpenGrok SMF description file (tools/smf/opengrok.xml in the OpenGrok source repository) and modify the environment-section to match your local configuration. (Note: you need the one I committed in changeset 228:175ea847bf89)

Import the service by executing the following command:

# svccfg import /path/to/opengrok.xml

Users should now be able to start and stop the service as long as they have the appropriate authorizations.

http://blogs.sun.com/trond/date/20061208 Friday December 08, 2006

OpenGrok v0.4 Released

After 9 month of waiting since the last release of OpenGrok one should expect a major update, but that is not the case.

The reason for not releasing it as 0.3.2 is that this version contains the following new features:

  • Java analyzer
  • Experimental Mercurial support
Look in CHANGES.txt or in the Mercurial log to get the full list of problems fixed.

http://blogs.sun.com/trond/date/20061207 Thursday December 07, 2006

OpenGrok source repository

I am glad to announce that the OpenGrok source code is available in a Mercurial repository on the OpenSolaris website. You may grab a copy with the following command:

hg clone ssh://anon@hg.opensolaris.org/hg/opengrok/trunk/

 
 


Valid HTML! Valid CSS!

This is a personal weblog, I do not speak for my employer.