pkg_add does not backtrack, does it?

Mike Meyer mwm-keyword-freebsdhackers2.e313df at mired.org
Wed Feb 7 00:03:54 UTC 2007


In <8b4c81f0702061514r5a753e48yea0ce9b937236fc3 at mail.gmail.com>, Henry Lenzi <henry.lenzi at gmail.com> typed:
>  I haven't found the pkg_add code (it's in Ruby, is it?).

It's in /usr/src/usr.sbin/pkg_install/add. And no, it's not in ruby.

> But from the behaviour of pkg_add -r, it's safe to say that it
> doesn't backtrack to resolve dependencies, does it?

Why should using a remote repository change the behavior of pkg_add?

Are you sure you're not thinking of portupgrade? The -r otion to it
causes things to be recursive, and it is sourced in ruby. And it's in
the ports tree, not the base system (because it's sourced in ruby), so
you'll need to look for the source (or maybe a tarball) there.

>  Like, for instance (a real example), during gnome2 installation on 6.2:
> 
> warning: 'gstreamer-plugins-gconf-0.10.4_3,2' requires
> 'gstreamer-plugins-0.10.10,2', but 'gstreamer-plugins-0.10.9,1' is
> installed
> 
>  pkg_add goes right ahead. It does not com back to deinstalling
> 'gstreamer-plugins-0.10.9,1' and all its dependencies and _then_ goes
> back to that point.

This looks a little bit confused. "not com back to deinstalling"?
Since it wasn't deinstalling that package, it can't come back to
it. For that matter, pkg_add doesn't deinstall packages at all as far
as I know. 

I think you're asking if pkg_add will deinstall a package if a newer
one is required by a package being installed. That isn't a decision it
can really make - you don't know what will break if you do that.

>  Isn't this a classic AI backtracking problem? (ok, complete noob opinion here).

Backtracking is usually associated with a search for a goal. Only the
human invoking pkg_add knows the goal, so to decide whether or not a
port should be deinstalled requires information from that person. The
previously mentioned portupgrade has some flags to provide specific
instances of that information for special cases. The port also has
some commands for achieving specific goals.

If you let us know what your goals are, we might be able to help you
get there.

	<mike
-- 
Mike Meyer <mwm at mired.org>		http://www.mired.org/consulting.html
Independent Network/Unix/Perforce consultant, email for more information.


More information about the freebsd-hackers mailing list