* [gentoo-portage-dev] [PATCH] when emerge restarts itself sometimes it fails (bug 117988)
@ 2006-01-30 20:55 Zac Medico
0 siblings, 0 replies; only message in thread
From: Zac Medico @ 2006-01-30 20:55 UTC (permalink / raw
To: gentoo-portage-dev
[-- Attachment #1: Type: text/plain, Size: 829 bytes --]
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
http://bugs.gentoo.org/show_bug.cgi?id=117988
Honestly, I don't really understand the code that emerge uses to restart itself. Basically, the current behavior is to restart itself with a filtered version of it's original arguments. It seems to be error prone and I don't see how it can handle all of the necessary cases.
The attached patch uses the existing "--resume" functionality to solve the problem. The new argument list is generated from "myopts" and selected "badlongopts" are
filtered out. I've been using this patch locally with no issues. Feedback would be appreciated.
Zac
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.2 (GNU/Linux)
iD8DBQFD3n1U/ejvha5XGaMRAgTGAKDHAQX1KylV3ySzSszz/5y0vFpppACgut85
igndUxDitsV5L05aISFxYi0=
=a5C4
-----END PGP SIGNATURE-----
[-- Attachment #2: emerge-restart-resume.patch --]
[-- Type: text/x-patch, Size: 1769 bytes --]
Index: bin/emerge
===================================================================
--- bin/emerge (revision 2608)
+++ bin/emerge (working copy)
@@ -2112,36 +2112,16 @@
if (myver != portage.VERSION) and \
("livecvsportage" not in portage.settings.features):
if len(mymergelist) > mergecount:
- myargv=sys.argv
- myr=0
- for myra in range(len(myargv)):
- if myargv[myr][0:len("portage")]=="portage":
- del myargv[myr]
- myr-=1
- if myargv[myr][0:len("sys-apps/portage")]=="sys-apps/portage":
- del myargv[myr]
- myr-=1
- myr+=1
emergelog(" *** RESTARTING emerge via exec() after change of portage version.")
+ del portage.mtimedb["resume"]["mergelist"][0]
portage.portageexit()
- # Remove --ask from options before restarting
mynewargv=[]
- badlongopts = ["--ask","--tree","--changelog"]
- badshortopts = ["a","t","l"]
- for arg in myargv:
- if arg[0:2] == "--":
- if arg in badlongopts:
- continue
- mynewargv += [arg]
- elif arg[0] == "-":
- myarg = "-"
- for ch in arg[1:]:
- if ch in badshortopts:
- continue
- myarg += ch
- mynewargv += [myarg]
- else:
- mynewargv += [arg]
+ badlongopts = ("--ask","--tree","--changelog","--skipfirst","--resume")
+ for arg in myopts:
+ if arg in badlongopts:
+ continue
+ mynewargv.append(arg)
+ mynewargv.append("--resume")
os.execv("/usr/lib/portage/bin/emerge", mynewargv)
if ("--pretend" not in myopts) and ("--fetchonly" not in myopts) and ("--fetch-all-uri" not in myopts):
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2006-01-30 20:50 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-01-30 20:55 [gentoo-portage-dev] [PATCH] when emerge restarts itself sometimes it fails (bug 117988) Zac Medico
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox