Comment 12 for bug 830492

Revision history for this message
James Haigh (james.r.haigh) wrote :

Hey Michael, sorry I've not been participating recently.

I've had a good look at Aptdaemon and touched on the Python APT bindings.

This is what I envision:

A transaction's download and install parts are separated.

== Install ==

The install part should be like apt-get's '--no-download' option, so '_apply_changes' should never download files. No lock should be waiting for a download; this is wasting time. Only installs/removes/upgrades/triggers/etc should be holding a lock; the things that actually need it.

When taking the next transaction in the queue in the function '_on_transaction_done', instead of:
            next_trans = self._queue.popleft()
next_trans should be the next transaction /that has nothing to download/.

== Download ==

apt-get's '--print-uris' option outputs lines like this:

'http://gb.archive.ubuntu.com/ubuntu/pool/universe/g/gnash/gnash_0.8.9-1ubuntu1_i386.deb' gnash_0.8.9-1ubuntu1_i386.deb 197240 MD5Sum:32996ac2d709e1c6e0b65a90272202bb

Of course all of this information can be represented in the form of a magnet URI, something like this:

magnet:?as=http%3A//gb.archive.ubuntu.com/ubuntu/pool/universe/g/gnash/gnash_0.8.9-1ubuntu1_i386.deb&dn=gnash_0.8.9-1ubuntu1_i386.deb&xl=197240&xt=urn:md5:32996ac2d709e1c6e0b65a90272202bb

If the apt repo could also supply the BTIH, then the whole thing becomes very easy. A 'xt=urn:btih:' parameter can be added to the magnet which will be sent via RPC to Aria2 in daemon mode or deluge's server part.

This approach could also allow load balancing of mirrors by specifying multiple Acceptable Source ('as') params to the magnet, and would make it trivial to obtain packages from other machines on the LAN making downloads upto 2 orders of magnitude faster out-of-the-box.

I prefer the idea of having only one download utility on a machine (or even a LAN), this way downloads can be reordered or paused by any RPC client.

When each file completes it is placed in /var/cache/apt/archives/ as usual, and of course when all files for a transaction complete, that transaction can be applied.

So how is this sounding? Personally, I can't wait to get this working.