I have a dualCPU machine, but I have MAKEOPTS="-j1" in /etc/make.conf because I don't want heavy builds to eat all available CPU power. I think get_number_of_jobs should not set a new MAKEOPTS if the admin already have set MAKEOPTS in /etc/make.conf.
nall: you wrote this code, i guess its up to you if this suggestion is invalid in terms of what you are trying to accomplish with the function
az, this function is from the mozilla build. this is really your call.
while I was working on bug 13578 I noticed that this function set the number of jobs to 2 * the number of processors while the comment in /etc/make.conf suggests CPUs + 1. For a single processor CPUs * 2 == CPUs + 1, but for multiple processors this doesn't hold. In any case it would be good for the comment and the value calculated by get_number_of_jobs to agree, and my $0.02 is that if the user has a -j option in their MAKEOPTS we should not change it.
Note that in eutils.eclass the -j parameter is pulled out with a sed -e 's:-j[0-9]*::g'` - GNU make is happy to use MAKEOPTS="-j 2" Might it be reasonable to prepend the calculated value for the -j flag to $MAKEOPTS, that way if the user has specified on GNU make will use it - the man page says: -j jobs Specifies the number of jobs (commands) to run simultaneously. If there is more than one -j option, the last one is effective. If the -j option is given without an argument, make will not limit the number of jobs that can run simultaneously. So if the user has set MAKEOPTS and you don't remove the -j then # user says MAKEOPTS='-j 1' # eutils.eclass thinks we can do 2 jobs, so says # $jobs=2 export MAKEOPTS="-j{$jobs} ${MAKEOPTS}" so make sees MAKEOPTS="-j2 -j 1" and uses the user's -j 1.
I think the point is being missed here. Why mozilla and one or two other builds use this, is because they fail if jobs are set too high for amount of cpu's. I thus *want* to override the users -j. If you do not like it, create a eutils.eclass with empty (or at least echo) in that function in your portage overlay, but then do not bugreport, or at least, try whatever with -j1 first before you do so ....
Created attachment 7395 [details, diff] check if MAKEOPTS is from /etc/make.conf. From 'Gentoo Linux Developers HOWTO': "emake runs a parallell make. some projects cannot be made in parallell; use make" But, I see why you want to build mozilla in as much parallellism as possible. The thing I don't like is raising the parallellism above the level set by the administrator. My suggestion is to check whether MAKEOPTS is from make.globals or make.conf, if MAKEOPTS is from make.conf, don't raise it. Its always better not to surprise the user too much :) Quick and dirty patch :) A few quick tests shows expected behaviour.
I can live with that. Fixed on CVS, thanks.