Homebrew will cause problems when building software from source if it is installed in
/usr/local. This is the default, which is a bad choice as this path is in the default search path of compilers and other tools. Therefore builds from other packaging software might pick up the wrong dependency, using Homebrew's version instead of their own.
Years ago, in the very beginning of the project, even MacPorts was using
/usr/local. But it turned out not to cooperate with other tools as is documented in their FAQ. Unfortunately Homebrew developers didn't want to hear about prior experiences and ignored such facts...
In general, it is usually better to stick to one tool only to avoid all problems. MacPorts is doing their best to patch out any harcoded paths, e.g. to
/sw which is used by Fink. So usually it will work, but having anything installed in
/usr/local will definitely cause problems for it.
I don't know pkgsrc enough to say if it is really affected the same way, but my best guess is that this problem applies to it as well.
There don't seem to be any open bugs for digikam or grass in MacPorts. You should report your problems to them directly with new tickets to get assistance.