portageq: fix root/eroot handling for Prefix
authorFabian Groffen <grobian@gentoo.org>
Sat, 3 Dec 2011 16:47:25 +0000 (17:47 +0100)
committerFabian Groffen <grobian@gentoo.org>
Sat, 3 Dec 2011 16:47:25 +0000 (17:47 +0100)
__PORTAGE_TEST_EPREFIX will almost always be empty, hence the code
believes that no offset prefix is in use.  In Prefix, this is always on
the contrary, so when not set, use the hardwired EPREFIX from
portage.const.  This avoids double prefixes seen for the portageq
functions, and hence funcs like has_version always return false.

bin/portageq

index fe980a20c75d8d86c2201dc29ea8b6b0a251fb3a..27a77a8d116593871ab75b41c9a8323e9e08d739 100755 (executable)
@@ -843,6 +843,10 @@ def main():
                        sys.stderr.flush()
                        sys.exit(os.EX_USAGE)
                eprefix = os.environ.get("__PORTAGE_TEST_EPREFIX")
+               # PREFIX LOCAL: make sure we fall back to our hardwired EPREFIX
+               if not eprefix:
+                       eprefix = portage.const.EPREFIX
+               # END PREFIX LOCAL
                eroot = portage.util.normalize_path(sys.argv[2])
                if eprefix:
                        root = eroot[:1-len(eprefix)]