New Version 1.8 (2/16/07)
I've added a lot of new features to the newest version of update-world. It seems pretty stable (to me). Let me know if there are any problems.
Changelog v1.8:
-Cleaned up and modularized code. It should be a lot more readable now.
-Script now sources /etc/make.conf. Several portage variables are used by this script now.
-Added ability to 'emerge -p <package> | update-world. (realize that this is really only meant for updating existing packages...if you're installing a new one, you probably can't just skip a package failure, as it's likely a required dependency)
-Added interface with portage 2.1's elog capability. You can type 'update-world --log' to view build messages after updating (mesages stored in ~/update-world/<date>/notice/. Check out http://www.gentoo.org/doc/en/handbook/handbook-x86.xml?part=3&chap=1#doc_chap4. if you haven't set up elog yet.
-Added interface with revdep-rebuild. You can run it alone (update-world --revdep) to prepare a list of packages to install from revdep rebuild, or you can use it in conjunction with --install (update-world --revdep --install) to automatically run revdep-rebuild when the update is complete.

About update-world
If your experience is anything like mine, the process of updating a Gentoo system is no small endeavour. Typing 'emerge -uD world' is an almost guaranteed day or two periodically checking on the process to make sure it hasn't died because of a compile failure. I recently updated my system (680 packages !!!), which took literally 3 days because I would find that after I started the process and went to bed/work/etc., it would die within a few hours of starting it. 10 packages wouldn't compile properly, causing me to have to restart the emerge process 10 times. This is obviously not very efficient.

This nightmarish update process led me to come up with something that makes things easier. "update-world" is a bash script that controls the update process and forces portage to skip past failed builds and compile until the update is finished. Failed builds are added to a list for review once the update is finished.
The script does depend on the 'equery' command, part of app-portage/gentoolkit.

Here's how to do it:
First, make the script executable and put it somewhere in your $PATH.
Then, run the script.

This begins the update process by creating a list of packages to be emerged, as produced by 'emerge -uD world'. (Alternatively, you can use 'update-world --empty' to create a list of all packages on the system, akin to 'emerge -e world'). This command creates a list called 'emergelist' in ~/.update-world/. Now, you can use your favorite editor to modify this list how you like--remove packages, change versions, etc. When you have the emergelist how you like it, you're ready to move onto the next step:

Code:

update-world --install

This command actually starts the build process, just as if you had typed emerge -uD world. The difference is, if a package fails for some reason or another, that package is added to a list 'failedlist' in ~/.update-world/. Also, a link to the portage log file for that package (usually located in /var/log/portage) is created in ~/.update-world/<date>/log/. Once the process is done, you'll be presented with a list of failed packages to take care of all at once, saving much time.

Now you can automatically run revdep-rebuild whenever you update with update-world. You can use it alone or in conjunction with --install.

#!/bin/bash
# update-world 1.8
# count_zero 2007
# Licensed under the GPLv2
#
# update-world is a bash script that forces an emerge -uD world to continue, even
# in the face of (inevitable) compile failures. Failed builds are added to a list,
# and the script jumps to the next package in the queue.
#
# just run update-world --prepare (or --empty) followed by update-world --install.
#
# Release Notes:
# v1.8: Cleaned and modularized code. Added ability to utilize revdep-rebuild if wished. Can now pipe other
# emerges into update-world. Sources /etc/make.conf. Added interfacing with elog. Some bugfixes.
# v1.7 broken.
# v1.6.1: Bugfixes, added utf-8 support
# v1.6: Script preserves colored output. Fixed version numbering in help output.
# v1.5: now handles 'fetch restriction' properly
# v1.4: uses '--newuse' for emerges to respect new use flags
# v1.3: uses '--oneshot' for emerges so they don't get added to the world file.
# v1.2: Script now detects log directly instead of accepting only /var/log/portage
# v1.1: minor bugfix to allow package without version to be added to 'emergelist'
# v1.0: Release
#
#

Description:
This is a bash script to automate the 'emerge -uD world' process.

The default program directory is ~/.update-world.
Error logs are filed in ~/.update-world/<date>/log.
Ebuild notices (elogs) are filed in ~/.update-world/<date>/notice.

Usage:
update-world [ --help | -h ]
Display this help file and exit.
update-world [ --prepare | -p ]
Prepares a list of packages produced by 'emerge -puvD world'
and outputs them to the file 'emergelist' in the current directory.
Add, remove, or change the version of any of the packages listed
in this file with your favorite editor before continuing.
update-world [ --empty | -e ]
Same as --prepare except it performs 'emerge -ev world' to recompile
all packages on a system.
update-world [ --install | -i ]
Begins the emerge process based upon the 'emergelist' file created
from running 'update-world --prepare'. Once finished, failed builds
will be saved in the file 'failedlist' in the program directory.
update-world [ --revdep | -r ]
Run revdep-rebuild to prepare the emergelist. Can be used alone
or in conjunction with --install.
emerge -p <package> | update-world
Let portage produce an emergelist determined by a package. This can be
useful for large packages with lots of dependencies (kde, gnome, xorg, etc.).
Once complete, run update-world --install.
update-world [ --log | -l ]
View the ebuild notices (elogs) of packages installed by update-world,
sorted by date.
"
}
#### end help ####

