multiprocessing.eclass: make loadavg regex work for float values
authorMike Gilbert <floppym@gentoo.org>
Mon, 11 Sep 2017 03:18:56 +0000 (23:18 -0400)
committerMike Gilbert <floppym@gentoo.org>
Thu, 14 Sep 2017 19:05:32 +0000 (15:05 -0400)
Bug: https://bugs.gentoo.org/630626

eclass/multiprocessing.eclass

index 50368e35ea93eebbb8ed1db41f603833427fd8d8..b6e92976f73ebd1121cfadf33d596efb0e2cb3b2 100644 (file)
@@ -120,7 +120,7 @@ makeopts_loadavg() {
        # This assumes the first .* will be more greedy than the second .*
        # since POSIX doesn't specify a non-greedy match (i.e. ".*?").
        local lavg=$(echo " $* " | sed -r -n \
-               -e 's:.*[[:space:]](-[a-z]*l|--(load-average|max-load)[=[:space:]])[[:space:]]*([0-9]+|[0-9]+\.[0-9]+).*:\3:p' \
+               -e 's:.*[[:space:]](-[a-z]*l|--(load-average|max-load)[=[:space:]])[[:space:]]*([0-9]+(\.[0-9]+)?)[[:space:]].*:\3:p' \
                -e "s:.*[[:space:]](-[a-z]*l|--(load-average|max-load))[[:space:]].*:${2:-999}:p")
        # Default to ${inf} since the default is to not use a load limit.
        echo ${lavg:-${2:-999}}