Archive for the ‘tips’ Category

How to use jhbuild, the easy way

Wednesday, September 22nd, 2010

globos-o-clock

Inspired by André’s recent post I recalled that many people have gave me bad feedback about jhbuild. So I thought I might share some ideas and tips, here we go:

  • Don’t use the jhbuild shipped by your distribution, use git master
  • Only build what you need, buildone is your friend
  • Prefer distro packages when possible, ALWAYS
  • I want to test the latest awesome version of RupertBrowser!
    jhbuild buildone rupert-browser
  • But… I want to have RupertBrowser from master and it requires a LibBrowser that is not in my distro!
    jhbuild buildone libbrowser rupert-browser
  • Awesome! But it seems RupertBrowser devs have a cool branch I’d like to automatically build, I bet you can’t do that!
    Edit
    your jhbuildrc:
    branches['rupert-browser'] = (None, ‘new-cool-branch’)
  • No wait, but that branch requires me to use the –enable-coolness switch for configure… how do I do that?
    jhbuildrc again:
    module_autogenargs['rupert-browser'] = ‘–enable-coolness’
  • This all looks nice, would you please show me a somewhat basic jhbuildrc file anyway?
    Sure, but don’t ask me to explain it all, use your bright mind or read jhbuild’s documentation, or config.py script (from jhbuild’s repo in git.gnome.org). Here it is:

# if you are a committer to git.gnome.org, this is your line
# ignore it if you are not a committer
repos['git.gnome.org'] = ‘ssh://someone@git.gnome.org/git/’

# see jhbuild’s repository for the classic modules or use a path to a custom one
moduleset = ‘gnome-2-32′

# don’t hit the internet for modules, just use what came with jhbuild
use_local_modulesets = True

# only build modules when there are new commits since the last time
build_policy = ‘updated’

# simultaneous build anyone?
makeargs = ‘-j4′

### Branches
branches['gtk+'] = (None, ‘awesome-new-stuff’)

### Checkout and install prefix
checkoutroot = ‘/home/user/gnome/’
prefix = ‘/home/user/gnome/build’

### Custom configuration
autogenargs = ‘–disable-static –disable-gtk-doc ‘
module_autogenargs['epiphany'] = autogenargs + ‘–something-magic’

### Extra env, you can set anything for the shell env here
os.environ['CFLAGS'] = ‘-g -O2′

Posting to pastebin from git

Thursday, February 11th, 2010

I usually need to show someone a simple patch from a local git repo, my method was to run git format-patch and upload the result to my gnome.org userdir with a script conveniently called internets. This of course filled my userdir with garbage in the long run and also was a multiple step process.

So today, after a quick apt-cache search, I installed pastebinit, but then my problem was that there is no glue between this tool and git. Some googling took me to mentions of git-porcelains but I didn’t want to install that so I tried something simpler, a git alias.

I crafted this line for .gitconfig:
pastebinit = !sh -c 'git format-patch -1 –stdout $1 | pastebinit -f diff' -

Update: Ray and Pablo shared some ideas in the comments, the alias is updated, thanks!.

That I can use like this:
git pastebinit [commit]

It runs and outputs the url of my new pastebin’d code :-) . I’m happy with it, but open to suggestions. Hope it’s useful for someone.

Saving your neck when git-svn dcommit fails

Wednesday, March 18th, 2009

Over the weekend I had to send some changes to an SVN repo. Thing is that I use git-svn to have all those XXI century benefits like local commits.

Sadly I had some problems with git-svn, concretely it failed half the way through sending my really big number of changes. The result was that I was left with uncommitted changes and missing commits after such set of changes. No need to say that I was really nervous about the state of my hard work of the week…

So after some desperate google searches and some questions to my personal GIT expert, desrt, I found this mail in google groups. I reproduce the process here:

How to save your neck when git-svn dcommit fails half through the process

  1. Open .git/logs/HEAD
  2. Look for your most recent commit (note that these commits are sorted by “unix time”, although you can also find the latest one by reading the shortlog there
  3. Confirm that the commit you found is the right one: git show
  4. git reset --hard hash from log
  5. git svn rebase
  6. git svn dcommit

This picks up where it left off, so you won’t loose anything, happy happy happy git :-) .

Hope this saved your neck like it saved mine. Other tips welcome :-) !

Update: Mike lets me know that the commands were bad written because of html entities and stuff, fixed now.

How to know the return value of a command

Sunday, May 18th, 2008

Just do:

$ echo $?

and that’s it.

Slow X rendering with sis driver

Monday, April 14th, 2008

Everything slow when using X with the sis driver? Well, here it’s awfully slow, made me want to trash my old pc… but then I discovered this bug in Launchpad : lp #26637.

Turns out that vesafb and vga16fb modules are responsible for this chaos. They seem to be stealing the memory managemen and hence making sis driver impossible to use due to it’s lack of descent performance.

What’s the fix? Blacklist vesafb and vga16fb and add sisfb to /etc/modules. You can try to add video=sisfb in the boot line of the kernel (grub’s menu.lst) too.

Note that Fedora doesn’t have sisfb built and is forcing vesafb into the kernel for it’s graphical boot. Ubuntu is doing the same, but they also build sisfb as a module.

So if you are using Fedora, you are screwed unless you rebuild your kernel, if you are using Ubuntu or Debian, make sure vesafb is not loaded (nor vga16fb) and have sisfb loaded sometime before X starts.

How can you be sure it worked? Grep /var/log/Xorg.0.log for ‘memcpy’ and see if the MB/s rate is descent, you can try with and then without the sisfb module to check if it’s making a difference. Here it does.