https://bugs.gentoo.org/show_bug.cgi?id=147516
YOU SHOULD USE THE VERSION ATTACHED TO THE BUG.
01-28-2008: Updated to 2.1.4.
06-06-2007 : A fix for circular dependency related issues is added to the patch. The patch also includes a fix for world file related bug which was fixed on Apr 2 but only made it to bug attachment and NOT on my website. So, if you downloaded the patch from my website (comcast.net), please download again from BGO. Please download and apply.
Apply instructions:
***NOTE THAT VERSION NUMBER AND ATTACHMENT NUMBER WILL CHANGE in the following code piece from time to time. I will try to keep them updated but it doesn't hurt to verify against the bugdb. JUST ADD CC YOURSELF ON THE BUG AND YOU WILL GET AN EMAIL WHEN I PROVIDE A NEW FIX ***
Download the patch from the bugdb at https://bugs.gentoo.org/show_bug.cgi?id=147516 , emerge original and apply the patch on top.
Code: Select all
cd /tmp/
wget --output-document=portage.patch http://bugs.gentoo.org/attachment.cgi?id=142841
echo ">sys-apps/portage-2.1.4.1" >> /etc/portage/package.mask
emerge -1 "=sys-apps/portage-2.1.4.1"
echo "sys-apps/portage-2.1.4.1" >> /etc/portage/profile/package.provided
cd /usr/lib/portage
patch -p1 < /tmp/portage.patch03-25-2007 : There is an updated patch for portage-2.1.2.2 at https://bugs.gentoo.org/show_bug.cgi?id=147516 . Fixes two bugs reported in this thread.
02-23-2007 : There is an updated patch for portage-2.1.2-r10 at https://bugs.gentoo.org/show_bug.cgi?id=147516 . If you are testing, its easier to download the ebuild overlay from my page.
02-18-2007 : Patch and ebuild tar updated to 2.1.2-r9 (current stable portage version). Please test, but at your own risk. Also, read this page thoroughly before beginning.
EDIT: A new version is available for download and testing at https://bugs.gentoo.org/show_bug.cgi?id=147516 :
Can we get some testing please?
-devsk 09-13-2006
Consider some facts (motivation for doing parallel merges) before we start:
1. Configuration, link and merge phases of packages are essentially single threaded. So, a multi core or multi cpu system is using at the most 50% during these phases of the package install. These phases are also I/O intensive so cpu usage is even lower most of the time.
2. Many packages do MAKEOPTS=-j1 which makes them not use the cpu upto 100%.
3. Not all packages in the dependency list need to be merged in sequentially one after the other.
Given these facts, consider this simple example:
I am trying to install gentoolkit. Some of the dependencies are:
gentoolkit->portage->pycrypto->gmp
gentoolkit->perl
perl and gmp are not related to each other and can be emerged at the same time.
In general, the dep graph will always have nodes which are not related to each other. This is probably always true if you are doing an update on world where there is a variety of potentially unrelated packages being emerged. If we have multiple leaf nodes, and portage finds them, portage can start a separate build for each leaf node for upto a maximum, like 2 single and 3 for dual cpu, at a time. Once leaves are done it can proceed to the next level of unrelated packages.
So, I went ahead and put together a patch for portage (its on portage-2.1.1).
Please follow these simple steps to test it out: NOTE THAT VERSION NUMBERS WILL CHANGE. Modify appropriately.
Download the patch from the bugdb at https://bugs.gentoo.org/show_bug.cgi?id=147516 .
Put ">sys-apps/portage-2.1.2.7" into your /etc/portage/package.mask
emerge -1 "=sys-apps/portage-2.1.2.7"
cd /usr/lib/portage
patch -p1 < [patch location]
****** THE FOLLOWING INSTRUCTIONS ARE OLD*****************
1. Backup your system/install. I mean it! I haven't seen anything bad happen to my system from it, but s**t happens, so you are warned...
2. Goto: https://bugs.gentoo.org/show_bug.cgi?id=147516 and download the patch.
3. quickpkg portage to save the old install. (make sure you are at least 2.1 to begin with if using tbz2 and 2.1.1 if using the patch).
4. cp /usr/portage/sys-apps/portage into /usr/local/portage/sys-apps with:
Code: Select all
cd /usr/local/portage
\rm -rf /usr/local/portage/sys-apps/portage
cp -a /usr/portage/sys-apps/portage /usr/local/portage/sys-apps/
Or apply the patch against portage-2.1.1 by going to /usr/lib and patch < [localtion of downloaded patch]
5. test it out with some emerges (at least 2-3 on the cmdline) using --oneshot. FEATURES="parallel" enables the parallel feature and FEATURES="-parallel" disables it.
6. Make sure you put sys-apps/portage-2.1.1 (or the latest version in portag tree) in /etc/portage/profile/package.provided if you manually patched the portage or have synced the tree and have an upgrade available. This is to avoid getting your patched install being overwritten by the one in portage tree when you do an 'emerge -e system' for example.
For timing your results and reporting: It is best to use 'time FEATURES="parallel -ccache -distcc" emerge --oneshot <pkg1> <pkg2> <pkg3>' and then, 'time FEATURES="-parallel -ccache -distcc" emerge --oneshot <pkg1> <pkg2> <pkg3>' . Note the times. Repeat at least three times to rule out caching. genlop timings will not be useful because the packages individually may take slightly longer to emerge now.
The changes that you will see and and hopefully like are:
1. Parallel install of certain packages keeping your cpu pegged. note that it may not always be possible e.g. you want to emerge -O kdelibs kdebase...
2. The output is very concise if PORT_LOGDIR is set. Only important messages (like setup and post install messages which are currently lost in the garbage that flies by) are shown in the terminal, rest go to log files in /var/log/portage. I highly recommend setting it. If you don't, your configure/compile/install garbage will be thrown on the terminal as before. Less output on the terminal speeds up emerges a lot.
3. If a package fails, emerge doesn't stop immdiately. It will keep emerging as long as there are packages in the current slot to merge. It will stop after the current slot. A slot is like a level in the depgraph. All leaf nodes (packages which don't depend on anything) are at slot 0 (or 1). Next level packages are at slot 1, and so on. All packages at the same slot are not related to each other and can be emerged at the same time. In nutshell, portage will stop only when its absolutely impossible to proceed with any emerge.
Also, note that you will see some spurious looking merge slot related messages before the emerge starts. Don't worry they are telling you about which packages will be emerged at which slot. The emerging starts at slot 0 (if present, otherwise 1). I would like this output when you submit a problem. These will be removed when the patch becomes stable.
For the code reviewers: python is not my native language (I talk C). So, please make as many suggestions to improve the code as you can. I put this together real quick and I might have overlooked many things. So, please review and make suggestions.
Once I have ironed out basic problems, I will submit it for inclusion in official portage.





