You have to keep in that in most cases you have to acquire more than one lock. E.g. for commit, you should hold the archive and dpkg status lock. And they have to be raised in a special order to avoid races with e.g. apt-get. That is why I decided to always hold all three locks for an aptdaemon transaction (archive, status, lists) and implement an high level lock. See http://bazaar.launchpad.net/~aptdaemon-developers/aptdaemon/main/annotate/head:/aptdaemon/lock.py The idea with the context manager is very nice.
Attachment:
signature.asc
Description: Digital signature