Gentoo Archives: gentoo-commits

From: "Mike Frysinger (vapier)" <vapier@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] gentoo-x86 commit in eclass: multiprocessing.eclass
Date: Thu, 28 Nov 2013 20:49:20
Message-Id: 20131128204914.5AF0E2004B@flycatcher.gentoo.org
1 vapier 13/11/28 20:49:14
2
3 Modified: multiprocessing.eclass
4 Log:
5 add a makeopts_loadavg helper to extract --load-average # from $MAKEOPTS #490620 by M.B.
6
7 Revision Changes Path
8 1.4 eclass/multiprocessing.eclass
9
10 file : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/eclass/multiprocessing.eclass?rev=1.4&view=markup
11 plain: http://sources.gentoo.org/viewvc.cgi/gentoo-x86/eclass/multiprocessing.eclass?rev=1.4&content-type=text/plain
12 diff : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/eclass/multiprocessing.eclass?r1=1.3&r2=1.4
13
14 Index: multiprocessing.eclass
15 ===================================================================
16 RCS file: /var/cvsroot/gentoo-x86/eclass/multiprocessing.eclass,v
17 retrieving revision 1.3
18 retrieving revision 1.4
19 diff -u -r1.3 -r1.4
20 --- multiprocessing.eclass 12 Oct 2013 21:12:48 -0000 1.3
21 +++ multiprocessing.eclass 28 Nov 2013 20:49:14 -0000 1.4
22 @@ -1,6 +1,6 @@
23 # Copyright 1999-2013 Gentoo Foundation
24 # Distributed under the terms of the GNU General Public License v2
25 -# $Header: /var/cvsroot/gentoo-x86/eclass/multiprocessing.eclass,v 1.3 2013/10/12 21:12:48 vapier Exp $
26 +# $Header: /var/cvsroot/gentoo-x86/eclass/multiprocessing.eclass,v 1.4 2013/11/28 20:49:14 vapier Exp $
27
28 # @ECLASS: multiprocessing.eclass
29 # @MAINTAINER:
30 @@ -55,6 +55,25 @@
31 echo ${jobs:-1}
32 }
33
34 +# @FUNCTION: makeopts_loadavg
35 +# @USAGE: [${MAKEOPTS}]
36 +# @DESCRIPTION:
37 +# Searches the arguments (defaults to ${MAKEOPTS}) and extracts the value set
38 +# for load-average. For make and ninja based builds this will mean new jobs are
39 +# not only limited by the jobs-value, but also by the current load - which might
40 +# get excessive due to I/O and not just due to CPU load.
41 +# Be aware that the returned number might be a floating-point number. Test
42 +# whether your software supports that.
43 +makeopts_loadavg() {
44 + [[ $# -eq 0 ]] && set -- ${MAKEOPTS}
45 + # This assumes the first .* will be more greedy than the second .*
46 + # since POSIX doesn't specify a non-greedy match (i.e. ".*?").
47 + local lavg=$(echo " $* " | sed -r -n \
48 + -e 's:.*[[:space:]](-l|--load-average[=[:space:]])[[:space:]]*([0-9]+|[0-9]+\.[0-9]+)[^0-9.]*:\2:p' \
49 + -e 's:.*[[:space:]](-l|--load-average)[[:space:]].*:999:p')
50 + echo ${lavg:-1}
51 +}
52 +
53 # @FUNCTION: multijob_init
54 # @USAGE: [${MAKEOPTS}]
55 # @DESCRIPTION: