From d0795c1638cb1f7837fad6395251deef1dbf1757 Mon Sep 17 00:00:00 2001 From: Jason Stubbs Date: Sat, 15 Oct 2005 12:51:29 +0000 Subject: Check if ebuild path is in vdb and check that vdb finds it okay rather than always assuming "porttree". If PORTDIR_OVERLAY needs to be adjusted, recheck to make sure the ebuild is found correctly. Pass which tree should be used to doebuild so that aux_get() are performed on the correct tree. svn path=/main/branches/2.0/; revision=2135 --- bin/ebuild | 35 ++++++++++++++++++++++++++--------- 1 file changed, 26 insertions(+), 9 deletions(-) diff --git a/bin/ebuild b/bin/ebuild index 559d4af34..c79068ff0 100755 --- a/bin/ebuild +++ b/bin/ebuild @@ -21,10 +21,8 @@ if "merge" in pargs: os.environ["PORTAGE_CALLER"]="ebuild" sys.path = ["/usr/lib/portage/pym"]+sys.path -import portage, portage_util +import portage, portage_util, portage_const - -root = os.path.normpath(os.environ.get("ROOT", "") + "/") ebuild = os.path.realpath(pargs.pop(0)) if not os.path.exists(ebuild): @@ -35,12 +33,31 @@ ebuild_split = ebuild.split("/") del ebuild_split[-2] cpv = "/".join(ebuild_split[-2:])[:-7] -portage_ebuild = portage.portdb.findname(cpv) +if ebuild.startswith(portage.root + portage_const.VDB_PATH): + mytree = "vartree" + + portage_ebuild = portage.db[portage.root][mytree].dbapi.findname(cpv) + + if os.path.realpath(portage_ebuild) != ebuild: + print "!!! Portage seems to think that %s is at %s" % (cpv, portage_ebuild) + sys.exit(1) + +else: + mytree = "porttree" + + portage_ebuild = portage.portdb.findname(cpv) + + if not portage_ebuild or os.path.realpath(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 + + reload(portage) + portage_ebuild = portage.portdb.findname(cpv) -if not portage_ebuild or os.path.realpath(portage_ebuild) != ebuild: - os.environ["PORTDIR_OVERLAY"] = "/".join(ebuild_split[:-2]) - print "Adjusting PORTDIR_OVERLAY to '%s'..." % os.environ["PORTDIR_OVERLAY"] - reload(portage) + if not portage_ebuild or portageos.path.realpath(portage_ebuild) != ebuild: + print "!!! %s does not seem to have a valid PORTDIR structure." % overlay + sys.exit(1) if len(pargs) > 1 and "config" in pargs: @@ -51,7 +68,7 @@ if len(pargs) > 1 and "config" in pargs: for arg in pargs: try: tmpsettings = portage.config(clone=portage.settings) - a = portage.doebuild(ebuild, arg, root, tmpsettings, debug=debug, cleanup=("noauto" not in portage.features)) + a = portage.doebuild(ebuild, arg, portage.root, tmpsettings, debug=debug, cleanup=("noauto" not in portage.features), tree=mytree) except KeyboardInterrupt: print "Interrupted." a = 1 -- cgit v1.2.3-1-g7c22