the .ebuilds are sources several times, in fetch, compile, unpack, install, etc, etc, etc. some ebuilds are wanting to check for various things before they continue. like seeing if there exists a current /usr/src/linux tree. Some want to know if a particular package was compiled with a particular USE variables. Example, was snort installed with mysql in the USE? So, in the pkg_prereq(), I could try to figure that out. Still others want to know if /there/exists/this/shared/lib.so ? SOme packages want a user/group, but I think thats probably best to be done in the pkg_postinst(), I think its a separate issue. But anyway, this pkg_prereq() function is completely backwards compatible with all ebuilds, becuase if there not exists one, then it can continue. The ebuild should fail ebuild foo.ebiuld check if the pkg_prereq() returns non- successful code.
added as pkg_setup to portage 1.8.8-r1