currently emerge will remove an ebuild from the depgraph if it's invalid which means it might automatically fallback to a different version. it'd be preferable in some (all?) scenarios to have emerge just abort. we should start with making it fatal all the time and see if anyone complains and wants a way of making it fallback. example: $ emerge -pq --nodeps app-editors/nano [ebuild R ] app-editors/nano-2.7.5 $ echo '{' >> /usr/portage/app-editors/nano/nano-2.7.5.ebuild $ emerge -pq --nodeps app-editors/nano /usr/portage/app-editors/nano/nano-2.7.5.ebuild: line 85: syntax error: unexpected end of file * ERROR: app-editors/nano-2.7.5::gentoo failed (depend phase): * error sourcing ebuild * * Call stack: * ebuild.sh, line 611: Called die * The specific snippet of code: * source "$EBUILD" || die "error sourcing ebuild" * * If you need support, post the output of `emerge --info '=app-editors/nano-2.7.5::gentoo'`, * the complete build log and the output of `emerge -pqv '=app-editors/nano-2.7.5::gentoo'`. * Working directory: '/usr/lib64/python2.7/site-packages' * S: '/var/tmp/portage/app-editors/nano-2.7.5/work/nano-2.7.5' [ebuild UD] app-editors/nano-2.7.4 [2.7.5] $ echo $? 0 emerge shouldn't have bothered suggesting nano-2.7.4 at all. just give up and stay dead.
We can make the portdbapi.aux_get method raise a special subclass of PortageKeyError in this case, and the depgraph._pkg method can handle it as a fatal error.