fixed ebuild so
authorBrian Harring <ferringb@gentoo.org>
Sat, 1 Oct 2005 07:52:55 +0000 (07:52 -0000)
committerBrian Harring <ferringb@gentoo.org>
Sat, 1 Oct 2005 07:52:55 +0000 (07:52 -0000)
ebuild some-ebuild clean setup unpack # works like
ebuild some-ebuild clean unpack

svn path=/main/branches/2.0/; revision=2064

ChangeLog
bin/ebuild
pym/portage.py

index b5b28b258231e2f84af25a674c671d47793cbaa9..15ccaaab26dcd316248f689d73eceff68913778c 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -7,6 +7,12 @@
     2. /var/cache/edb/world is now /var/lib/portage/world.
     3. /etc/portage/profile/virtuals is _USER_ configs only.
 
+  01 Oct 2005; Brian Harring <ferringb@gentoo.org> bin/ebuild, 
+  pym/portage.py:
+  Fixed ebuild some-ebuild setup unpack so it functions like
+  ebuild some-ebuild unpack does (execute just unpack due to 
+  env issues, see comments in ebuild clarifying if curious).
+
   28 Sep 2005; Brian Harring <ferringb@gentoo.org> bin/repoman:
   Fixup of the file.name check so it doesn't catch CVS dirs.
 
index 68c05c00625be2242389a5a31aca31c3d473a11b..b3b063ae4408a3985a3848a9c807f52e5a185fc5 100755 (executable)
@@ -1,7 +1,7 @@
 #!/usr/bin/python -O
 # Copyright 1999-2004 Gentoo Foundation
 # Distributed under the terms of the GNU General Public License v2
-# $Id: /var/cvsroot/gentoo-src/portage/bin/ebuild,v 1.18.2.3 2005/05/07 04:32:59 ferringb Exp $
+# $Header: /var/cvsroot/gentoo-src/portage/bin/ebuild,v 1.18.2.3 2005/05/07 04:32:59 ferringb Exp $
 
 import os,sys
 sys.path = ["/usr/lib/portage/pym"]+sys.path
@@ -39,23 +39,48 @@ if "merge" in pargs:
 
 import portage
 
-for x in pargs[1:]:
+if len(pargs) > 1 and "noauto" not in portage.features:
+
+       # so... basically we find the highest 'target' specified, and execute only that, rather
+       # then executing each stage by a doebuild call. 
+       # we do this due to the fact doebuild doesn't get it's own env handling right in conjunction with
+       # ebuild.sh's env reloading, fixing it was what ebd does, no point in replicating it in stable 
+       # (too massive of changes).
+       # do a lil dance.
+       try:                            pargs.remove("clean")
+       except ValueError:      cleanse_first = False
+       else:                           cleanse_first = True
+
+       # make a lil love
+       actionmap_targets = filter(lambda x: x in portage.actionmap_deps, pargs[1:])
+       others = filter(lambda x: x not in portage.actionmap_deps, pargs[1:])
+       def recurse_it(targ):
+               l = portage.actionmap_deps[targ][:]
+               if len(l):
+                       l += map(recurse_it, l)
+               return l
+       kills = portage.unique_array(portage.flatten(map(recurse_it, actionmap_targets)))
+       actionmap_targets = filter(lambda x: x not in kills, actionmap_targets)
+       
+       # get down tonight.
+       if "config" in others and (len(actionmap_targets) or len(others) > 1):
+               if len(pargs) != 2:
+                       print "config must be called on it's own, not combined with any other phase"
+                       sys.exit(1)
+       ebuild = pargs[0]
+       pargs = actionmap_targets + others
+       root = getroot()
+       
+for x in pargs:
        try:
                tmpsettings = portage.config(clone=portage.settings)
-
-               if x in ['clean','config']:
-                       cleanup=1
-               else:
-                       cleanup=0
-               a=portage.doebuild(pargs[0],x,getroot(),tmpsettings,debug=debug,cleanup=cleanup)
+               a=portage.doebuild(ebuild, x, root, tmpsettings, debug=debug, cleanup=cleanse_first)
+               cleanse_first = False
        except KeyboardInterrupt:
                print "(interrupted by user -- ctrl-C?)"
                a=1
-       except IOError:
-               a=1
-               print "ebuild: this ebuild generated output during the depend phase (bad)"
        if a == None:
-               portage_util.writemsg("Could not run the required binary?\n")
-               sys.exit(127)
+               print "Could not run the required binary?"
+               a = 127
        if a:
                sys.exit(a)
index 86bf070fe46d21d5345344e8463a1e0c61b08a4a..fbb7711b6d20d7460d1ca9d1e9acd8e0866aba0f 100644 (file)
@@ -2333,8 +2333,22 @@ def spawnebuild(mydo,actionmap,mysettings,debug,alwaysdep=0,logfile=None):
                                droppriv=actionmap[mydo]["args"][1],logfile=logfile)
        return retval
 
+# chunked out deps for each phase, so that ebuild binary can use it 
+# to collapse targets down.
+actionmap_deps={
+       "depend": [],
+       "setup":  [],
+       "unpack": ["setup"],
+       "compile":["unpack"],
+       "test":   ["compile"],
+       "install":["test"],
+       "rpm":    ["install"],
+       "package":["install"],
+}
+
+
 def doebuild(myebuild,mydo,myroot,mysettings,debug=0,listonly=0,fetchonly=0,cleanup=0,dbkey=None,use_cache=1,fetchall=0,tree="porttree"):
-       global db
+       global db, actionmap_deps
 
        ebuild_path = os.path.abspath(myebuild)
        pkg_dir     = os.path.dirname(ebuild_path)
@@ -2714,16 +2728,23 @@ def doebuild(myebuild,mydo,myroot,mysettings,debug=0,listonly=0,fetchonly=0,clea
        if nosandbox and ("userpriv" not in features or "userpriv" in mysettings["RESTRICT"] or \
                "nouserpriv" in mysettings["RESTRICT"]):
                nosandbox = ("sandbox" not in features and "usersandbox" not in features)
-       actionmap={
-                         "depend": {                 "args":(0,1)},         # sandbox  / portage
-                         "setup":  {                 "args":(1,0)},         # without  / root
-                        "unpack":  {"dep":"setup",   "args":(0,1)},         # sandbox  / portage
-                       "compile":  {"dep":"unpack",  "args":(nosandbox,1)}, # optional / portage
-                          "test":  {"dep":"compile", "args":(nosandbox,1)}, # optional / portage
-                       "install":  {"dep":"test",    "args":(0,0)},         # sandbox  / root
-                           "rpm":  {"dep":"install", "args":(0,0)},         # sandbox  / root
-       "package":  {"dep":"install", "args":(0,0)},         # sandbox  / root
+
+       actionmap = {
+               "depend": {"args":(0,1)},         # sandbox  / portage
+               "setup":  {"args":(1,0)},         # without  / root
+               "unpack": {"args":(0,1)},         # sandbox  / portage
+               "compile":{"args":(nosandbox,1)}, # optional / portage
+               "test":   {"args":(nosandbox,1)}, # optional / portage
+               "install":{"args":(0,0)},         # sandbox  / root
+               "rpm":    {"args":(0,0)},         # sandbox  / root
+               "package":{"args":(0,0)},         # sandbox  / root
        }
+       
+       # merge the deps in so we have again a 'full' actionmap
+       # be glad when this can die.
+       for x in actionmap.keys():
+               if len(actionmap_deps.get(x, [])):
+                       actionmap[x]["dep"] = ' '.join(actionmap_deps[x])
 
        if mydo in actionmap.keys():
                if mydo=="package":