Rss support on jhbuild-buildbot

Recently I have joined with Iago to make efforts on the work of the build brigade development, the continuous integration system for gnome.

The first task was install an work enviroment on my local machine, using the work of Iago and Dape on use the buildbot integration system on jhbuild, the tool to compile gnome modules.

At first I use the buildbot from cvs, but then I switch with the 0.7.5 version, as is the one the build brigade production page is using. But this work let me enter on the buildbot code, to make the neccesary changes to work with it, and start to see how is the python code, as I have no previous experience with it.

But python is an dynamic object-oriented programming language very intuitive, so I understand almost all.

Then, I started with a real useful task. The idea is add RSS support to this buildbot. To do that I start first using the Dape changes on buildbot to add feeds to the failed builds, but then I start to use the Lieven Govaerts work (based on Dape’s works). The advantage of Lieven work is that this adds new classes, creating a new file with this new classes, without modifying the buildbot code. This is more “clean” as we don’t need to add patches to the buildbot, or wait to apply these, and makes it easier to keep in sync with buildbot releases.

One of the buildbot advantages is that is really easy extend it. So view this more easily this is an summary class diagram:

Feeder Diagram Classes

On the diagram the white classes are the original buildbot classes, gray classes came from Twisted module, red classes are the ones which adds Lieven Govaerts and the green one is that we define in our custom buidbot.tac.

Well, one you reach this, review the code etc., you can think, “well nothing more to do!”. But we have a weird problem. This feeds takes the failed log builds and create a rss/atom element. In this case the build log are the jhbuild logs. And we have a problem with this. At first the rss failed, getting a crash on this line:

*** error during stage configure of cairo: ########## Error running ./configure –prefix /home/gnomeslave/devel/gnome/work/prefix –disable-static –disable-gtk-doc –enable-coverage *** [1/1]

So we go to the log, and we see some strange symbols on this line (and realize that the line appear two times):

*** Configuring cairo *** [1/1]
jhbuild: Configuring cairo [1/1]

Looking after this I have found the problem. jhbuild show his log in a pretty print way, showing some phases in bold and add the title to the current terminal. To do that it adds some special symbols. In the case of the bold, it uses “tput bold” to get the special symbol (as it can be different on each terminal). To the title it checks if it is and xtem or rxvt, and uses the special symbols 33] 07. But in our case we don’t need this, we only want the log as a plain text, as this will be used to be showed on the web browser. The log with strange symbols on the web page is only a annoying problem, but the crash on the rss feed is a real problem.

So I started to work on the jhbuild code, as the first idea was avoid to print this ones from the jhbuild. jhbuild has a configuration parameter called “pretty_print”, used to allow to print the output on the terminal in a enhanced visual way (colors, etc.) So my initial idea was include the bold and the title in the “pretty print concept”.

But this has a problem. It is easy to do, but I need to create a patch, add a bug on jhbuild bugzilla page, and wait this to be applied. Meanwhile, to use it we’ll be using and “custom jhbuild” and everyone who wants to install the jhbuild-buildbot scripts, need to take it into account, applying this patch. And, in my personal opinion, I don’t think that a patch that is only a enhancement required for an concrete project could be a high priority task for jhbuild guys. If I were an jhbuild maintainer I will ignore this patch for a long time 😉

At first I realize that the title is only set when an xterm is detected. So I tried to change the environment variable TERM to another terminal (vt100) and this works. Using this idea, I start to search a terminal with no bold support. Reading a little the terminfo manpage, and another related, I used the adm3, and this works!! 😛

So, to solve this problem, instead of modify the jhbuild code, you only need to modify it on your slave .bashrc file:
export TERM=adm3

Simple, no?

Well, this work is done, I hope that this will be released soon on the buildbrigade production page, enjoy it! 🙂

PS: on the lines which appears the strange symbols, I have removed this ones. This is because the feed started when I added this 😉