Strip off prefix from the tail of ROOT when portage is called from
authorFabian Groffen <grobian@gentoo.org>
Fri, 13 Oct 2006 17:31:50 +0000 (17:31 -0000)
committerFabian Groffen <grobian@gentoo.org>
Fri, 13 Oct 2006 17:31:50 +0000 (17:31 -0000)
within ebuilds or eclasses to avoid a double prefix.

svn path=/main/branches/prefix/; revision=4669

pym/portage.py

index 115002f2adcf865099e73d2e6dac6596f99b704d..2d2ca0b2880ec04f356121f3779a39c04cd3c235 100644 (file)
@@ -6479,6 +6479,13 @@ if os.environ.has_key("ROOT"):
                root="/"
        elif root[-1]!="/":
                root=root+"/"
+       # strip off prefix from the tail of the string, this happens when
+       # portage is called from within ebuilds or eclasses
+       prefix=portage_const.EPREFIX
+       if prefix[-1]!="/":
+               prefix=prefix+"/"
+       if root.endswith(prefix):
+               root=root[0:-len(prefix)]+"/"
 else:
        root="/"
 if root != "/":