[146715] trunk/base/src/port1.0/portbuild.tcl
cal at macports.org
cal at macports.org
Tue Mar 15 10:49:10 PDT 2016
Revision: 146715
https://trac.macports.org/changeset/146715
Author: cal at macports.org
Date: 2016-03-15 10:49:10 -0700 (Tue, 15 Mar 2016)
Log Message:
-----------
port1.0: Make portbuild signal-safe
Additionally, switch memory-computations in portbuild::build_getjobs to powers
of 1024, since that's what sysctl returns.
Modified Paths:
--------------
trunk/base/src/port1.0/portbuild.tcl
Modified: trunk/base/src/port1.0/portbuild.tcl
===================================================================
--- trunk/base/src/port1.0/portbuild.tcl 2016-03-15 17:35:59 UTC (rev 146714)
+++ trunk/base/src/port1.0/portbuild.tcl 2016-03-15 17:49:10 UTC (rev 146715)
@@ -134,14 +134,20 @@
set jobs $buildmakejobs
# if set to '0', use the number of cores for the number of jobs
if {$jobs == 0} {
- if {[catch {set jobs [sysctl hw.activecpu]}] || [catch {set memsize [sysctl hw.memsize]}]} {
- set jobs 2
+ try -pass_signal {
+ set jobs [sysctl hw.activecpu]
+ } catch {{*} eCode eMessage} {
ui_warn "failed to determine the number of available CPUs (probably not supported on this platform)"
ui_warn "defaulting to $jobs jobs, consider setting buildmakejobs to a nonzero value in macports.conf"
+ set jobs 2
}
- if {[info exists memsize] && $jobs > $memsize / 1000000000 + 1} {
- set jobs [expr {$memsize / 1000000000 + 1}]
- }
+
+ try -pass_signal {
+ set memsize [sysctl hw.memsize]
+ if {$jobs > $memsize / (1024 * 1024 * 1024) + 1} {
+ set jobs [expr {$memsize / (1024 * 1024 * 1024) + 1}]
+ }
+ } catch {*} {}
}
if {![string is integer -strict $jobs] || $jobs <= 1} {
set jobs 1
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.macosforge.org/pipermail/macports-changes/attachments/20160315/006621b2/attachment.html>
More information about the macports-changes
mailing list