Break cyclic dependencies according to existence of post-install script.
Currently if we encounter cyclic dependency, we resolve it by cutting it in random location, which can lead to some of packages to fail their post-install scripts. Better solution would be brake cyclic dependency so that we would install packages without such script first if possible. This should resolve most of the cases. Same situation could happen anyway if all of them has script, but it's less likely.