When portage outputs the message "Calculating dependencies" it is in fact looking for the package ebuild Reproducible: Always Steps to Reproduce: 1. execute: emerge -p non-existent-ebuild emerge -p gcc Actual Results: emerge -p nonexistentpackage ; emerge -p portage These are the packages that would be merged, in order: Calculating dependencies... done! emerge: there are no ebuilds to satisfy "nonexistentpackage". These are the packages that would be merged, in order: Calculating dependencies... done! [ebuild R ] sys-apps/portage-2.1.6.13 Expected Results: emerge -p nonexistentpackage ; emerge -p portage Looking for the ebuild for this package... done! emerge: there are no ebuilds to satisfy "nonexistentpackage". Looking for the ebuild for this package... done! These are the packages that would be merged, in order: Calculating dependencies... done! [ebuild R ] sys-apps/portage-2.1.6.13
emerge can't know at which ebuilds it needs look at at the beginning. You give it a atom and it calculates which packages are needed for it. At this moment it looks for ebuilds. If it finds one, it reads the ebuild, calculates which packages are needed for it and then reads the ebuilds for the needed packages. Reading ebuilds and calculating dependencies aren't two separated processes.