Michal Čihař - Archives

Converting to Subversion

After more playing with Tailor, I managed to hack it enough to convert my Arch repositories to Subversion. Move from distributed to non distributed VCS migth look as step backwards, but I have pretty good reasons for this:

  • Subversion is widely used and there is big chance that potential contributor will know how to use it. This lowers barrier for contributing (especially when compared to current Arch/Bazaar).
  • Subversion sucks much less than CVS which is other well known VCS.
  • If I want to work distributed I can still use Bazaar-NG with foreign branch features.

The conversion is currently on the way and will probably need some time (about half of Gammu revisions have been converted so far).

VCS conversion troubles

It's probably time to give up. I tried to tweak tailor to make it able to convert my repositories to Subversion for several times, but without any success. It also fails to convert it to Bazaar-NG or Git. Those are list of all VCS I consider to use in future.

I'd prefer to switch to subversion, because it is widely used and most people will be willing to use it, but I have not find any way to convert current VCS data to it. Maybe I will start with empty repository and forget the history.

Optimise your code

Especiall if there is chance it will be used on something like OpenWRT. Yesterday I installed Munin on my OpenWRT router. Now I can see that sometimes statistics drop to zero, because it didn't manage to catch them.

I looked for most CPU hungry plugins and those are df_inode and processes. I rememeber that I already had to rewrite df_inode, because it was damn slow, so I only used that version (it should be also somewhere in their tracker, but I can not find it right now).

The processes plugin was also quite easy to optimise, compare old and new code:

 # time find /proc -type d | grep [0-9]$ | tr -d "/proc/" | grep ^[0-9]*$ | wc -l
 real    0m 0.77s
 user    0m 0.28s
 sys     0m 0.39s

 # time ls -d /proc/[1-9]* | wc -l
 real    0m 0.06s
 user    0m 0.04s
 sys     0m 0.00s

Buggy phones

I played a bit with Gammu and my phone (Sony-Ericsson K750i) yesterday, and I found yet another firmware bug. Enabling call line identification over cable (or any connection) makes phone hang when you receive call. Don't know why it is not able to look up number, when it already shows it on the display…

Converting locales data

I already announced that Gammu translations were converted to gettext. Reasons for conversion were written already some time ago. Now I'd like to write about some technical details on conversion.

First I thought the conversion will be simple. Just convert one text file format to other. Unfortunately there were lots of typos in old translations, which I had to fix, because gettext is much stricter about syntax. This itself would be also good reason to switch - old localisations had several types of errors, most frequently bad escaped quotes or messed format strings. This sometimes lead to Gammu crash, because it confuses printf like functions.

Another thing which was broken in old translation were duplicates of some strings. There were about 20 duplicate messages, which only added work to translators and were never used, because Gammu used first string which matched.

After I spot common mistakes, it was quite easy to write conversion script which would handle them. It is written in Python and uses its ConfigParser module to read old localisations. Using already done modules makes thinks a lot easier :-). After reading them, they are fixed to avoid syntax errors in gettext and written in gettext format to new file. All this in 123 lines of code (well, many of this are comments and string constants).

PS: You can download conversion script here, maybe it will be usable also for some other project.

Version control system for Gammu and others

I still more and more think, that I should move out of Bazaar to some more maintained piece of software for version control. The biggest problem I currently see, that I was not able to convert by Bazaar repositories to some other format. I tried to convert to Bazaar-NG by booth BzrTools and Tailor, but none of them succeeded, then I tried conversion to Git, but Tailor failed also on this task.

Maybe I will try Subversion, which is now very widely used software, although it has some annoyances. I originally wanted distributed VCS, because I was often offline at home, but this is not the case anymore, so using centralised VCS on my own server should not be a big problem.

Don't send patches by email

I just noticed that I tend to forget about patches that I received sometimes and didn't have time to review them right as they arrived. Fortunately that person reminded itself by sending another patch, so I got back to original issue, but it's unfortunate to loose patches just because of my bad memory.

So please bug trackers, there is much higher probability that issue won't be forgotten :-).