diff options
author | Zac Medico <zmedico@gentoo.org> | 2008-01-11 05:47:25 +0000 |
---|---|---|
committer | Zac Medico <zmedico@gentoo.org> | 2008-01-11 05:47:25 +0000 |
commit | 3541e3856fc232d2e5c0fe0edde4c8da0c3a99a8 (patch) | |
tree | 14bfd4554cbb34864056668238ff390e167f4c9a | |
parent | 217f73343bd59b601ed6b0b54438344c8feb26d8 (diff) | |
download | portage-3541e3856fc232d2e5c0fe0edde4c8da0c3a99a8.tar.gz portage-3541e3856fc232d2e5c0fe0edde4c8da0c3a99a8.tar.bz2 portage-3541e3856fc232d2e5c0fe0edde4c8da0c3a99a8.zip |
Make sure that portdb.findname() returns the correct ebuild.
(trunk r9164:9165)
svn path=/main/branches/2.1.2/; revision=9173
-rwxr-xr-x | bin/ebuild | 29 |
1 files changed, 16 insertions, 13 deletions
diff --git a/bin/ebuild b/bin/ebuild index d4a3a6667..f82be264c 100755 --- a/bin/ebuild +++ b/bin/ebuild @@ -58,8 +58,20 @@ if not os.path.isabs(ebuild): ebuild = portage.normalize_path(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:]) +ebuild_portdir = os.path.realpath( + os.path.dirname(os.path.dirname(os.path.dirname(ebuild)))) +ebuild = os.path.join(ebuild_portdir, *ebuild.split(os.path.sep)[-3:]) + +# Make sure that portdb.findname() returns the correct ebuild. +if ebuild_portdir not in portage.portdb.porttrees: + os.environ["PORTDIR_OVERLAY"] = \ + os.environ.get("PORTDIR_OVERLAY","") + " " + ebuild_portdir + print "Appending %s to PORTDIR_OVERLAY..." % ebuild_portdir + portage.close_portdbapi_caches() + reload(portage) +del portage.portdb.porttrees[1:] +if ebuild_portdir != portage.portdb.porttree_root: + portage.portdb.porttrees.append(ebuild_portdir) if not os.path.exists(ebuild): print "'%s' does not exist." % ebuild @@ -88,17 +100,8 @@ else: portage_ebuild = portage.portdb.findname(cpv) 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 - portage.close_portdbapi_caches() - reload(portage) - portage_ebuild = portage.portdb.findname(cpv) - - if not portage_ebuild or portage_ebuild != ebuild: - print "!!! %s does not seem to have a valid PORTDIR structure." % overlay - sys.exit(1) - + print "!!! %s does not seem to have a valid PORTDIR structure." % ebuild + sys.exit(1) if len(pargs) > 1 and "config" in pargs: print "config must be called on it's own, not combined with any other phase" |