[46061] trunk/base

perry at macports.org perry at macports.org
Tue Jan 27 22:08:46 PST 2009


Revision: 46061
          http://trac.macports.org/changeset/46061
Author:   perry at macports.org
Date:     2009-01-27 22:08:46 -0800 (Tue, 27 Jan 2009)
Log Message:
-----------
base/src - Merged in branch to add new 'notes' action and keyword. (#421)

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

Property Changed:
----------------
    trunk/base/


Property changes on: trunk/base
___________________________________________________________________
Modified: svn:mergeinfo
   - /branches/variant-descs-14482/base:34469-34855,34900-37508,37511-37512,41040-41463,42575-42626,42640-42659
/users/perry/base-select:44044-44692
   + /branches/variant-descs-14482/base:34469-34855,34900-37508,37511-37512,41040-41463,42575-42626,42640-42659
/users/perry/base-bugs_and_notes:45682-46060
/users/perry/base-select:44044-44692

Modified: trunk/base/src/port/port.tcl
===================================================================
--- trunk/base/src/port/port.tcl	2009-01-28 05:52:23 UTC (rev 46060)
+++ trunk/base/src/port/port.tcl	2009-01-28 06:08:46 UTC (rev 46061)
@@ -1694,6 +1694,55 @@
 }
 
 
+proc action_notes { action portlist opts } {
+    if {[require_portlist portlist]} {
+        return 1
+    }
+
+    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 {[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]]} \
+                   result]} {
+            ui_debug $::errorInfo
+            break_softcontinue [concat "The URL '$porturl' could not be" \
+                                       "opened: $result"] 1 status
+        }
+        array unset portinfo
+        array set portinfo [mportinfo $mport]
+        mportclose $mport
+
+        # Display notes.
+        if {[info exists portinfo(notes)] && $portinfo(notes) ne {}} {
+            puts "$portname has the following notes:"
+            # Add indentation.
+            puts -nonewline "  "
+            puts [string map {\n "\n  "} $portinfo(notes)]
+        } else {
+            puts "$portname has no notes."
+        }
+    }
+}
+
+
 proc action_provides { action portlist opts } {
     # In this case, portname is going to be used for the filename... since
     # that is the first argument we expect... perhaps there is a better way
@@ -2810,6 +2859,7 @@
     \
     info        [list action_info           [action_args_const ports]] \
     location    [list action_location       [action_args_const ports]] \
+    notes       [list action_notes          [action_args_const ports]] \
     provides    [list action_provides       [action_args_const strings]] \
     \
     activate    [list action_activate       [action_args_const ports]] \

Modified: trunk/base/src/port1.0/portactivate.tcl
===================================================================
--- trunk/base/src/port1.0/portactivate.tcl	2009-01-28 05:52:23 UTC (rev 46060)
+++ trunk/base/src/port1.0/portactivate.tcl	2009-01-28 06:08:46 UTC (rev 46061)
@@ -49,7 +49,13 @@
 set_ui_prefix
 
 proc activate_main {args} {
-	global portname portversion portrevision portvariants user_options
+	global portname portversion portrevision portvariants user_options portnotes
 	registry_activate $portname ${portversion}_${portrevision}${portvariants} [array get user_options]
+
+    # Display notes at the end of the activation phase.
+    if {[info exists portnotes] && $portnotes ne {}} {
+        ui_msg \n$portnotes\n
+    }
+    
     return 0
 }

Modified: trunk/base/src/port1.0/portutil.tcl
===================================================================
--- trunk/base/src/port1.0/portutil.tcl	2009-01-28 05:52:23 UTC (rev 46060)
+++ trunk/base/src/port1.0/portutil.tcl	2009-01-28 06:08:46 UTC (rev 46061)
@@ -367,6 +367,15 @@
     }
 }
 
+# Notes are displayed at (1) the end of the activation phase and (2) when
+# action_notes is executed.
+proc notes {args} {
+    global PortInfo portnotes
+
+    set PortInfo(notes) [string trim [join $args]]
+    set portnotes       $PortInfo(notes)
+}
+
 # variant <provides> [<provides> ...] [requires <requires> [<requires>]]
 # Portfile level procedure to provide support for declaring variants
 proc variant {args} {
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/macports-changes/attachments/20090127/d348a92a/attachment.html>


More information about the macports-changes mailing list