Monday, February 23, 2009

BleachBit 0.4.0 released

Version 0.4.0 is a major release of BleachBit, the file and privacy cleaner for Linux. BleachBit aims to be an easy, advanced, and smart way to clean junk including cache, cookies, Internet history, localizations, logs, and temporary files.

Changes

The following changes are included since 0.3.2:

  • Introduce CleanerML (Cleaner Markup Language), an XML-based system for easily creating ne cleaners.
  • Introduce cleaners for aMSN, CrossOver Chromium (Google Chrome), ELinks, emesene, GL-117, Hippo OpenSim Viewer, Midnight Commander, Recoll, Rhythmbox, Tremulous, Vuze (formerly Azureus), and WINE. Several of these were suggested and researched by juancarlospaco.
  • Enhance Second Life Viewer cleaner to also clean logs.
  • Clarify that favicons will be deleted when deleting Firefox places (bug #328278).
  • Introduce a simple README file.
  • Sort the cleaner tree by the case-insensitive display name instead of an internal code name. For English speakers, this puts non-capitalized cleaners like aMSN in the right place, and for non-English speakers it fixes sorting of non-English cleaner names such as System and Thumbnails.
  • Fix packaging for SLES 9 and SLE 10: they incorrectly required a package not available on those systems.
  • Update translations: Bulgarian (thanks to Svetoslav Stefanov), French (Edouard Marquez), and Spanish (juancarlospaco).
  • Introduce Russian translation thanks to Vadim Peretokin.
  • Introduce installation package for the new Debian Lenny (Debian 5).
BleachBit cleaner 0.4.0 in Russian on Fedora 10 Linux

Download

Download BleachBit now. Installation packages are ready for 19 Linux distributions-versions including CentOS, Debian, Fedora, Mandriva, openSUSE, Red Hat, and Ubuntu.

Thursday, February 19, 2009

Cleaner Markup Language

I introduce to you Cleaner Markup Language (also called CleanerML), BleachBit's new cleaner definition system based on XML. Originally all cleaners were written in Python code. For a new project, that was fine, but BleachBit has grown and matured. Most cleaners can be defined by labels, descriptions, and three types of actions, so they are best written as documents instead of as code. The new system allows easier contributions, uses better code design, and provides a platform for future enhancements.

A newer version of this information is available at BleachBit Documentation: CleanerML

Writing your own cleaner

To write your own cleaner, start by reviewing the existing CleanerML files, the example, and the XML Schema. They are all included in the source package starting with BleachBit 0.4.0 (coming soon). Until the release, you can check out the SVN trunk.

The markup language is simple and should be intuitive. Here's a graphic representation of the Bash history cleaner:

Graphic illustration of the BleachBit Cleaner Markup Language document for the Bash history cleaner

To validate your cleaner, copy it to the cleaners directory in the source tree, and then run:

make pretty
make tests

Using your own cleaners

Simply name the cleaner with the extension .xml and place it in ~/.config/bleachbit/cleaners or /usr/share/cleaners. If you are running BleachBit from the source tree, you can also use the relative path ./cleaners/.

Submitting a cleaner

Want to share your cleaner with others? Follow this checklist:

  • It cleans a significant amount of disk space or removes files that potentially contain private information
  • It follows the guidelines in the example_cleaner.xml
  • It passes XML Schema validation

Good? Then, submit it like a code contribution.

Underestimated effort

The whole CleanerML system may have taken more work than you think. Beyond the basics of simply parsing CleanerML, many other pieces were necessary:

  • Defining CleanerML
  • Writing an XML Schema to validate CleanerML
  • Writing a generic system for performing actions (different ways of deleting files)
  • Writing a system to extract text from CleanerML for translation
  • Extending the translation extraction to suppress strings of proper nouns that should not be translated such as Bash and GIMP
  • Conceived and implementing a security system to prevent tampering
  • Adding makefile targets to reformat and to validate CleanerML
  • Creating an example CleanerML with annotations
  • Converting many of the existing cleaners to the new system
  • Writing guidelines for cleaner labels and descriptions
  • Updating descriptions to meet new guidelines
  • Updating translations for those descriptions
  • Writing this article :)

All this work has delayed the weekly release cycle.

Looking forward

Now that cleaners are documents, one of the next steps is creating a simple graphical interface for users to create their own cleaners.

With all the new cleaners, the BleachBit user interface feels cluttered. The likely next step is extending CleanerML to define categories and extending the UI to filter by those categories.

Sunday, February 15, 2009

BleachBit on Windows

Who says Linux should get all the open source apps? Successful cross-platform applications such as Firefox and OpenOffice.org reduce the barrier to switch from Windows to Linux, so what would it take to get BleachBit running on Windows?

BleachBit requires Python, PyGTK, and GTK. Though I never worked with GTK, I strategically these dependencies because they are cross platform and standard on most Linux distributions. However, installing this software stack on Windows is non-trivial. For example, GRAMPS requires the same stack, and the installation instructions require six installation packages totaling about 30MB—far too big and complex. Compare that to Linux where BleachBit is one package under 100KB because the dependencies are already there. Gourmet Recipe Manager seems to have fit all of PyGTK and friends in one Windows package of about 12MB: that could be tolerable but is still large.

