diff options
author | Zac Medico <zmedico@gentoo.org> | 2006-12-07 08:56:49 +0000 |
---|---|---|
committer | Zac Medico <zmedico@gentoo.org> | 2006-12-07 08:56:49 +0000 |
commit | 57f7498bcb4b9b3feef621e51cb1c32135e07e00 (patch) | |
tree | fcf4533ce05a70c69f4e6482d3cdff5746daacea | |
parent | 134add746097a67013f9548e1e5ece556ed98e60 (diff) | |
download | portage-57f7498bcb4b9b3feef621e51cb1c32135e07e00.tar.gz portage-57f7498bcb4b9b3feef621e51cb1c32135e07e00.tar.bz2 portage-57f7498bcb4b9b3feef621e51cb1c32135e07e00.zip |
For bug #157393, fix up ebuild path normalization so that it's compatible with portdbapi handling and works properly with symlinks (like crossdev creates).
svn path=/main/trunk/; revision=5201
-rwxr-xr-x | bin/ebuild | 19 |
1 files changed, 16 insertions, 3 deletions
diff --git a/bin/ebuild b/bin/ebuild index 0860f089b..91cd94a45 100755 --- a/bin/ebuild +++ b/bin/ebuild @@ -38,7 +38,20 @@ if portage.settings["NOCOLOR"] in ("yes","true") or not sys.stdout.isatty(): import output output.nocolor() -ebuild = os.path.realpath(pargs.pop(0)) +ebuild = pargs.pop(0) +if not os.path.isabs(ebuild): + mycwd = os.getcwd() + # Try to get the non-canonical path from the PWD evironment variable, since + # the canonical path returned from os.getcwd() may may be unusable in + # cases where the directory stucture is built from symlinks. + if "PWD" in os.environ and os.environ["PWD"] != mycwd and \ + os.path.realpath(os.environ["PWD"]) == mycwd: + mycwd = portage.normalize_path(os.environ["PWD"]) + ebuild = os.path.join(mycwd, ebuild) +# portdbapi uses the canonical path for the base of the portage tree, but +# subdirectories of the base can be built from symlinks (like crossdev does). +ebuild_portdir = os.path.realpath(os.path.dirname(os.path.dirname(ebuild))) +ebuild = os.path.join(ebuild_portdir, *ebuild.split(os.path.sep)[-2:]) if not os.path.exists(ebuild): print "'%s' does not exist." % ebuild @@ -66,7 +79,7 @@ else: portage_ebuild = portage.portdb.findname(cpv) - if not portage_ebuild or os.path.realpath(portage_ebuild) != ebuild: + if not portage_ebuild or portage_ebuild != ebuild: overlay = "/".join(ebuild_split[:-2]) os.environ["PORTDIR_OVERLAY"] = os.environ.get("PORTDIR_OVERLAY","") + " " + overlay print "Appending %s to PORTDIR_OVERLAY..." % overlay @@ -74,7 +87,7 @@ else: reload(portage) portage_ebuild = portage.portdb.findname(cpv) - if not portage_ebuild or os.path.realpath(portage_ebuild) != ebuild: + if not portage_ebuild or portage_ebuild != ebuild: print "!!! %s does not seem to have a valid PORTDIR structure." % overlay sys.exit(1) |