Chris Lamb

Careful what you wish for...

Via #241343:

* Package name    : apt-gentoo
  Version         : 0.0.1
* URL             :
* License         : GPL version 2 or above
  Description     : enhanced package installation

 apt-gentoo enhances the Debian package installation experience to make
 it fully competitive with newly-popular source-based distributions.

 As packages are installed, apt-gentoo automatically downloads their
 build logs from the buildd network. The logs are then slowly scrolled
 past on the user's terminal to simulate building the software on the
 local machine.


So, something like:

#!/usr/bin/env python
# Insert into /etc/apt/conf.d/50apt-gentoo:
# DPkg {
#         Pre-Install-Pkgs { "/path/to/apt-gentoo || true"; };
# };

import time
import random
import urllib
import urllib2
import urlparse
import fileinput

from lxml import etree
from debian import debfile

for filename in fileinput.input():
    pkg_data = debfile.DebFile(filename.strip()).debcontrol()

    url = "" % urllib.urlencode({
        'pkg': pkg_data['Package'],
        'ver': pkg_data['Version'],
        'arch': pkg_data['Architecture'],

    html = etree.parse(urllib2.urlopen(url), etree.HTMLParser())
    link = html.xpath("//table[@class='data logs']//td[3]/a")

        fetch_url = urlparse.urljoin(
    except IndexError:

    html = etree.parse(urllib2.urlopen(fetch_url), etree.HTMLParser())

        log = html.xpath('//pre')[0].text.split('\n')
    except IndexError:

    for line in log:
        print line
        time.sleep(random.random() * 0.09)

Package/source and example installation transcript.

Chris Lamb is a freelance software developer and the current Debian Project Leader. You can read other posts by me, see software I have written or read more about me. You can also follow me @lolamby.

Tags: GNU/Linux Hacks

Planets: ALUG UWCS WUGLUG Debian

Friday 12th August 2011

Seven comments

Comments are closed.