Pavol Rusnak #cypherpunk #hacker #openhw #privacy #bitcoin #newmediaart

Popcorn - Popularity Contest (for RPM)


A few days ago I came across Feature #305877. What is it about? Well, Debian has the Popularity Contest, which tracks installed packages, how often they are used and sends an anonymized report once a week to their server. This maps the usage of Debian packages and as a nice side effect Debian guys can estimate the size of their user base on various platforms and releases. This also gives information about the community structure (e.g. how many users use development tools or graphic applications). This would be a very neat thing to have in openSUSE too!

At first, the task seemed pretty straightforward - just to replace dpkg calls with corresponding calls to rpm. There was one catch, though. Because of the transactions, which RPM uses, scanning on my openSUSE 11.1 machine took 2 minutes instead of 2 seconds on Debian! That’s because RPM creates one transaction for each package and constant locking and unlocking of rpmdb makes this process really slow. I rewrote the script to python, just to see how long will it take using only one long transaction and was very pleasantly surprised that it got back to 2 seconds. :) Moreover, rpmdb can tell you the exact time when the package was installed, so there was no need to check for ctime for files inside the packages like Debian does. (We still have to check for files atime to determine whether the package is used or not, though).

For the server part I was pretty sure about writing it in C to have it very fast and responsive, because I want to process incoming requests on the fly. The problem was with the storage. At the beginning I thought about using SQLite, but after some testing I decided to use much lighter disk-based hashtables TDB from the Samba team, because they perfectly fitted my humble needs.

Has this caught your interest? You can dig through the code at gitorious and any help is deeply welcome!. Yes, and why popcorn? Because the original is called popcon, but everybody at work just kept calling it popcorn during the discussions. Later I found another reason: popcorn is intended for RPM packages, so we definitively need an extra R in the name. :D

Xfce 4.6.0 released (and ready for testing!)


The Xfce development team announced today the release of the long-awaited 4.6.0 version of their Xfce Desktop Environment. There is also a very nice Visual Tour prepared by Jérôme Guelfucci and Jannis Pohlmann, which highlights some of the new and exciting Xfce features. For me, the most vivid change is the complete rewrite of the Settings Manager together with its configuration backend, but I’m sure that everybody will find his/hers own favorite :-).

It took me longer to prepare the updated packages than I expected, because of the busy BuildService, but they are finally ready in our X11:xfce BuildService project and I would like to encourage you to try them. If you encounter any problems, either upgrade issues from distribution 4.4.x series, issues with clean installation from repository or any other defects, please do not hesitate and contact me. Thank you very much and I’m looking for your comments and responses!

Instructions (command-line):

  1. add X11:xfce repository if it is not already added: zypper addrepo xfce (replace 11.1 with your openSUSE version)
  2. refresh this repository: zypper refresh xfce
  3. get new packages
    • if you have Xfce 4.4.x installed - upgrade the packages from xfce repo: zypper dist-upgrade --repo xfce
    • or install the Xfce packages directly: zypper install Terminal mousepad orage ristretto thunar thunar-volman xfce4-appfinder xfce4-desktop xfce4-mixer xfce4-notifyd xfce4-settings xfce4-taskmanager xfce4-volstatus xfconf xfwm4

Instructions (one-click install):

just click on the link with your distribution:

Parallel command execution with limits

Randy_sk asked today on IRC if we had any idea how to run commands in parallel, but he also wanted to limit the number of the concurrent processes. I immediately responded: “use make”. I started to shape my idea further until I came to this Makefile:

tasks := $(shell seq -s ' ' 1 `cat commands.txt | wc -l`)

all: $(tasks)
    @echo Done

    @echo `sed '$@!d' commands.txt`
    @eval `sed '$@!d' commands.txt`

This expects you had the file commands.txt prepared, which contains one command per line. If you want to call the same command over and over again, just replace commands.txt with values.txt and eval with the command you want to run.

Using this approach you can limit both the number of concurrent jobs: make -j 5 and the maximum load: make -l 2

Others ideas were to use the shell with & and wait, or to use the following one-liner:

while sleep 1; do [ "`ps ax | grep your_cmd | wc -l`" -gt 6 ] || your_cmd & ; done

but I really like mine solution the most :D

Change in command-not-found handler default behaviour

Due to some requests on mailing lists and Feature #305803 I decided to change the default behavior of command-not-found handler (in openSUSE 11.2 and SLE11).

Now it prints this info immediately:

$ blender
If 'blender' is not a typo you can use command-not-found to lookup the package
that contains it, like this:
    command-not-found blender
bash: blender: command not found

$ ifconfig
Absolute path to 'ifconfig' is '/sbin/ifconfig', so running it may require
superuser privileges (eg. root).
bash: ifconfig: command not found

instead of directly performing the search.

If you want the old behaviour back (i.e. search invoked automatically), just add export COMMAND_NOT_FOUND_AUTO=1 to your bash profile. (This is also documented in command-not-found man page).

You can install the updated packages from home:prusnak:scout BuildService repository as usual.