/[gentoo-x86]/eclass/multiprocessing.eclass
Gentoo

Diff of /eclass/multiprocessing.eclass

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

Revision 1.3 Revision 1.4
1# Copyright 1999-2013 Gentoo Foundation 1# Copyright 1999-2013 Gentoo Foundation
2# Distributed under the terms of the GNU General Public License v2 2# Distributed under the terms of the GNU General Public License v2
3# $Header: /var/cvsroot/gentoo-x86/eclass/multiprocessing.eclass,v 1.3 2013/10/12 21:12:48 vapier Exp $ 3# $Header: /var/cvsroot/gentoo-x86/eclass/multiprocessing.eclass,v 1.4 2013/11/28 20:49:14 vapier Exp $
4 4
5# @ECLASS: multiprocessing.eclass 5# @ECLASS: multiprocessing.eclass
6# @MAINTAINER: 6# @MAINTAINER:
7# base-system@gentoo.org 7# base-system@gentoo.org
8# @AUTHOR: 8# @AUTHOR:
51 # since POSIX doesn't specify a non-greedy match (i.e. ".*?"). 51 # since POSIX doesn't specify a non-greedy match (i.e. ".*?").
52 local jobs=$(echo " $* " | sed -r -n \ 52 local jobs=$(echo " $* " | sed -r -n \
53 -e 's:.*[[:space:]](-j|--jobs[=[:space:]])[[:space:]]*([0-9]+).*:\2:p' \ 53 -e 's:.*[[:space:]](-j|--jobs[=[:space:]])[[:space:]]*([0-9]+).*:\2:p' \
54 -e 's:.*[[:space:]](-j|--jobs)[[:space:]].*:999:p') 54 -e 's:.*[[:space:]](-j|--jobs)[[:space:]].*:999:p')
55 echo ${jobs:-1} 55 echo ${jobs:-1}
56}
57
58# @FUNCTION: makeopts_loadavg
59# @USAGE: [${MAKEOPTS}]
60# @DESCRIPTION:
61# Searches the arguments (defaults to ${MAKEOPTS}) and extracts the value set
62# for load-average. For make and ninja based builds this will mean new jobs are
63# not only limited by the jobs-value, but also by the current load - which might
64# get excessive due to I/O and not just due to CPU load.
65# Be aware that the returned number might be a floating-point number. Test
66# whether your software supports that.
67makeopts_loadavg() {
68 [[ $# -eq 0 ]] && set -- ${MAKEOPTS}
69 # This assumes the first .* will be more greedy than the second .*
70 # since POSIX doesn't specify a non-greedy match (i.e. ".*?").
71 local lavg=$(echo " $* " | sed -r -n \
72 -e 's:.*[[:space:]](-l|--load-average[=[:space:]])[[:space:]]*([0-9]+|[0-9]+\.[0-9]+)[^0-9.]*:\2:p' \
73 -e 's:.*[[:space:]](-l|--load-average)[[:space:]].*:999:p')
74 echo ${lavg:-1}
56} 75}
57 76
58# @FUNCTION: multijob_init 77# @FUNCTION: multijob_init
59# @USAGE: [${MAKEOPTS}] 78# @USAGE: [${MAKEOPTS}]
60# @DESCRIPTION: 79# @DESCRIPTION:

Legend:
Removed from v.1.3  
changed lines
  Added in v.1.4

  ViewVC Help
Powered by ViewVC 1.1.20