Re: Automatic removing of unneeded .deb files?
* Matej Cepl <firstname.lastname@example.org> [051123 21:09]:
> I have now used different method of finding differences, so this is not
> relevant anymore. And yes, that if was probably wrong.
It looks great. I noticed one problem, that version numbers with an
epoch get mangled when creating the file name for the deb, so all
epoch'ed debs get deleted, even if that version is currently installed.
I have attached a patch that I think fixes it. As I've barely touched
python, you should check my fix. I don't know if there are any
characters besides ":" that get mangled in deb names; that's the only
one that my patch handles. It seems to do the right thing for me.
Thanks again for the script!
--- midclean.py 2005-11-25 13:03:22.019908410 -0500
+++ midclean-new.py 2005-11-25 12:57:06.967315000 -0500
@@ -47,7 +47,7 @@
# get the list of .deb-files on our computer
-packagesStored = dict([["_".join(line.split("_",2)[:2]),line] \
+packagesStored = dict([["_".join(line.replace("%3a", ":").split("_",2)[:2]),line] \
for line in os.listdir(workDir) if line[-4:] == ".deb"])
# get a difference between what is and what should be installed