November, 2008


27
Nov 08

Meet Bill

It has been in the oven for some time, but now it is ready for release… Bill version 0.1 has just hit the lines!

In short, Bill is a solution for creating high-quality Bash code using reusable components. As GNU Bash is its only dependency, it can be run nearly everywhere—even on resource-limited systems!

Origins and motivation

Sometimes one wants to spit out some code to glue together a set of already available tools and quickly solve a problem by combining their strengths. That is okay, and using a shell script is probably the best solution, until annoyances arise:

  1. Portions of boilerplate code is repeated one script after another. Bill addresses this problem by providing a way of creating and reusing modules, and by providing a set of standard ones. It comes with batteries included.
  2. The script will eventually grow; and it will become a nightmare to debug and maintain. Bill includes tools for testing and documenting the code.
  3. Some ideas are complicated to achieve in shell code, and usually implementing them can be tricky. Bill already does the tricks for you, so you can focus on the actual code.

Thus, Bill was born with three main goals in mind: having as little dependencies as possible, easing development of complex applications, and serving as a playground for advanced usage of Bash. While I was making progress with the code, we had the ideas of running simple web applications coded in shell scripts and having unit tests and added them on the go.

Trying it out

If you use a dpkg-based distribution (Ubuntu, Debian), just grab the .deb package and install it by running dpkg -i bill_0.1-1_all.deb. Otherwise you can download the source tarball and unpack it with tar -xfj bill-0.1.tar.bz2. You can run Bill without installing by adding the bill-0.1/scripts/ directory to your PATH environment variable.

Once you have your copy you are ready to read the tutorial. I will give you only an appetizer here:

$ bill
(bill) echo "Hello, Bill!"
Hello, Bill!
(bill)

This is all for today, but expect more news related to Bill in the future. For the intrepid in you, you can check out the code repository at Gitorious, the code is under the GPL v2 license. I hope you enjoy this initial release as much as I did while preparing it.

Have a lot of fun…


20
Nov 08

Convert repositories with fast-{export,import}

Those days I faced the need of moving a set of Bazaar branches into a set of Git repository, and althought I already knew about Tailor, but I wanted a one-shot conversion and Tailor is more, ahem, tailored for periodic synchronization. So I decided to try git fast-import, because I already knew about bzr fast-import plugin which is inspired by the Git version of the thing. The Bazaar plugin includes a bzr-fast-export script which can be used to feed input data to git fast-import.

First, we need to install the Bazaar plugin. This one is easy:

mkdir -p ~/.bazaar/plugins
cd ~/.bazaar/plugins
bzr get lp:bzr-fastimport fastimport

I will be importing three branches into a Git repository, so we need to create a Git repository:

mkdir ~/myproject.git
cd ~/myproject.git
git --bare init

I suppose you have three related Bazaar branches:

  • ~/myproject is the main branch of the project. It will be imported as master branch in Git.
  • ~/myproject.branch-a and ~/myproject.branch-b are two branched whose parent is the first one.
alias bzrexp="~/.bazaar/plugins/fastimport/exporters/bzr-fast-export"
bzrexp --export-marks=../marks.bzr ../myproject \
   | git fast-import --export-marks=../marks.git
bzrexp --marks=../marks.bzr --git-branch=branch-a \
   ../myproject.branch-a | git-fast-import \
   --import-marks=../marks.git --export-marks=../marks.git
bzrexp --marks=../marks.bzr --git-branch=branch-b \
   ../myproject.branch-b | git-fast-import \
  --import-marks=../marks.git --export-marks=../marks.git

Voilà! It will run in a snap, the limit will be your disk speed, as both the exporter and the importer are very fast.


18
Nov 08

Popcorn Hour!

Today I have found the de-fi-ni-ti-ve batgadget to attach to a television. It does even include a BitTorrent client and матрёшка support!


5
Nov 08

Using Bleeding-edge Sup on Ubuntu

This is a quick recipe which will tell you how to run the development version of the Sup e-mail client on Ubuntu 8.10; the method will probably work on any recent Ubuntu or Debian distribution.

First, download the latest Sup code from their Git repository:

cd ~
git clone git://gitorious.org/sup/mainline.git sup

Then, install dependencies needed for Sup to run, as root:

apt-get install rubygems ruby-dev \
   lib{ferret,highline,openssl,net-ssh,ncurses,gettext}-ruby1.8
gem install hoe rmail mime-types fastthread \
   trollop lockfile chronic

Now you can run Sup with your regular user account from the Git branch you downloaded. Do not add sources with sup-config as it will fail when trying to find the sup-add command, it is better to run sup-add manually like in the following example:

cd ~/sup
ruby -I lib -w bin/sup-config
ruby -I lib -w bin/sup-add --labels=inbox imaps://igalia.com/
ruby -I lib -w bin/sup

Of course, make sure you use your own mail server, and run sup-add --help to take a look at the possible options. If you have already configured Sup before, or if your prefer to, you can skip running sup-config and/or sup-add.

That’s all for now, folks. I will tell you in the following weeks how well I manage using Sup. It can be an interesting reading, as I am trying to move away from Evolution. As a last reminder, do not forget to take a look at the Sup new user guide :-)

Update: You will need to install build-essential and libncurses5-dev if you do not have them installed prior to installing Ruby gems.