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

Diff of /eclass/eutils.eclass

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

Revision 1.391 Revision 1.392
1# Copyright 1999-2012 Gentoo Foundation 1# Copyright 1999-2012 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/eutils.eclass,v 1.391 2012/04/20 19:35:37 vapier Exp $ 3# $Header: /var/cvsroot/gentoo-x86/eclass/eutils.eclass,v 1.392 2012/05/11 14:22:01 vapier Exp $
4 4
5# @ECLASS: eutils.eclass 5# @ECLASS: eutils.eclass
6# @MAINTAINER: 6# @MAINTAINER:
7# base-system@gentoo.org 7# base-system@gentoo.org
8# @BLURB: many extra (but common) functions that are used in ebuilds 8# @BLURB: many extra (but common) functions that are used in ebuilds
1312 1312
1313# @FUNCTION: makeopts_jobs 1313# @FUNCTION: makeopts_jobs
1314# @USAGE: [${MAKEOPTS}] 1314# @USAGE: [${MAKEOPTS}]
1315# @DESCRIPTION: 1315# @DESCRIPTION:
1316# Searches the arguments (defaults to ${MAKEOPTS}) and extracts the jobs number 1316# Searches the arguments (defaults to ${MAKEOPTS}) and extracts the jobs number
1317# specified therein. Useful for running non-make tools in parallel too.
1317# specified therein. i.e. if the user has MAKEOPTS=-j9, this will show "9". 1318# i.e. if the user has MAKEOPTS=-j9, this will show "9".
1318# We can't return the number as bash normalizes it to [0, 255]. If the flags 1319# We can't return the number as bash normalizes it to [0, 255]. If the flags
1319# haven't specified a -j flag, then "1" is shown as that is the default `make` 1320# haven't specified a -j flag, then "1" is shown as that is the default `make`
1320# uses. Useful for running non-make tools in parallel too. 1321# uses. Since there's no way to represent infinity, we return 999 if the user
1322# has -j without a number.
1321makeopts_jobs() { 1323makeopts_jobs() {
1322 [[ $# -eq 0 ]] && set -- ${MAKEOPTS} 1324 [[ $# -eq 0 ]] && set -- ${MAKEOPTS}
1323 local x jobs 1325 # This assumes the first .* will be more greedy than the second .*
1324 for x ; do [[ ${x} == -j* ]] && jobs=${x#-j} ; done 1326 # since POSIX doesn't specify a non-greedy match (i.e. ".*?").
1327 local jobs=$(echo " $* " | sed -r -n \
1328 -e 's:.*[[:space:]](-j|--jobs[=[:space:]])[[:space:]]*([0-9]+).*:\2:p' \
1329 -e 's:.*[[:space:]](-j|--jobs)[[:space:]].*:999:p')
1325 echo ${jobs:-1} 1330 echo ${jobs:-1}
1326} 1331}
1327 1332
1328check_license() { die "you no longer need this as portage supports ACCEPT_LICENSE itself"; } 1333check_license() { die "you no longer need this as portage supports ACCEPT_LICENSE itself"; }
1329 1334

Legend:
Removed from v.1.391  
changed lines
  Added in v.1.392

  ViewVC Help
Powered by ViewVC 1.1.20