On Tue, Aug 04, 2009 at 12:47:49PM -0400, Luis Useche wrote:
> On Tue, Aug 4, 2009 at 12:14 PM, Darrin
> Chandler<dwchand...@stilyagin.com> wrote:
> > On Tue, Aug 04, 2009 at 11:30:44AM -0400, Luis Useche wrote:
> >> On Tue, Aug 4, 2009 at 11:20 AM, Bret S. Lambert<bret.lamb...@gmail.com> 
> >> wrote:
> >> > pkg_delete `pkg_info -t` will almost do what you're looking for ;)
> >>
> >> The problem with this command is that it will remove packages
> >> installed for the end user. In my case, for instance, "pkg_info -t"
> >> list zsh, vim, subversion and other.
> >
> > Brett gave you the pieces and this is UNIX, so it's just a tiny bit more
> > work...
> >
> > # pkg_info -t | cut -d' ' -f1 > pkgs.before
> > # pkg_delete <whatever>
> > # pkg_info -t | cut -d' ' -f1 > pkgs.after
> > # pkg_delete $(comm -13 pkgs.before pkgs.after)
> >
> 
> I guess your idea with this script is to find the differences between
> the lists of packages with no dependents before and after deleting the
> package <whatever>.
> 
> This is really close but it is not there quite yet. Even with this
> script, there could be situations where you end up deleting things you
> don't want. For instance, let say you install xfce. After some time,
> you decided to install some package X that depend on xfce and other
> library L used only by X. When using your script, it will remove not
> only L but also xfce (which you did not want to remove because you
> installed it manually).

True

> Besides, there is another problem with the script. If you imagine the
> packages installed in the system as a tree of dependencies, you can
> see that your script will only remove two levels of the branch you
> want to delete. Example: X depends on Y that depends on Z: X -> Y ->
> Z. In your script, X and Y will be removed but Z will not.

True

I was not thinking to solve the general case, but more to help with an
immeditate need.

> It seems like an additional information should be added to the package
> database. A bit indicating if the package was installed manually by
> the user (admin?) or not. Then, the package can only be deleted if the
> the user explicitly say so as oppose to "automatic deletion as
> dependency".

This has been brought up many times before and a lot of people would
like to see it (me too). I know some work has been done and some info is
now kept, but this functionality isn't there yet.

-- 
Darrin Chandler            |  Phoenix BSD User Group  |  MetaBUG
dwchand...@stilyagin.com   |  http://phxbug.org/      |  http://metabug.org/
http://www.stilyagin.com/  |  Daemons in the Desert   |  Global BUG Federation

Reply via email to