(#9617) Be smarter about finding parents when eval_generating
This method generates children and nests them into a hierarchical structure,
effectively representing "the resource" as the sum of itself and its children.
To be properly hierarchical, we cause generated resources to depend on their
*nearest* ancestor, not necessarily the resource that generated them.
The previous method for finding the nearest ancestor used linear search of all
the generated resources, which had O(n^2) performance in the number of
generated resources. Additionally, it used substring comparison to find the
parent, which was not always correct (/tmp/foo1 would depend on /tmp/foo).
Now, we ask the generated resource for its potential ancestors, and look for
the nearest one that we generated. If none is found, we fall back to the
resource that generated the child. This is much faster and more correct.
Paired-With: Josh Cooper <josh@puppetlabs.com>