Fix infinite recursion for circular dependency

Infinite recursion occurs if package A depends on package B and package
B depends on package A.

To fix this, I introduce a `pkgs_processed` set, which keeps track of
the packages that we've already determined dependencies for so we don't
keep redoing this ad-infinitum.
Merge branch 'fix_infinite_recursion_with_circular_dependency' into msabramo_develop