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

source_changes at macosforge.org source_changes at macosforge.org
Thu Sep 13 10:50:48 PDT 2007


Revision: 29043
          http://trac.macosforge.org/projects/macports/changeset/29043
Author:   afb at macports.org
Date:     2007-09-13 10:50:48 -0700 (Thu, 13 Sep 2007)

Log Message:
-----------
lint variants and their descriptions

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

Modified: trunk/base/src/port1.0/portlint.tcl
===================================================================
--- trunk/base/src/port1.0/portlint.tcl	2007-09-13 17:43:04 UTC (rev 29042)
+++ trunk/base/src/port1.0/portlint.tcl	2007-09-13 17:50:48 UTC (rev 29043)
@@ -90,7 +90,13 @@
 	"use_configure" \
 	]
 
+set lint_variants [list \
+	"universal" \
+	"docs" \
+	"x11" \
+	]
 
+
 proc seems_utf8 {str} {
     set len [string length $str]
     for {set i 0} {$i<$len} {incr i} {
@@ -146,6 +152,8 @@
     set seen_portgroup false
     set in_description false
 
+    set local_variants [list]
+
     set f [open $portfile RDONLY]
     # read binary (to check UTF-8)
     fconfigure $f -encoding binary
@@ -234,6 +242,13 @@
             set require_blank false
         }
 
+        if {[string match "variant*" $line]} {
+            regexp {variant\s+(\w+)} $line -> variantname
+            if {[info exists variantname]} {
+                 lappend local_variants $variantname
+            }
+        }
+
         ### TODO: more checks to Portfile syntax
 
         incr lineno
@@ -245,9 +260,11 @@
     global portversion portrevision portepoch
     # hoping for "noarch" :
     set portarch ${os.arch}
-    global description long_description categories maintainers platforms homepage master_sites checksums
+    global description long_description platforms categories all_variants
+    global maintainers homepage master_sites checksums
     
-    global lint_portsystem lint_platforms lint_categories lint_required lint_optional
+    global lint_portsystem lint_platforms lint_categories 
+    global lint_required lint_optional lint_variants
 
     if (!$seen_portsystem) {
         ui_error "Didn't find PortSystem specification"
@@ -328,6 +345,27 @@
         incr errors
     }
 
+    set variantnumber 1
+    foreach variant $all_variants {
+        set variantname [ditem_key $variant name] 
+        set variantdesc [lindex [ditem_key $variant description] 0]
+        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 {
+            ui_info "OK: Found variant $variantname: $variantdesc"
+        }
+        incr variantnumber
+    }
+
     if {[string match "*darwinports at opendarwin.org*" $maintainers]} {
         ui_warn "Using legacy email for no/open maintainer"
         incr warnings

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


More information about the macports-changes mailing list