Portage lacks a feature to suspend what it's doing, then resume later.
It can take hours and hours to compile certain packages like kde or xfree. Sometimes I've
invested more than an hour in compiling a package, when I decide to use my computer for
other tasks. I have to stop portage because the system is not responsive enough with
compiling going on even at nice 19.
Then when i later resume the work, portage has to start everything over from the beginning,
loosing invaluable hours of cpu time.
It would be nice to be able to tell portage to put everything on hold, use no cpu resources, and
later resume from where the job was suspended.
Steps to Reproduce:
You should already have the ability to do this. It's not in portage but built into bash (and other shells I'm sure). It's called Job Control. Type:
(to search for job control in the man page)
A simple summary:
Start your program ('emerge -uD world' for example)
When you need to suspend (pause) hit 'ctrl-z'.
You should get something like "+ Stopped emerge -uD world"
and a prompt. Use computer as needed.
When you want to resume run the command 'fg'
I agree with Tyler, theres no need to spend time reinventing the wheel as it were. In addtion to the CTRL-Z option, should you CTRL-C (or KILL) the emerge process, you can still use emerge --resume to start re-merging at the last package it was working on (only works if you haven't run another emerge command between them)
Neither of the above comments solve the problem the original bug mentions in all cases.
The job control solution won't survive a reboot.
The emerge --resume won't preserve all the CPU time already invested in emerging a package.
What would be nice is to be able to send emerge a signal (say USR1) which causes it to send HUPs/KILLs to compiles, or, cleanly finish patching/merging/whatever it is doing that you *don't* want to stop in the middle of, then die. It could also potentially write some tracking information to a file to be used when the resume begins (ie, unpack completed, patch completed, partway through compile).
emerge --resume could then pick up that unpack, patch are completed, and simply kick off make again.
I can't see any reasonable way to do this generically. Simply restarting src_compile is not an option. Adding a src_resume is not enough either - some sort of src_pause would be necessary. Although, that's not really doable either because src_compile is already doing its thing. Signal handling from within ebuilds? I don't think so. The only other way I can think of would be to write a virtual machine for compiling in. Not really doable either...