On Fri, Sep 29, 2006 at 03:22:39PM +0300, Sideris Michael wrote: > On Thu, Sep 28, 2006 at 06:37:18PM +0200, Marc Espie wrote: > > > And of course there are common situations that neither approach handles > > > very well. If I install openldap-server it will install openldap-client > > > as a dependancy. If I later uninstall openldap-server I may need to keep > > > openldap-client. Or not. So deleting package dependancies should not be > > > fully automated. > > > > Good, you're on the right direction. > > > > > Perhaps in addition to pkg_add tagging as above, there could be a way to > > > manually tag packages as explicity installed... > > > > Go on, think a bit more, and you'll have the full design I just *sketched* > > overhead... ;-) > > I don't get how tagging will help keeping your package list as small as > possible. Let me give an example: > > We have 2 packages, Y and Z that were explicitly installed and are > tagged accordingly. Y has A, B and C as dependencies. Z has C, D and E > as dependencies. The dependencies of course are not tagged, right? Or if > they do get marked they get a dependency tag(redundant). Now, as far as > I understood you want to achieve the following. If you want to uninstall > Y you want to keep any dependencies that were explicitly installed. But, > what about A, B and C? They are not tagged as explicitly installed. Which > means that either you won't delete any of them, or delete all of them and > break the installation of Z since C is going to be missing. Please give > me an example of your tagging methodology/plan so we can get an overview > of the functionality you have in mind. > > Thinking of it a bit more, here is a potential solution. You install C > which is a dependency of Y. C is marked as "explicitly installed". Later > on, you install Y and it is also marked as explicitly installed. A and B > are installed as dependencies. Now, you decide to remove Y with > pkg_delete(1). It should get the list of dependencies, A, B and C, > remove the ones that are marked as explicitly installed, thus removing C > from the dependency list, and then uninstalling the ones that are not > needed from any other package currently installed on the system, that is > A and B. How about that? > > -- > Sideris Michael > http://black.daemons.gr/msid/
Just remove everything you don't need that was not tagged as explicitly installed, wanted by the user. You do pkg_add pkg1 pkg2 pkg3 -> means you want to have pkg1, pkg2, pkg3, they're tagged as manual installation. Other packages (say pkg4, pkg5, pkg6) have been installed manually. (there's a -a switch to pkg_add already, to be able to install stuff from scripts, where the user doesn't say they want that package. You do some changes to the installation (updates, removal...) and suddenly pkg5, pkg6 are no longer needed by anything: the system can remove them. It will probably remove them later: if you do pkg_delete without any package name, the system will remove any stuff that's not tagged as installed by the user, and that's not needed by any package that was explicitly installed by the user. In fact, the only thing I really need to do is flatten the way pkg_add handles already installed packages, because you need to be able to say pkg_add pkg5 to tell it you want to mark pkg5 as installed manually, even if it was just a dependency of something. Computing the list of unwanted packages is trivial: it's just a graph closure. Maintaining the info manual install/not manual install is a bit more fun, especially as it means cleaning up some ad-hoc parts of the package code.
