Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
Tip: Resuming emerge -e world when --resume no longer option
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Documentation, Tips & Tricks
View previous topic :: View next topic  
Author Message
codeslave
n00b
n00b


Joined: 19 Jan 2004
Posts: 5
Location: Boston, MA

PostPosted: Wed Sep 15, 2004 3:26 pm    Post subject: Tip: Resuming emerge -e world when --resume no longer option Reply with quote

I made a bit of a mistake while running an "emerge -eD world" to recompile my system with new CFLAGs. It had been running in the background for the last day or so, and I managed to misread that it failed, with 37 packages left. (Thought it completed successfully, oops...)

This is not a big deal in itself, since I could just fix the problem and "emerge --resume". But that sort-of doesn't work when you emerge something else in between, even if you ctrl-c out of it. And I really didnt want to rerun the entire emerge -e again, since 398 packages already recompiled successfully.

This is how I managed to resume the second-last emerge action.

The emerge -e failed at package 399 of 436. (Still had the terminal open, but you could find this info out from /var/log/emerge.log too.)

So, I issued the command:
Code:

emerge --pretend -eD world


This gave me the list of the 436 packages to be emerged.

Copy that output to a text editor, so it contains
Code:

Calculating world dependencies ...done!
[ebuild  N    ] sys-devel/patch-2.5.9 
[ebuild  N    ] sys-devel/gnuconfig-20040214 
[ebuild  N    ] sys-apps/coreutils-5.2.1-r2 
[ebuild  N    ] sys-apps/debianutils-1.16.7-r4 
[ebuild  N    ] sys-apps/portage-2.0.50-r11 
*** Please update portage to the above version before proceeding.
    Failure to do so may result in failed or improper merges.
    A simple 'emerge -u portage' is sufficient.
[ebuild  N    ] sys-devel/bc-1.06-r5 
[ebuild  N    ] sys-apps/diffutils-2.8.4-r4 
[ebuild  N    ] dev-libs/openssl-0.9.7d-r1 
etc...


Remove extraneous messages (specifically the restart after portage bit) so that the file contains one line per emerge:The file would then look like:
Code:

[ebuild  N    ] sys-devel/patch-2.5.9 
[ebuild  N    ] sys-devel/gnuconfig-20040214 
[ebuild  N    ] sys-apps/coreutils-5.2.1-r2 
[ebuild  N    ] sys-apps/debianutils-1.16.7-r4 
[ebuild  N    ] sys-apps/portage-2.0.50-r11 
[ebuild  N    ] sys-devel/bc-1.06-r5 
[ebuild  N    ] sys-apps/diffutils-2.8.4-r4 
[ebuild  N    ] dev-libs/openssl-0.9.7d-r1 
etc...


Globally replace the [ebuild N] bit with "=", giving a final output of:
Code:

=sys-devel/patch-2.5.9 
=sys-devel/gnuconfig-20040214 
=sys-apps/coreutils-5.2.1-r2 
=sys-apps/debianutils-1.16.7-r4 
=sys-apps/portage-2.0.50-r11 
=sys-devel/bc-1.06-r5 
=sys-apps/diffutils-2.8.4-r4 
=dev-libs/openssl-0.9.7d-r1 
etc...


Then scroll down to the package that the emerge world failed at, and delete everything above it. Save the file, and then you can
Code:

emerge --pretend `cat /my/file/name`
emerge `cat /my/file/name`

to finish out the packages that did not yet get recompiled.

Almost too simple to mention, but I hope this helps someone else out there...
/cs
Back to top
View user's profile Send private message
Joe_Bogarde
n00b
n00b


Joined: 01 Jun 2003
Posts: 45
Location: Ellensburg WA

PostPosted: Fri Sep 24, 2004 8:30 pm    Post subject: Thanks Reply with quote

You saved me almost a day of compiling with this howto. Thanks
_________________
"Persons attempting to find a motive in this narrative will be prosecuted; persons attempting to find a moral in it will be banished; persons attempting to find a plot in it will be shot." Mark Twain.
Back to top
View user's profile Send private message
Twink
Apprentice
Apprentice


Joined: 06 Dec 2002
Posts: 178
Location: New Zealand

PostPosted: Sat Sep 25, 2004 3:14 am    Post subject: Reply with quote

nice tip, could probably be simplified with a script so i thought i'd have a go (as i need the practice) feel free to correct any bugs i make :)

