diff options
author | Jason Stubbs <jstubbs@gentoo.org> | 2005-10-15 12:51:29 +0000 |
---|---|---|
committer | Jason Stubbs <jstubbs@gentoo.org> | 2005-10-15 12:51:29 +0000 |
commit | d0795c1638cb1f7837fad6395251deef1dbf1757 (patch) | |
tree | fb863adcaae319771043131b6a8bef75745edfd8 | |
parent | 3cd426e87af93fdca25acfd2cd9f5fbb068ebba5 (diff) | |
download | portage-d0795c1638cb1f7837fad6395251deef1dbf1757.tar.gz portage-d0795c1638cb1f7837fad6395251deef1dbf1757.tar.bz2 portage-d0795c1638cb1f7837fad6395251deef1dbf1757.zip |
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
-rwxr-xr-x | bin/ebuild | 35 |
1 files 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 |