Workaround for what I believe is a bug of Tcl 8.4.4.
Workaround for what I believe is a bug of Tcl 8.4.4.

The bug is the following: when Tcl 8.4.4 globs for packages, it will reload
pkgIndex.tcl for packages with the same name than packages that have already
been loaded.

It affected DP in the case where you have an installation on / and another
somewhere else (typically on lamancha). Using port from the other installation
will nevertheless load /Library/Tcl/darwinports1.0/pkgIndex.tcl and later
/Library/Tcl/darwinports1.0/darwinports.tcl. With a recent change, the
installation on lamancha on / is not compatible with the one from CVS
(ui_puts no longer exist), so user installations there simply don't work.

The workaround consists in modifying the behavior of package ifneeded command by
patching the package command. The official behavior of package ifneeded when it
is provided 3 parameters (name, version, script) is to update the script when
package ifneeded is called again with the same package name and package version.
The behavior from the patched version is to keep the first script that was
defined (hence, we'll keep the script from the user installation).

We could have imagined other workarounds (such as reloading darwinports_fastload
when the first system package is loaded, just after Tcl globbed for packages).

I chose this workaround because it's simpler and DP, as well as system
packages it might rely on, do not and will probably not rely on the feature
of package ifneeded that I changed.

The workaround is only applied on Tcl < 8.4.7 (8.4.7 is 10.4.2 version and the
problem doesn't occur there).

Special thanks to jmpp@ for letting me play with the / installation on his 10.3
box.

git-svn-id: 620571fa9b4bd0cbce9a0cf901e91ef896adbf27@13976 d073be05-634f-4543-b044-5fe20cf6d1d6

neverpanic/macports-base,danchr/macports-base,danchr/macports-base,macports/macports-base,macports/macports-base,neverpanic/macports-base