Another option is writing the front end in native Windows code to eliminate the GTK+ dependency and help Windows users feel at home. (Firefox and OpenOffice.org use native widgets for the same reason.) Though maintaining two GUIs is not generally desirable, only 20% of the code is the PyGTK GUI, which is also modular, so this is feasible. Transmission (the BitTorrent client) maintains native GUIs for Linux, Windows, and Mac, but they probably have more developers. Using Python to access the BleachBit backend and to write the new Windows frontend could be accomplished with IronPython. On a whim, I tried to run a BleachBit unit test, which I was surprised to find passed on Windows 7 beta:

The startup was painfully slow and it looks like the unit test should have actually failed, but it was a pleasant surprise to see it get that far. It seems IronPython can even create .EXE's (with some dependencies).

Another option is wxPython: writing code once in Python creates native GUIs for Linux, Mac, Windows, and other systems. I have experience with wxWidgets (which wxPython uses), but there are still two problems. First, wxPython is not standard on Linux, and the dependencies for Linux and Windows are large (3-10MB). This is better for Windows than GTK, but it's a little worse for Linux.

Originally I considered many options including Python with GTK, C++ with wxWidgets, and C#.NET. There are simply no perfect choices for a high-level, cross-platform language with native GUI that is already installed standard on Linux and Windows. C#.NET is the closest choice, but again there are pros and cons. It's relatively standard on Windows and Linux (coming standard on Fedora, Ubuntu, and others), but some Linux users are allergic to it because of the connection with Novell and Microsoft. Worse of all, the GTK GUI is not standard on Windows, and on Linux it GTK is practically a necessity because Mono WinForms is so ugly.

In conclusion, BleachBit is not coming to Microsoft Windows soon. BleachBit will continue to focus on Linux, and the biggest short-term platform change will be supporting the new Debian 5, released just yesterday.

Future article: BleachBit on Windows Vista (May 2009).

Wednesday, February 11, 2009

BleachBit 0.3.2 released

Version 0.3.2 is a minor release of BleachBit, the file and privacy cleaner for Linux. BleachBit aims to be an easy, advanced, and smart way to clean junk including broken menu entries, cache, cookies, Internet history, localizations, logs, and temporary files.

Changes

The following changes are included since 0.3.1

.
  • Clean apt cache by running apt autoclean (for Ubuntu and Debian).
  • Clean yum cache by running yum clean all (for CentOS, Fedora, and Red Hat).
  • Delete rotated system logs in /var/logs/.
  • Delete Skype's chat logs.
  • Clean Transmission BitTorrent client (by juancarlospaco).
  • Clean Exaile music player (based on patch by juancarlospaco).
  • Clean more localizations
  • Fixed bug: temporary files were cleaned when trash was selected.
  • Fixed bug: if BleachBit were started for the first time running in sudo mode, it created configuration files the regular user could not read, preventing BleachBit startup. If you are affected, then run this command in a terminal:
    sudo chown -R `whoami` ~/.config/bleachbit/
  • Delete folders in trash (instead of leaving empty folders).
  • Fix unusual situation where a selected language could disappear from the preferences.
  • Fix language auto-detection that could cause BleachBit to fail to start.
  • Shrink preferences dialog for small screens like Asus Eee PC.
  • Add first French translation from Edouard Marquez.
  • Add first Arabic translation from MaXeR.
  • Add first Turkish translation from alperyilmaz.
BleachBit in Arabic (الْعَرَبيّة) showing the Firefox Internet history cleaner BleachBit translated in French (français)

Download

Download BleachBit now. Installation packages are ready for 18 Linux distributions-versions including CentOS, Debian, Fedora, Mandriva, openSUSE, Red Hat, and Ubuntu.

Wednesday, February 4, 2009

BleachBit 0.3.1 released

Version 0.3.1 is a minor release of BleachBit, the file and privacy cleaner for Linux. BleachBit aims to be an easy, advanced, and smart way to clean junk including broken menu entries, cache, cookies, Internet history, localizations, and temporary files.

Changes

  • Clean the cache and temporary files of Acrobat Reader, GIMP, Google Earth, Second Life Viewer, and winetricks (part of patch from JuanCarlosPaco).
  • Clean Firefox version 3's URL history without deleting the entire places.sqlite file (which also contains bookmarks).
  • Clean more localizations.
  • Vacuum the Firefox databases (which becomes fragmented): remove unused space and improve performance without deleting data.
  • Complete and correct the Spanish translation (JuanCarlosPaco).
  • Fixed bug that blocked cleaning of some localizations on Ubuntu 8.04 when the ubuntu-docs package was installed. (Ubuntu 8.10 was not affected.)
  • Fixed bug that prevented starting BleachBit when the language was not set (typically through the LANG environment variable).
  • Fixed bug that prevented cleaning of the clipboard.
  • Make it easier to run BleachBit with translation without installation.

Web changes

Download

Download BleachBit now. Installation packages are ready for 18 Linux distributions-versions including CentOS, Debian, Fedora, Mandriva, openSUSE, Red Hat, and Ubuntu.

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!