January 15, 2007

How to install bzr on Dreamhost

hot_dog_stand_05.jpg

Bazaar or bzr is a Python-based source code management system that I've noticed is becoming increasingly popular amongst small open-source projects.

Right now I'm not sure what advantages bzr might have over other SCM systems such as Subversion (I suspect it's more light-weight), but it's handy to have when you want to grab the source for a project like Planet Venus.

Here's how I installed bzr on my Dreamhost shell account.

(note: There's not anything special here. This is all pretty standard Unix tarball installation fair. In fact, there's little here that isn't already in the bzr installation guide. I'm providing this as a confidence cushion for other Dreamhost users.)

Fetch it

Downloads of bzr are available here: http://bazaar-vcs.org/Download

Fetch the tarball install into a directory of your choice:

~$ cd ~/incoming
~/incoming$ wget http://bazaar-vcs.org/releases/src/bzr-0.13.tar.gz

Unzip it

~/incoming$ tar -zxvf bzr-0.13.tar.gz

Install it

~/incoming$ cd bzr-0.13
~/incoming/bzr-0.13$ python2.4 setup.py install --home ~

No problem...

Adjust environmental variables

... except one hiccup when we try to run bzr:

$ bzr
bzr: ERROR: Couldn't import bzrlib and dependencies.
Please check bzrlib is on your PYTHONPATH.

Traceback (most recent call last):
  File "/home/joshstaiger/bin/bzr", line 62, in ?
    import bzrlib
ImportError: No module named bzrlib

Because we installed bzr in our home directory, the Python code behind bzr is living in a nonstandard location that Python can't see. We add this location to our Python library path by setting the PYTHONPATH environmental variable in our .bashrc.

Modify .bashrc as follows:

echo "export PYTHONPATH=/home/joshstaiger/lib/python" >> ~/.bashrc

(replace "joshstaiger" with your shell login name)

We'll also want the bzr manual to be in our MANPATH if it isn't already, so we can read about bzr in our spare time instead of picking up women:

echo 'export MANPATH=$MANPATH:/home/joshstaiger/man' >> ~/.bashrc

Source .bashrc (or relogin) to pick up our changes:

. ~/.bashrc

Run it

And we're set:
~$ bzr
Bazaar -- a free distributed version-control tool
http://bazaar-vcs.org/

Basic commands:

  bzr init           makes this directory a versioned branch
  bzr branch         make a copy of another branch

  bzr add            make files or directories versioned
  bzr ignore         ignore a file or pattern
  bzr mv             move or rename a versioned file

  bzr status         summarize changes in working copy
  bzr diff           show detailed diffs

  bzr merge          pull in changes from another branch
  bzr commit         save some or all changes

  bzr log            show history of changes
  bzr check          validate storage

  bzr help init      more help on e.g. init command
  bzr help commands  list all commands
  bzr help topics    list all help topics

In Technology and Software

Posted by Josh Staiger at 10:54 PM

Comments

Thank you - the tutorial came in handy at the perfect time otherwise a n00b like me was utterly lost

Posted by: Awab Alvi January 25, 2007 03:44 PM | Permanent link