Bazaar

From DreamHost
Revision as of 19:19, 15 June 2010 by Domador (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

Bazaar is a distributed version control system available under the GPL that reduces barriers to participation in your project. See the official website for more details. The five minute mini-tutorial is good way to get started for people with previous version control experience.

Script

The following Bash script automates the installation of Bazaar on Dreamhost servers. You will still need to perform the steps under Preparing your environment below before using this script.

#!/bin/bash

## Prep
mkdir $HOME/source
cd $HOME/source
mkdir bzrbuild
cd bzrbuild

## PyCrypto
echo 'Installing PyCrypto...'
wget http://www.amk.ca/files/python/crypto/pycrypto-2.0.1.tar.gz
tar -xzvf pycrypto-2.0.1.tar.gz
cd pycrypto-2.0.1
python2.4 setup.py install --home=$HOME
cd ..
echo
rm -v pycrypto-2.0.1.tar.gz
echo

## Paramiko
echo 'Installing Paramiko...'
wget http://www.lag.net/paramiko/download/paramiko-1.7.3.tar.gz
tar -xzvf paramiko-1.7.3.tar.gz
cd paramiko-1.7.3
python2.4 setup.py install --home=$HOME
cd ..
echo
rm -v paramiko-1.7.3.tar.gz
echo

## ElementTree
echo 'Installing ElementTree...'
wget http://effbot.org/media/downloads/elementtree-1.2.6-20050316.tar.gz
tar -xzvf elementtree-1.2.6-20050316.tar.gz
cd elementtree-1.2.6-20050316
python2.4 setup.py install --home=$HOME
cd ..
echo
rm -v elementtree-1.2.6-20050316.tar.gz
echo

## cElementTree
echo 'Installing cElementTree...'
wget http://effbot.org/media/downloads/cElementTree-1.0.5-20051216.tar.gz
tar -xzvf cElementTree-1.0.5-20051216.tar.gz
cd cElementTree-1.0.5-20051216
python2.4 setup.py install --home=$HOME
cd ..
echo
rm -v cElementTree-1.0.5-20051216.tar.gz
echo

## Verify everything is installed correctly
echo 'Testing to ensure Bazaar can be installed...'
crypto="python2.4 -c \"import Crypto\""
paramiko="python2.4 -c \"import paramiko\""
celementtree="python2.4 -c \"import cElementTree\""

if [[ $crypto != "" && $paramiko != "" && celementtree != "" ]]
then
  echo 'All Prerequisites are met'
  echo

  ## Bazaar
  echo 'Installing Bazaar...'
  wget http://launchpadlibrarian.net/49219076/bzr-2.1.2.tar.gz
  tar -xzvf bzr-2.1.2.tar.gz
  cd bzr-2.1.2
  python2.4 setup.py install --home=$HOME
  cd ..
  echo
  rm -v bzr-2.1.2.tar.gz

  echo 'Success!'
  exit 0
else
  echo "Something went wrong.  Examine the previous output and fix the problem."
  echo

  echo 'Failure!'
  exit 1
fi

Prerequisites

Bazaar requires Python 2.4 (or higher) and the following modules: pycrypto, paramiko, ElementTree, and cElementTree.

Preparing your environment

Since you'll be install software locally in your home directory, you need to tell your shell where to find things. Edit your .bash_profile and add the following. If PYTHONPATH or MANPATH don't exist, add them with the same format as PATH.

  • Add $HOME/bin to your PATH
  • Add $HOME/lib/python to your PYTHONPATH
  • Add $HOME/man to your MANPATH

Reload .bash_profile

$ source .bash_profile

Installing pycrypto

Download the latest version of pycrypto from http://www.amk.ca/python/code/crypto

$ wget http://www.amk.ca/files/python/crypto/pycrypto-2.0.1.tar.gz

Extract pycrypto source code

$ tar zxvf pycrypto-2.0.1.tar.gz

Build and install pycrypto in your home directory

$ cd pycrypto-2.0.1
$ python2.4 setup.py install --home=$HOME
$ cd ..

Installing paramiko

Download the latest version of paramiko from http://www.lag.net/paramiko/

$ wget http://www.lag.net/paramiko/download/paramiko-1.7.6.tar.gz

Extract paramiko source code

$ tar zxvf paramiko-1.7.6.tar.gz

Build and install paramiko in your home directory

$ cd paramiko-1.7.6
$ python2.4 setup.py install --home=$HOME
$ cd ..

Installing ElementTree

Download the latest version of ElementTree from http://effbot.org/downloads/#elementtree

$ wget http://effbot.org/media/downloads/elementtree-1.2.6-20050316.tar.gz

Extract the ElementTree source code

$ tar zxvf elementtree-1.2.6-20050316.tar.gz

Build and install ElementTree in your home directory

$ cd elementtree-1.2.6-20050316
$ python2.4 setup.py install --home=$HOME
$ cd ..

Installing cElementTree

Download the latest version of cElementTree from http://effbot.org/downloads/#celementtree

$ wget http://effbot.org/media/downloads/cElementTree-1.0.5-20051216.tar.gz

Extract cElementTree source code

$ tar -xzvf cElementTree-1.0.5-20051216.tar.gz

Build and install cElementTree in your home directory

$ cd cElementTree-1.0.5-20051216
$ python2.4 setup.py install --home=$HOME
$ cd ..

Verifying Prerequisites

Verify that all the new python modules are installed correctly

$ python2.4 -c "import Crypto"
$ python2.4 -c "import paramiko"
$ python2.4 -c "import cElementTree"

If there are no error messages displayed then everything is installed correctly.

Setup

Download the latest version of Bazaar from https://launchpad.net/bzr/+download

$ wget http://launchpadlibrarian.net/49219076/bzr-2.1.2.tar.gz

Extract the Bazaar source code

$ tar zxvf bzr-2.1.2.tar.gz

Build and install Bazaar in your home directory

$ cd bzr-2.1.2
$ python2.4 setup.py install --home=$HOME
$ cd ..