In portage 2.0.48-r1 portdbapi.cpv_exists() acts incorrectly is a portage overlay is specified. Reproducible: Always Steps to Reproduce: 1. set an overlay in /etc/make.conf (make sure this overlay doesn't contain sys- apps/portage-2.0.48-r1) 2. import portage print portage.portdb.cpv_exists('sys-apps/portage-2.0.48-r1') Expected Results: 1 I'll attach a patch to fix this.
Created attachment 14043 [details, diff] patch to fix this bug
I'm not certain what your patch did except remove redundency... portage-2.0.48-r3 has multiple overlay support and something similar to what you did.
The logic in the unpatched version assumes that if an overlay is defined, then the package must be in that overlay. Else the package must not exist. The patch makes it check the portage tree if the overlay is defined _and_ the package is not in the overlay. I'll check that this is fixed in -r3.