parallel-fetch, baby.
authorBrian Harring <ferringb@gentoo.org>
Sun, 18 Dec 2005 11:07:37 +0000 (11:07 -0000)
committerBrian Harring <ferringb@gentoo.org>
Sun, 18 Dec 2005 11:07:37 +0000 (11:07 -0000)
svn path=/main/trunk/; revision=2396

bin/emerge
man/make.conf.5
pym/portage.py

index 7b4e7cd36ffeff9bead2eefe3732ec6729fe5a3d..89dc9089f793fba30b9f9d23e7b7d952db17b720 100755 (executable)
@@ -1877,6 +1877,41 @@ class depgraph:
 
                self.pkgsettings["FEATURES"]=string.join(myfeat)
 
+               if "parallel-fetch" in myfeat and not ("--ask" in myopts or "--pretend" in myopts or "--fetchonly" in myopts):
+                       if "distlocks" not in myfeat:
+                               print red("!!!")
+                               print red("!!!")+" parallel-fetching requires the distlocks feature enabled"
+                               print red("!!!")+" you have it disabled, thus parallel-fetching is being disabled"
+                               print red("!!!")
+                       elif len(mymergelist) > 1:
+                               print ">>> starting parallel fetching"
+                               pid = os.fork()
+                               if not pid:
+                                       sys.stdin.close()
+                                       sys.stdout.close()
+                                       sys.stderr.close()
+                                       sys.stdout = open("/dev/null","w")
+                                       sys.stderr = open("/dev/null","w")
+                                       os.dup2(sys.stdout.fileno(), 1)
+                                       os.dup2(sys.stdout.fileno(), 2)
+                                       for x in ("autoaddcvs", "cvs"):
+                                               try:    myfeat.remove(x)
+                                               except ValueError: pass
+                                       self.pkgsettings["FEATURES"] = " ".join(myfeat)
+                                       ret = 0
+                                       for x in mymergelist:
+                                               if x[0] != "ebuild":
+                                                       continue
+                                               try:
+                                                       ret = portage.doebuild(portage.portdb.findname(x[2]), "fetch", x[1], self.pkgsettings,
+                                                               cleanup=0, fetchonly=True, tree="porttree")
+                                               except SystemExit:
+                                                       raise
+                                               except Exception:
+                                                       ret = 1
+                                       sys.exit(0)
+                               portage.portage_exec.spawned_pids.append(pid)
+
                mergecount=0
                for x in mymergelist:
                        mergecount+=1
index 220077b805d54f8f7f613b9b30d02fbbcf55fa66..5f5a4b7042c51cd2b2e57262271b5f9534acd349 100644 (file)
@@ -192,6 +192,9 @@ Prevents the stripping of binaries that are merged to the live filesystem.
 .B notitles
 Disables xterm titlebar updates (which contains status info).
 .TP
+.B parallel-fetch
+Fetch in the background while compiling.
+.TP
 .B sandbox
 Enable sandbox\-ing when running \fBemerge\fR(1) and \fBebuild(1)\fR.
 .TP
index bfaa1dee29ae62556424d940c94bc9adb2d9e474..7875585e5d6896fae227713c0dc2b7e2a2b99f30 100644 (file)
@@ -130,9 +130,6 @@ def exithandler(signum,frame):
        signal.signal(signal.SIGTERM, signal.SIG_IGN)
 
        # 0=send to *everybody* in process group
-       portageexit()
-       print "Exiting due to signal"
-       os.kill(0,signum)
        sys.exit(1)
 
 signal.signal(signal.SIGCHLD, signal.SIG_DFL)
@@ -6987,14 +6984,6 @@ def do_upgrade(mykey):
 def portageexit():
        global uid,portage_gid,portdb,db
        if secpass and not os.environ.has_key("SANDBOX_ACTIVE"):
-               # wait child process death
-               try:
-                       while True:
-                               os.wait()
-               except OSError:
-                       #writemsg(">>> All child process are now dead.")
-                       pass
-
                close_portdbapi_caches()
 
                if mtimedb: