Showing posts with label ubuntu. Show all posts
Showing posts with label ubuntu. Show all posts

Tuesday, June 30, 2009

Download statistics by operating system

Have you wondered which operating system is the most popular? Well, I mean among BleachBit users.

More than idle fancy, the information helps guide important development decisions such as packaging and as platform-specific cleaners. There are specific cleaners for Windows, Ubuntu, Fedora, and maybe others. Slackware required a special tweak to prevent deleting important files. Debian and Ubuntu require .deb packaging which is completely different than the .rpm packaging for CentOS, Fedora, Mandriva, and OpenSUSE, and Red Hat. Of course, Windows users need .exe files with PyGTK included. All these special needs require extra time, which is time taken away from other platforms.

When I started BleachBit seven months ago, I first packaged it for Fedora, which I myself use. Then, I used openSUSE Build Service to build packages for Debian, Mandriva, openSUSE, and Ubuntu. I was surprised by the disparity and quickly realized most downloads were for Ubuntu, many for Debian, and only a few for Mandriva.

The major change is BleachBit now runs on Windows. When Download Squad reviewed BleachBit, the Windows numbers gave Ubuntu some competition. For the last week since 0.5.2 was released, the chart below shows Ubuntu is back in the lead. (Note: SourceForge doesn't update its stats often. These were the same numbers as yesterday, so who knows how old they really are.)

BleachBit 0.5.2 download statistics for about one week

Mark Twain one wrote, "There are three kinds of lies: lies, damned lies, and statistics." Indeed, this chart doesn't tell the whole story. BleachBit is included in the Debian and Ubuntu repositories, so there are more Debian and Ubuntu downloads than shown. However, Ubuntu Janty Jackalope users still download BleachBit from BleachBit because the version 0.3.x in the repository is old. SlackBuilds for Slackware has an old version 0.4.1, but I don't provide a package for Slackware. I don't know which version openSUSE's repository has, but a few weeks ago I was pleasantly surprised to find it in openSUSE. Last time I checked, Fedora's repository had too many rules for me to try to submit a package, and no one has volunteered. Last of all, Windows of course doesn't have a central repository (try to keep up, Microsoft).

Another factor is BleachBit for Windows is new, relatively unknown, and advertised as a "preview." Depending who you ask, there are 10-100 Windows desktop users for each Linux desktop user. As BleachBit matures on Windows, Ubuntu will likely take second place.

Now I'm confused which platform is still the most popular, but I still think Ubuntu wins— for now.

Tuesday, February 3, 2009

Building in virtual Ubuntus

Developing Linux applications has a few pains. One pain is the the variety of Linux distributions: there are many popular distributions which release new versions frequently. That requires a lot of testing and packaging effort. Though I prefer Linux overall, Microsoft Windows is attractive because Windows desktop application development is focused on one "distribution" (Windows desktop series) which releases new versions infrequently (a joy for testing!), so today that means only two environments: XP and Vista. The second pain is each distribution has its own particular packaging requirements. For the last BleachBit release, I single-handedly produced 18 installation packages for seven Linux distributions. This volume could not be accomplished without special tools and automation.

To develop, test, and package BleachBit, I run nine virtual machines in Sun Microsystem's VirtualBox. Though a long-time Fedora user, I quickly realized most BleachBit users (roughly 90%) use Ubuntu, so now six of my VMs run Ubuntu 6.06 through 9.04. I also build many packages using Novell's openSUSE Build Service (OBS): it builds .rpm and .deb files for CentOS, Debian, Fedora, Mandriva, openSUSE, Red Hat, and Ubuntu. Regrettably the Ubuntu 8.10 build always fails on OBS—either because of a bug in OBS or maybe because of my own fault—so I build Ubuntu 8.10 locally.

Furthermore, I often restore the virtual machines to a pristine state (using VirtualBox snapshots) which destroys build environment, so I developed the following scripts which accelerate restoration of the build environment.

First, I install sshfs (which makes it easy to run the build scripts stored on my physical machine):

sudo apt-get install sshfs

Then, I mount my VM sharing directory (which contains build scripts and the BleachBit source code):

mkdir ~/tmp
sshfs andrew@10.0.2.2:/home/andrew/tmp ~/tmp

Then, I run a script from ~/tmp which installs the build software dependencies:

# necessary
apt-get install build-essential dh-make debhelper devscripts fakeroot

# nice to have
apt-get install mc vim-full

Finally, I run the following script which extracts the BleachBit source tarball, creates the build environment, sets up some compatibility between openSUSE Build Service and Ubuntu, and builds the package.

#!/bin/bash

# Handle fatal errors.
function fail {
 echo $1
 notify-send -u critical $1
 exit 1
}

# Check which version of Ubuntu is running.
RELEASE=`grep DISTRIB_RELEASE /etc/lsb-release | cut -b17-`
echo "Detected version distribution version $RELEASE"

mkdir ~/bleachbit
cd ~/bleachbit
# Extract the source code tarball.
tar xjvf ~/tmp/vm/bleachbit*.tar.bz2 || fail "tar failed"
cd ~/bleachbit/bleachbit-?.?.? || fail "'cd' failed"
# Create .deb packaging directory.
mkdir debian
cd debian
# Copy .deb packaging files.
cp ~/tmp/vm/debian/* .
# Create links because openSUSE Build Service and dpkg like different names.
ln -s debian.control control
ln -s debian.rules rules
ln -s debian.changelog changelog
cd ~/bleachbit/bleachbit-?.?.?
# Ubuntu 6.06 doesn't have Python central, so remove it.
if [[ "x$RELEASE" == "x6.06" ]];
then
 echo "Applying Ubuntu 6.06 changes"
 cd debian
 sed -i -e 's/, python-central//g' control
 sed -i -e 's/, python-central//g' bleachbit.dsc
 sed -i -e 's/dh_pycentral//g' rules
 cd ..
fi
# Build.
debuild
# Check build.
cd ~/bleachbit
[[ ! -e *deb ]] || fail "no .deb files"
# Lintian performs checks against a database of packaging rules.
lintian *deb

That save a lot of time, and I am glad to be developing for Linux!