Eric Cooper wrote:
> Here's an alternative way to do it, by scanning the .deb files and
> seeing if they're already installed or not. (It's in bash, but should
> be easy to convert to Python etc.):
>
> #!/bin/bash
>
> for deb in /var/cache/apt/archives/*.deb; do
> pkg=$(dpkg-deb -f $deb Package)
> if ! dpkg-query -Wf '${Status}' $pkg | grep -q ' installed'; then
> echo $pkg: not installed
> # uncomment this to remove it ...
> # rm $deb
> fi
> doneExcept that it is incredibly slow (running dpkg-query 1405-times in my case). The attached version does the same, but is IMHO much better (and yes, I prefer Python to complicated bash :-)). Best, Matej -- Matej Cepl, http://www.ceplovi.cz/matej/blog/ GPG Finger: 89EF 4BC6 288A BF43 1BAB 25C3 E09F EF25 D964 84AC They never open their mouths without subtracting from the sum of human knowledge. -- Thomas Brackett Reed
midclean.py
Description: application/python

