[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Reference counting for packages (finding unused packages)

On Tue, Dec 07, 1999 at 11:47:29PM +0100, Goswin Brederlow was heard to say:
> I would like to know what packages I don´t need anymore when removing
> a package. At the moment one can only look at the dependencies
> manually and try to deinstall them if one doesn´t know what to do with 
> them.
> This mechanism could be automated by a simple reference counting.

  Actually (and this is off the top of my head ;-) ) you might not even need
that; apt provides reverse dependency lists, so you can do something like
(pretending Python has apt bindings for a moment):

for dep in pkg.Depends:
  for chk in dep.ReverseDepends:
    if chk.State==apt.PkgInstalled:
  if remove and prompt_for_remove("All packages depending on this package are removed, delete it?"):

  This also gets into trouble with loops, but can actually be added to clients
without any changes to libapt. (/me mentally adds it to the TODO list)

  A way to remove the prompting would be nice, but very difficult (you can check
what was installed solely to fulfill dependencies -- assuming some changes in
libapt -- but you can't tell whether locally-compiled stuff depends on it..)


Reply to: