[46999] trunk/base/src/port/port.tcl

raimue at macports.org raimue at macports.org
Thu Feb 19 07:44:04 PST 2009


Revision: 46999
          http://trac.macports.org/changeset/46999
Author:   raimue at macports.org
Date:     2009-02-19 07:44:03 -0800 (Thu, 19 Feb 2009)
Log Message:
-----------
port/port.tcl:
Allow current pseudo-port to be used with 'port variants' and 'port notes',
use the passed porturl instead of mportsearch if possible.

Modified Paths:
--------------
    trunk/base/src/port/port.tcl

Modified: trunk/base/src/port/port.tcl
===================================================================
--- trunk/base/src/port/port.tcl	2009-02-19 14:54:06 UTC (rev 46998)
+++ trunk/base/src/port/port.tcl	2009-02-19 15:44:03 UTC (rev 46999)
@@ -1706,24 +1706,23 @@
     }
 
     foreachport $portlist {
-        # Search for the port.
-        if {[catch {mportsearch $portname no exact} result]} {
-            ui_debug $::errorInfo
-            break_softcontinue "The search for '$portname' failed: $result" \
-                               1 status
+        if {$porturl eq ""} {
+            # Search for the port.
+            if {[catch {mportsearch $portname no exact} result]} {
+                ui_debug $::errorInfo
+                break_softcontinue "The search for '$portname' failed: $result" \
+                                1 status
+            }
+            if {[llength $result] < 2} {
+                break_softcontinue "The port '$portname' was not found" 1 status
+            }
+
+            # Retrieve the port's URL.
+            array unset portinfo
+            array set portinfo [lindex $result 1]
+            set porturl $portinfo(porturl)
         }
-        if {[llength $result] < 2} {
-            break_softcontinue "The port '$portname' was not found" 1 status
-        }
 
-        # Retrieve the port's URL.
-        array unset portinfo
-        array set portinfo [lindex $result 1]
-        set porturl $portinfo(porturl)
-
-        # Retrieve the port's name once more to ensure it has the proper case.
-        set portname $portinfo(name)
-
         # Open the Portfile associated with this port.
         if {[catch {set mport [mportopen $porturl [array get options] \
                                          [array get merged_variations]]} \
@@ -1736,6 +1735,8 @@
         if {[catch {set portnotes [_mportkey $mport portnotes]}]} {
             set portnotes {}
         }
+        # Retrieve the port's name once more to ensure it has the proper case.
+        set portname [_mportkey $mport portname]
         mportclose $mport
 
         # Display the notes.
@@ -2284,22 +2285,23 @@
         return 1
     }
     foreachport $portlist {
-        # search for port
-        if {[catch {mportsearch $portname no exact} result]} {
-            global errorInfo
-            ui_debug "$errorInfo"
-            break_softcontinue "search for portname $portname failed: $result" 1 status
+        if {$porturl eq ""} {
+            # search for port
+            if {[catch {mportsearch $portname no exact} result]} {
+                global errorInfo
+                ui_debug "$errorInfo"
+                break_softcontinue "search for portname $portname failed: $result" 1 status
+            }
+            if {[llength $result] < 2} {
+                break_softcontinue "Port $portname not found" 1 status
+            }
+
+            array unset portinfo
+            array set portinfo [lindex $result 1]
+
+            set porturl $portinfo(porturl)
+            set portdir $portinfo(portdir)
         }
-        if {[llength $result] < 2} {
-            break_softcontinue "Port $portname not found" 1 status
-        }
-    
-        array unset portinfo
-        array set portinfo [lindex $result 1]
-        # set portname again since the one we were passed may not have had the correct case
-        set portname $portinfo(name)
-        set porturl $portinfo(porturl)
-        set portdir $portinfo(portdir)
 
         if {!([info exists options(ports_variants_index)] && $options(ports_variants_index) eq "yes")} {
             if {[catch {set mport [mportopen $porturl [array get options] [array get variations]]} result]} {
@@ -2316,7 +2318,10 @@
             ui_warn "port variants --index does not work with 'current' pseudo-port"
             continue
         }
-    
+
+        # set portname again since the one we were passed may not have had the correct case
+        set portname $portinfo(name)
+
         # if this fails the port doesn't have any variants
         if {![info exists portinfo(variants)]} {
             puts "$portname has no variants"
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/macports-changes/attachments/20090219/0b957391/attachment.html>


More information about the macports-changes mailing list