Code:

!#/bin/bash

RESUME=`emerge -p $1 | grep "\[ebuild " | sed -e 's/\[ebuild[^]]*\] /=/g' | sed -e 1,$2d`
emerge $3 $RESUME


say its called resume.sh

./resume.sh "-ed world" 399 ""

first argument is passed to the emerge -p, the number is the number of packages to remove from the beginning of the list. 3rd argument is passed to the actual emerge statement. I haven't played around with it much so I'm not 100% is works.

you can test it with something like

./resume.sh "fluxbox xterm" 1 "-p"
which would find out the packages needed for fluxbox and xterm, remove the first one then emerge -p the result (so you can see what it ends up with) a -a might be a good idea.
Back to top
View user's profile Send private message
neenee
Veteran
Veteran


Joined: 20 Jul 2003
Posts: 1786

PostPosted: Sat Sep 25, 2004 7:58 am    Post subject: Reply with quote

you could also use 'pick your emerge', a script which allows
emerging ranges of package, or excluding ranges and a
step-by-step emerge function, which allows the rest of the
packages to continue emerging - a list will be presented to
you at the end, showing which packages emerged success-
fully and which failed, so that you can retry the failed ones.

if an emerge -e world / system fails and you did not use step-
by step emerge, you can just tail /var/log/emerge.log, run
pye -e world again and continue with the range omitting the
ones before the failed package.

link: https://forums.gentoo.org/viewtopic.php?t=135968
Back to top
View user's profile Send private message
bwaldow
n00b
n00b


Joined: 13 Sep 2004
Posts: 67
Location: Wellington, New Zealand

PostPosted: Sat Oct 09, 2004 10:53 am    Post subject: Reply with quote

Hi,

How is this different from using the -n flag with emerge?

From man:

--noreplace (-n)
Skips the packages specified on the command-line that have already been installed. Without this option, any packages, ebuilds, or deps you specify on on the command-line *will* cause Portage to remerge the package, even if it is already installed. Note that Portage will not remerge dependencies by default.

Cheers,
Bret
Back to top
View user's profile Send private message
redshift
Tux's lil' helper
Tux's lil' helper


Joined: 26 Nov 2003
Posts: 98

PostPosted: Sat Oct 09, 2004 6:11 pm    Post subject: Reply with quote

bwaldow wrote:
How is this different from using the -n flag with emerge?

With -e, all packages are considered new; besides, he already had all of those packages installed. He was just changing his CFLAGS. -n wouldn't make any distinction between what had been merged yesterday and what was merged a year ago.
_________________
Tom
Back to top
View user's profile Send private message
etnoy
Apprentice
Apprentice


Joined: 29 Aug 2003
Posts: 255
Location: Västerås, Sweden

PostPosted: Sat Oct 09, 2004 8:16 pm    Post subject: Reply with quote

redshift wrote:
bwaldow wrote:
How is this different from using the -n flag with emerge?

With -e, all packages are considered new; besides, he already had all of those packages installed. He was just changing his CFLAGS. -n wouldn't make any distinction between what had been merged yesterday and what was merged a year ago.

Hope we'll get a --newflags feature soon, just like --newuse has in ~x86 portage.
_________________
The md5sum of the above post is 06280ccd85ef9deb49c336e7945f4b5c

God is dead! - Nietzsche
Nietzsche is dead! -God
Back to top
View user's profile Send private message
codeslave
n00b
n00b


Joined: 19 Jan 2004
Posts: 5
Location: Boston, MA

PostPosted: Mon Oct 25, 2004 4:39 pm    Post subject: Reply with quote

Joe_bogarde wrote:

You saved me almost a day of compiling with this howto. Thanks


Glad this helped. :)

redshift wrote:
bwaldow wrote:
How is this different from using the -n flag with emerge?

With -e, all packages are considered new; besides, he already had all of those packages installed. He was just changing his CFLAGS. -n wouldn't make any distinction between what had been merged yesterday and what was merged a year ago.


Yep, that was exactly why -n wasnt applicable in this situation... Nothing new was being installed -- just recompilation of everything.

And as other pointed out, there are probably ways of automating/simplifying this through creative scripting. But as I'm not planning on rebuilding everything any time soon, it didn't seem like a priority.

Sometimes "good enough" is good enough. :)

/cs
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Documentation, Tips & Tricks All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum