Gentoo Logo
Gentoo Spaceship




Note: Due to technical difficulties, the Archives are currently not up to date. GMANE provides an alternative service for most mailing lists.
c.f. bug 424647
List Archive: gentoo-portage-dev
Navigation:
Lists: gentoo-portage-dev: < Prev By Thread Next > < Prev By Date Next >
Headers:
To: gentoo-portage-dev@g.o
From: Brian Harring <ferringb@g.o>
Subject: Re: PATCH: parallel-fetch
Date: Sun, 18 Dec 2005 01:23:38 -0800
On Sat, Dec 17, 2005 at 12:02:00AM +0900, Jason Stubbs wrote:
> I mean for when a sub-process is running such as ebuild or rsync. Will portage 
> get the SIGINT before or at the same time as the sub-process causing portage 
> to then SIGKILL it while it's trying to exit cleanly? Given that portage's 
> atexit handler is registered after portage_exec's, the subprocess reaping 
> code would not have been doing anything in the past. I guess the question is 
> more a general one rather than specifically related to background fetching.
Tests seem to work fine.

attached is updated parallel-fetch patch; main bits are chunking the 
worthless atexit crap from portage.py .

So... test it out please.  based against 2.1_pre1, although it should 
apply to .53.

Thanks,
~harring
Index: bin/emerge
===================================================================
--- bin/emerge	(revision 2390)
+++ bin/emerge	(working copy)
@@ -1869,6 +1869,41 @@
 
 		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: pym/portage.py
===================================================================
--- pym/portage.py	(revision 2390)
+++ pym/portage.py	(working copy)
@@ -130,9 +130,6 @@
 	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 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:
Attachment:
pgpI1kXOQg2ng.pgp (PGP signature)
References:
PATCH: parallel-fetch
-- Brian Harring
Re: PATCH: parallel-fetch
-- Jason Stubbs
Re: PATCH: parallel-fetch
-- Brian Harring
Re: PATCH: parallel-fetch
-- Jason Stubbs
Navigation:
Lists: gentoo-portage-dev: < Prev By Thread Next > < Prev By Date Next >
Previous by thread:
Re: PATCH: parallel-fetch
Next by thread:
Making pax-utils a depend
Previous by date:
Re: PATCH: parallel-fetch
Next by date:
dep_opconvert in portage.py and portage_dep


Updated Jun 17, 2009

Summary: Archive of the gentoo-portage-dev mailing list.

Donate to support our development efforts.

Copyright 2001-2013 Gentoo Foundation, Inc. Questions, Comments? Contact us.