Friday, December 21, 2012

Back on Trac

This is a follow on to my recent post about installing Trac on Ubuntu. I had installed Trac 12.1, served from Ubuntu 12.04, but running in Virtual Box.

Now I have a real live Mac Pro to play with. However, the Ubuntu is crusty old 11.04 but I did not install it and I don't know who did.. .I have 0 experience installing on the Mac, and am not ready to take the plunge and risk bricking the Mac Pro. The reason this is relevant is because this time when I install Trac, I don't want to go the apt-get route, because it will load version 11 of Trac.

Instead, I am going to use easy_install to get the latest Trac 1.0. There are two different references I am using:

UbuntuTracHowto: SVN + Apache + Trac setup. Installs Trac by apt-get.

Robert Basic: I used this reference for installation of Trac via easy_install, but I don't do the wsgi stuff.

At this point, I can now browse the minimal Trac setup. I don't want to bore you with the mundane details of setting permissions and what-not.... what's next:

Enable WebAdmin

Setup source code repository:  go to "Administration: Repositories" and add the path to the repository. Trac responds with the the following:

  • The repository "test_repo_trac" has been added.
  • You should now run trac-admin $ENV repository resync "test_repo_trac" to synchronize Trac with the repository. e.g. trac-admin /var/lib/trac/my_trac_proj/ repository resync "*"
  • You should also set up a post-commit hook on the repository to call trac-admin $ENV changeset added "test_repo_trac" $REV for each committed changeset.
... so here is what I put in my hooks/post-commit:


#  /var/www/.python-eggs
# export PYTHON_EGG_CACHE="/var/lib/trac"

trac-admin /var/lib/trac/mytracproj/ changeset added "$1" "$2"


Issue:  Source Browser doesn't show up on the Trac page.

Try apt-get install python-subversion.

Try removing the repository from the Admin screen, and re-added it. The following error was shown:

Can't synchronize with repository "(default)" (Unsupported version control system "svn": Can't find an appropriate component


In Trac 1.0 (trunk, starting from r11082), the components for Subversion support must be explicitly enabled in trac.ini [components] section:

tracopt.versioncontrol.svn.* = enabled

... or by going into Admin | General | Plugins (Manage Plugins), and selecting the component in the Trac 1.0 plugin.


CommitTicketUpdater is working after following the instructions to enable components CommitTicketReferenceMacro and CommitTicketUpdater. 


CodeReviewerPlugin working.


Tuesday, December 18, 2012

Your Face is a Python


I was asked to find a way to programmatically analyze some log files - those files are a tab delimited format with something like 6 fields of data. This sort of thing I might have done in Perl at one time. However, having been some very long time since I did anything in Perl, and, I don't know, just not finding Perl very intuitive right now for some reason. With my recent discovery of the Trac software project management system, all written in Python, I decided it was time to jump right into some Python programming.

I have to say that it was pretty easy to knock together a simple text file parser... Python seems to be very clean and to the point. Maybe one day I'll stop using shell scripts and sed for everything (when all you have is a hammer, yada yada )..

Wednesday, December 12, 2012

Trac Setup

Trying to setup a Ubuntu Virtual Box to evaluate Trac (issue tracking system for software development projects). 


There were a lot of installation steps, since it requires setting up Subversion in Apache in addtion to the Trac server itself. There is plenty of documentation how to do this, but I found a handy guide by David Winter that gets right to the point.

One small change I made is using SVNParentPath, with multiple repos under /var/lib/svn, e.g.

  DAV svn
  SVNParentPath /var/lib/svn

  AuthType Basic
  AuthName "Subversion Repository"
  AuthUserFile /etc/apache2/dav_svn.passwd
  Require valid-user


I installed Trac (version 0.12.2-1build1) using apt-get.
Evaluation of some software peer review plugins for Trac:


PeerReviewPlugin: installed from the downloaded source zip file and followed the standard Trac plugin install instructions. When I attempted to open a new review I got the error "'NoneType' object has no attribute 'youngest_rev'". There was already a ticket - 7034 - for this issue and the multiple-repo.patch  seems to address the problem. But when creating a new code review ... how to easily add the files based on a diff or a changeset? like the line by line comments though.



I want to see the files committed in conjunction with the ticket ... TicketModifiedFilesPlugin ...

but only worked on some tickets references?

Try CommitTicketUpdater and follow the instructions to enable the component.

Appears to setup correctly, but no information is added to tickets.
Tried some advice from the webs (maybe wasn't necessary after all?):
 However, the updater requires the changeset author to have TICKET_MODIFY
permission to close tickets. If your commit username is different from
your Trac username, you will not have the required permission. So you
should disable that check by setting the "[ticket]
commit_ticket_update_check_perms" option to "false" in trac.ini.


... because stupid me not properly "wikifying" my tag ... brackets dummy ... [re #4]


And then all is working after one more edit to the post-commit script: 



# The Python egg cache directory is currently set to:

#  /var/www/.python-eggs

export PYTHON_EGG_CACHE="/var/lib/trac"


CodeReviewerPlugin:  ok .. simple ... no line by line comments. But get an error when try to submit the code review.


AttributeError: 'NoneType' object has no attribute 'get_changeset'