Avoid unnecessary recursion when walking upstream causes.

If an upstream project has already been added to the list of upstream
causes, avoid recursing into it again as this can quickly turn into a
massive task in large installations.  All we care about are the names
of the upstream projects, we don't need to recurse back into every
build of them.

One potential problem with this change is that a project may have been
triggered by more than one build of an upstream project, and those
builds may have different sets of upstream causes.  That means that we
may now miss triggering all the required module builds in certain
cases.  For now though, that can't be helped, as the previous
comprehensive analysis simply wasn't at all scalable.