[108310] trunk/base/src/port1.0

larryv at macports.org larryv at macports.org
Thu Jul 18 13:50:42 PDT 2013


Revision: 108310
          https://trac.macports.org/changeset/108310
Author:   larryv at macports.org
Date:     2013-07-18 13:50:41 -0700 (Thu, 18 Jul 2013)
Log Message:
-----------
portutil.tcl: Throw useful error from get_canonical_archflags to prevent
typos in Portfiles.

(See https://lists.macosforge.org/pipermail/macports-dev/2013-July/023392.html.)

Also update portconfigure to catch requests for nonexistent flag options
(e.g., configure.cppflags, configure.universal_f77flags).

Modified Paths:
--------------
    trunk/base/src/port1.0/portconfigure.tcl
    trunk/base/src/port1.0/portutil.tcl

Modified: trunk/base/src/port1.0/portconfigure.tcl
===================================================================
--- trunk/base/src/port1.0/portconfigure.tcl	2013-07-18 20:10:49 UTC (rev 108309)
+++ trunk/base/src/port1.0/portconfigure.tcl	2013-07-18 20:50:41 UTC (rev 108310)
@@ -742,7 +742,9 @@
         # add extra flags that are conditional on whether we're building universal
         eval [linsert [get_canonical_archflags cc] 0 append_to_environment_value configure CFLAGS]
         foreach tool {cxx objc objcxx cpp f77 f90 fc ld} {
-            set flags [get_canonical_archflags $tool]
+            if {[catch {get_canonical_archflags $tool} flags]} {
+                continue
+            }
             set env_var [string toupper $tool]FLAGS
             eval [linsert $flags 0 append_to_environment_value configure $env_var]
         }

Modified: trunk/base/src/port1.0/portutil.tcl
===================================================================
--- trunk/base/src/port1.0/portutil.tcl	2013-07-18 20:10:49 UTC (rev 108309)
+++ trunk/base/src/port1.0/portutil.tcl	2013-07-18 20:50:41 UTC (rev 108310)
@@ -2988,14 +2988,18 @@
 # returns the flags that should be passed to the compiler to choose arch(s)
 proc get_canonical_archflags {{tool cc}} {
     if {![variant_exists universal] || ![variant_isset universal]} {
-        set opt configure.${tool}_archflags
+        if {[catch {option configure.${tool}_archflags} flags]} {
+            return -code error "archflags do not exist for tool '$tool'"
+        }
     } else {
         if {$tool == "cc"} {
             set tool c
         }
-        set opt configure.universal_${tool}flags
+        if {[catch {option configure.universal_${tool}flags} flags]} {
+            return -code error "universal archflags do not exist for tool '$tool'"
+        }
     }
-    return [expr {[catch {option $opt} flags] ? {} : $flags}]
+    return $flags
 }
 
 # check that the selected archs are supported
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/macports-changes/attachments/20130718/2a854713/attachment.html>


More information about the macports-changes mailing list