The x11-wm/kahakai-0.5 ebuild has a dependency on "=dev-lang/swig-1.3.16", so if you've got kahakai installed, portage will make sure that that version of swig is installed (when emerge'ing with -uD, of course), autocleaning all other versions off. Because dev-lang/swig-1.3.19 is in portage, the next time you do an "emerge -uD world", swig will be upgraded to 1.3.19, cleaning off the old 1.3.16 version. But, because kahakai is installed, and wants 1.3.16, the *next* time you do an "emerge -uD world", swig will be downgraded to 1.3.16, cleaning off the 1.3.19 version. But, because dev-lang/swig-1.3.19 is in por... Yes, well, I think you get the idea. I can stop the cycle by putting >dev-lang/swig-1.3.16 into my /etc/portage/package.mask, but that is not a good solution. If kahakai HAS to use the older version of swig, and will break with a newer version, well, then, that's unfortunate, and maybe an ewarn should be put in the ebuild, suggesting a mask for all newer versions. I can't help but feel that kahakai will probably work with later versions, and that the ebuild should be changed to >= instead of = ?
Kahakai does not work with swig 1.3.18 or 1.3.19 due to a bug in swig. It should work with 1.3.20 when that is released, as there is a fix in the swig CVS. Hopefully this will actually happen one of these months.. the problem should go away then, though.
This is a general problem, though - I can see it happening with other packages and dependency relations, too. What would the general solution be?
unfortunately Michael is correct, and you already have the only plausible workaround at the moment