[25147] trunk/base/src/port

source_changes at macosforge.org source_changes at macosforge.org
Mon May 14 21:41:29 PDT 2007


Revision: 25147
          http://trac.macosforge.org/projects/macports/changeset/25147
Author:   jberry at macports.org
Date:     2007-05-14 21:41:28 -0700 (Mon, 14 May 2007)

Log Message:
-----------
Add support for descriptions on variants:

 * The syntax follows the syntax for variant depends, etc.
 * Descriptions for variants are entirely optional
 * The change to the portindex format to allow variant descriptions
   should be backwards compatible. Variant descriptions are stored,
   keyed by the variant name, in a new portinfo array named "variant_desc".
   
   
Example:

	variant myvariant description "This variant does this and that" {
		configure.args-append   --do-this --do-that
	}
	

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

Modified: trunk/base/src/port/port.tcl
===================================================================
--- trunk/base/src/port/port.tcl	2007-05-15 04:33:07 UTC (rev 25146)
+++ trunk/base/src/port/port.tcl	2007-05-15 04:41:28 UTC (rev 25147)
@@ -1239,16 +1239,26 @@
 				if {[info exists portinfo(revision)] && $portinfo(revision) > 0} { 
 					puts -nonewline ", Revision $portinfo(revision)" 
 				}
-				puts -nonewline ", $portinfo(portdir)" 
+				puts ", $portinfo(portdir)" 
+				
 				if {[info exists portinfo(variants)]} {
-					puts -nonewline " (Variants: "
+					if {[info exists portinfo(variant_desc)]} {
+						array set descs $portinfo(variant_desc)
+					} else {
+						array set descs ""
+					}
+					puts "Variants:"
 					for {set i 0} {$i < [llength $portinfo(variants)]} {incr i} {
-						if {$i > 0} { puts -nonewline ", " }
-						puts -nonewline "[lindex $portinfo(variants) $i]"
+						set v [lindex $portinfo(variants) $i]
+						if {[info exists descs($v)]} {
+							puts " - $v: $descs($v)"
+						} else {
+							puts " - $v"
+						}
 					}
-					puts -nonewline ")"
 				}
 				puts ""
+				
 				if {[info exists portinfo(homepage)]} { 
 					puts "$portinfo(homepage)"
 				}

Modified: trunk/base/src/port1.0/portutil.tcl
===================================================================
--- trunk/base/src/port1.0/portutil.tcl	2007-05-15 04:33:07 UTC (rev 25146)
+++ trunk/base/src/port1.0/portutil.tcl	2007-05-15 04:41:28 UTC (rev 25147)
@@ -367,9 +367,10 @@
     set mode "provides"
     foreach arg $args {
 	switch -exact $arg {
-	    provides { set mode "provides" }
-	    requires { set mode "requires" }
-	    conflicts { set mode "conflicts" }
+	    description -
+	    provides -
+	    requires -
+	    conflicts { set mode $arg }
 	    default { ditem_append $ditem $mode $arg }		
         }
     }
@@ -388,6 +389,10 @@
 		variant_remove_ditem $variant_provides
 	} else {
 	    lappend PortInfo(variants) $variant_provides
+	    set vdesc [join [ditem_key $ditem description]]
+	    if {$vdesc != ""} {
+		    lappend PortInfo(variant_desc) $variant_provides $vdesc
+		}
 	}
 
 	# Finally append the ditem to the dlist.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.macosforge.org/pipermail/macports-changes/attachments/20070514/a074464f/attachment.html


More information about the macports-changes mailing list