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

raimue at macports.org raimue at macports.org
Wed Apr 29 16:00:15 PDT 2009


Revision: 50374
          http://trac.macports.org/changeset/50374
Author:   raimue at macports.org
Date:     2009-04-29 16:00:14 -0700 (Wed, 29 Apr 2009)
Log Message:
-----------
port1.0/portlint.tcl:
Make 'port lint' work properly with multiple PortGroups being used in one port.

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

Modified: trunk/base/src/port1.0/portlint.tcl
===================================================================
--- trunk/base/src/port1.0/portlint.tcl	2009-04-29 22:53:11 UTC (rev 50373)
+++ trunk/base/src/port1.0/portlint.tcl	2009-04-29 23:00:14 UTC (rev 50374)
@@ -122,6 +122,8 @@
     set seen_portgroup false
     set in_description false
 
+    array set portgroups {}
+
     set local_variants [list]
 
     set f [open $portfile RDONLY]
@@ -149,7 +151,7 @@
             incr errors
         }
 
-        if {[string equal "PortSystem" $require_after] && \
+        if {($require_after == "PortSystem" || $require_after == "PortGroup") && \
             [string match "PortGroup*" $line]} {
             set require_blank false
         }
@@ -200,15 +202,17 @@
             set require_after "PortSystem"
         }
         if {[string match "PortGroup*" $line]} {
-            if {$seen_portgroup} {
-                ui_error "Line $lineno repeats PortGroup information"
-                incr errors
-            }
             regexp {PortGroup\s+([a-z0-9]+)\s+([0-9.]+)} $line -> portgroup portgroupversion
             if {![info exists portgroup]} {
                 ui_error "Line $lineno has unrecognized PortGroup"
                 incr errors
             }
+            if {[info exists portgroups($portgroup)]} {
+                ui_error "Line $lineno repeats PortGroup information"
+                incr errors
+            } else {
+                set portgroups($portgroup) $portgroupversion
+            }
             set seen_portgroup true
             set require_blank true
             set require_after "PortGroup"
@@ -274,13 +278,17 @@
     } else {
         ui_info "OK: Found PortSystem $portsystem"
     }
-    if (!$seen_portgroup) {
-        # PortGroup is optional, so missing is OK
-    }  elseif {![file exists [getportresourcepath $porturl "port1.0/group/${portgroup}-${portgroupversion}.tcl"]]} {
-        ui_error "Unknown PortGroup: $portgroup-$portgroupversion"
-        incr errors
-    } else {
-        ui_info "OK: Found PortGroup $portgroup-$portgroupversion"
+
+    if ($seen_portgroup) {
+        # Using a PortGroup is optional
+        foreach {portgroup portgroupversion} [array get portgroups] {
+            if {![file exists [getportresourcepath $porturl "port1.0/group/${portgroup}-${portgroupversion}.tcl"]]} {
+                ui_error "Unknown PortGroup: $portgroup-$portgroupversion"
+                incr errors
+            } else {
+                ui_info "OK: Found PortGroup $portgroup-$portgroupversion"
+            }
+        }
     }
 
     foreach req_var $lint_required {
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/macports-changes/attachments/20090429/65ac55e1/attachment.html>


More information about the macports-changes mailing list