[33679] trunk/base/src/port1.0/portlint.tcl

raimue at macports.org raimue at macports.org
Sat Feb 2 17:51:44 PST 2008


Revision: 33679
          http://trac.macosforge.org/projects/macports/changeset/33679
Author:   raimue at macports.org
Date:     2008-02-02 17:51:42 -0800 (Sat, 02 Feb 2008)

Log Message:
-----------
port1.0/portutil.tcl:
port lint warns on illegal named variants, closes #14147

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

Modified: trunk/base/src/port1.0/portlint.tcl
===================================================================
--- trunk/base/src/port1.0/portlint.tcl	2008-02-03 01:40:27 UTC (rev 33678)
+++ trunk/base/src/port1.0/portlint.tcl	2008-02-03 01:51:42 UTC (rev 33679)
@@ -379,16 +379,33 @@
         if {![info exists variantname] || $variantname == ""} {
             ui_error "Variant number $variantnumber does not have a name"
             incr errors
-        } elseif {![info exists variantdesc] || $variantdesc == ""} {
-            ui_info "OK: Found variant: $variantname"
-            # don't warn about missing descriptions for global variants
-            if {[lsearch -exact $local_variants $variantname] != -1 &&
-                [lsearch -exact $lint_variants $variantname] == -1} {
-                ui_warn "Variant $variantname does not have a description"
-                incr warnings
+        } else {
+            set name_ok true
+            set desc_ok true
+
+            if {![regexp {^[A-Za-z0-9_]+$} $variantname]} {
+                ui_error "Variant $variantname is named illegal, use \[A-Za-z0-9_\]+ only"
+                incr errors
+                set name_ok false
             }
-        } else {
-            ui_info "OK: Found variant $variantname: $variantdesc"
+
+            if {![info exists variantdesc] || $variantdesc == ""} {
+                # don't warn about missing descriptions for global variants
+                if {[lsearch -exact $local_variants $variantname] != -1 &&
+                    [lsearch -exact $lint_variants $variantname] == -1} {
+                    ui_warn "Variant $variantname does not have a description"
+                    incr warnings
+                    set desc_ok false
+                }
+            }
+
+            if {$name_ok} {
+                if {$desc_ok} {
+                    ui_info "OK: Found variant $variantname: $variantdesc"
+                } else {
+                    ui_info "OK: Found variant: $variantname"
+                }
+            }
         }
         incr variantnumber
     }

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


More information about the macports-changes mailing list