I'm fairly new to Gentoo (and linux in general ^_^) but I find this script to be VERY useful. I've ran it 5 or so times so far and haven't had any problems at all. It saves SO much time from compiling errors and general problems (and allows for skipping updates on known problematic areas!).

While my dual-core system can compile packages at a good clip, rebuilding world always stalls out at some point requiring user intervention. Instead of grinding away at the build list while I'm at work, the computer spends a good deal of time at idle until I get home again. With this script, most of the work should be done while I'm away.

It was discussed in another thread about combining this script with emerging packages in the correct order, a la this thread by Guenther Brunthaler (thanks for a job well done, Guenther ).

If you run Guenther's script up until the point at which you will start rebuilding your system (gcc already emerged), you'll end up with a file '/root/recompile-remaining-packages'. This file contains all of the packages to be emerged, in the order to best rebuild the toolchain and the rest of the system. It's pretty easy to interface this with update-world:

This script has just cured every headache I had with my Gentoo box (I'm not a heavy user )
It took me weeks to update my old compaq server when I dusted it off after about 2 years in the cupboard, this would have saved me about half my time.

I have one thing though, while running "update-world --install", I get an error like

Code:

cat: /var/log/portage/elog: Is a directory

and the dir inside .update-world which is supposed to contain the logs for failed packages contains only a link to /var/log/portage/elog.
My logs structure for elog is that /var/log/portage/elog is a directory containing logs for various emerges. Is there an easy way to fix this? Thanks._________________(I love deadlines. I like the whooshing sound they make as they fly by. [DA])

The problem was that the script assumed that /var/log/portage was the portage log directory. I've updated the script so that it detects the setting of PORT_LOGDIR in /etc/make.conf. I've updated the code in the first post, but my (free) webhost is giving me some problems so I can't update the download yet _________________"We must all hang together, or assuredly we shall all hang separately."
-Ben Franklin

This script should include --newuse, to make sure use flags are respected.

Second is more of a request, and is a package fetch option. This would fetch the packages selected in the .update_world file. Allowing packages to be downloaded in the background overnight before packages are selected if need be.

I agree that this script should certainly get featured on GNN, makes updating simpler and more specialized to peoples needs.

This script should include --newuse, to make sure use flags are respected.

I guess the meaning of "--newuse" has changed since I last read the man page...I thought that (when used in conjunction with --update world) it updated ONLY those packages that would be affected by recently changed USE flags.
From the Gentoo Wiki (http://gentoo-wiki.com/MAN_emerge):

Quote:

--newuse (-N)
Tells emerge to include installed packages where USE flags have changed since compilation. An asterisk marks when a USE flag has changed since the package was compiled.

Since security updates also happen in packages you have not explicitly installed on your system (but that are pulled in as dependencies of other programs), it is recommended to run this command once in a while.

If you have altered any of your USE flags lately you might want to add --newuse as well. Portage will then verify if the change requires the installation of new packages or recompilation of existing ones:

So i guess I'm a little confused about whether --newuse would be helpful in this situation, where all packages will be updated anyway. Doesn't portage look a new use flags anyway? Maybe someone could clarify this? Implementing this in the script is pretty trivial.

Quote:

Second is more of a request, and is a package fetch option. This would fetch the packages selected in the .update_world file. Allowing packages to be downloaded in the background overnight before packages are selected if need be.

I'll look into this, parallel fetching would be a useful feature. I believe it is going to be built into portage sometime in the future, but it could probably be implemented here. I'll let you know.

Quote:

I agree that this script should certainly get featured on GNN, makes updating simpler and more specialized to peoples needs.

Thanks for all the helpful feedback everyone, it makes doing stuff like this very enjoyable. _________________"We must all hang together, or assuredly we shall all hang separately."
-Ben Franklin

I believe --newuse also implies --update. Of course, you can always add additional parameters such as -D to catch more packages. I added --newuse to the update-world script on my system and it works fine.

this is looking good for me too.
please instruct how do i install and run this .
which script do i download and how i can use it?
i need codes for full proceedure.
i am still newbee for these operations._________________reach out a little bit more to catch it (DON'T BELIEVE the advocate part under my user name)

that was pretty easy
and it works noww.
i am due for world update in 2 days.
i will post the result , thanks for direction ryker _________________reach out a little bit more to catch it (DON'T BELIEVE the advocate part under my user name)

I believe --newuse also implies --update. Of course, you can always add additional parameters such as -D to catch more packages. I added --newuse to the update-world script on my system and it works fine.

Done!
I tested it also, and seems to work well.
Version 1.4 now reflects these changes. The script above and the download link are updated._________________"We must all hang together, or assuredly we shall all hang separately."
-Ben Franklin

i will finish emerge of jdk and stop the emerge -Du world and try again.
ymessenger is full masked and i have the latest version installed. so it can skip this file
lets see after i finish this jdk emerge,_________________reach out a little bit more to catch it (DON'T BELIEVE the advocate part under my user name)

The script version 1.5 (second one tonight ) properly handles "Fetch Restriction" now, prompting you to download the sources before continuing._________________"We must all hang together, or assuredly we shall all hang separately."
-Ben Franklin