Go to:
Gentoo Home
Documentation
Forums
Lists
Bugs
Planet
Store
Wiki
Get Gentoo!
Gentoo's Bugzilla – Attachment 115026 Details for
Bug 21509
[IDEA] Ability to cleanly stop emerging multiple packages after the current jobs complete.
Home
|
New
–
[Ex]
|
Browse
|
Search
|
Privacy Policy
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
allow the current ebuild to complete before exiting on SIGINT
interrupt.patch (text/plain), 2.21 KB, created by
Zac Medico
on 2007-03-31 12:10:40 UTC
(
hide
)
Description:
allow the current ebuild to complete before exiting on SIGINT
Filename:
MIME Type:
Creator:
Zac Medico
Created:
2007-03-31 12:10:40 UTC
Size:
2.21 KB
patch
obsolete
>diff --git a/bin/ebuild.sh b/bin/ebuild.sh >diff --git a/bin/emerge b/bin/emerge >index cdd4b6f..43de796 100755 >--- a/bin/emerge >+++ b/bin/emerge >@@ -2890,7 +2890,25 @@ class MergeTask(object): > self.pkgsettings["/"] = \ > portage.config(clone=trees["/"]["vartree"].settings) > >+ def _signal_handler(self, signum, frame): >+ self._interrupt_count += 1 >+ if self._interrupt_count > 1: >+ signal.signal(signal.SIGINT, signal.SIG_IGN) >+ signal.signal(signal.SIGTERM, signal.SIG_IGN) >+ portage.writemsg( >+ "\n\nExiting on signal %(signal)s\n" % {"signal":signum}) >+ sys.exit(100+signum) >+ else: >+ portage.writemsg( >+ "\n\nCaught signal: waiting until this ebuild finishes..." + \ >+ " Try again to force stop now\n", noiselevel=-1) >+ > def merge(self, mylist, favorites, mtimedb): >+ >+ self._interrupt_count = 0 >+ signal.signal(signal.SIGINT, self._signal_handler) >+ signal.signal(signal.SIGTERM, self._signal_handler) >+ > failed_fetches = [] > mymergelist=[] > ldpath_mtimes = mtimedb["ldpath"] >@@ -3302,6 +3320,8 @@ class MergeTask(object): > # in the event that portage is not allowed to exit normally > # due to power failure, SIGKILL, etc... > mtimedb.commit() >+ if self._interrupt_count: >+ break > > if "--pretend" not in self.myopts: > emergelog(xterm_titles, " *** Finished. Cleaning up...") >diff --git a/pym/portage.py b/pym/portage.py >index dda1ba5..018fbb4 100644 >--- a/pym/portage.py >+++ b/pym/portage.py >@@ -2246,13 +2246,28 @@ def spawn(mystring, mysettings, debug=0, free=0, droppriv=0, sesandbox=0, **keyw > > while mypids: > pid = mypids.pop(0) >- retval = os.waitpid(pid, 0)[1] >+ while True: >+ try: >+ retval = os.waitpid(pid, 0)[1] >+ break >+ except OSError, e: >+ if e.errno != errno.EINTR: >+ raise >+ del e > portage_exec.spawned_pids.remove(pid) > if retval != os.EX_OK: > for pid in mypids: > if os.waitpid(pid, os.WNOHANG) == (0,0): >+ import signal > os.kill(pid, signal.SIGTERM) >- os.waitpid(pid, 0) >+ while True: >+ try: >+ os.waitpid(pid, 0) >+ break >+ except OSError, e: >+ if e.errno != errno.EINTR: >+ raise >+ del e > portage_exec.spawned_pids.remove(pid) > if retval & 0xff: > return (retval & 0xff) << 8
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 21509
: 115026