fixes for self-referential deps and massive recursion.  both avoid deps ...

...of

ourselves, and avoid cookbook versions that have the same deps as a
cookbook version that we have already seen.  this should do the work of
collapse_adjacent_paths() up front.  if the 'correct' cookbook is not
getting picked, then tweak the ordering in the curr_pkg_ver outer loop.