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

raimue at macports.org raimue at macports.org
Thu Jul 30 05:42:12 PDT 2015


Revision: 139042
          https://trac.macports.org/changeset/139042
Author:   raimue at macports.org
Date:     2015-07-30 05:42:12 -0700 (Thu, 30 Jul 2015)
Log Message:
-----------
port1.0/portlint.tcl: Validate port names in replaced_by and conflicts

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

Modified: trunk/base/src/port1.0/portlint.tcl
===================================================================
--- trunk/base/src/port1.0/portlint.tcl	2015-07-30 10:05:54 UTC (rev 139041)
+++ trunk/base/src/port1.0/portlint.tcl	2015-07-30 12:42:12 UTC (rev 139042)
@@ -341,7 +341,7 @@
            maintainers license homepage master_sites checksums patchfiles \
            depends_fetch depends_extract depends_lib depends_build \
            depends_run distfiles fetch.type lint_portsystem lint_platforms \
-           lint_required lint_optional
+           lint_required lint_optional replaced_by conflicts
     set portarch [get_canonical_archs]
 
     if (!$seen_portsystem) {
@@ -538,6 +538,45 @@
         }
     }
 
+    if {[info exists replaced_by]} {
+        if {[regexp {[^[:alnum:]_.-]} $replaced_by]} {
+            ui_error "replaced_by should be a single port name, invalid value: $replaced_by"
+            incr errors
+        } else {
+            if {[catch {set res [mport_lookup $replaced_by]} error]} {
+                global errorInfo
+                ui_debug "$errorInfo"
+            }
+            if {$res eq ""} {
+                ui_error "replaced_by references unknown port: $replaced_by"
+                incr errors
+            } else {
+                ui_info "OK: replaced_by $replaced_by"
+            }
+        }
+    }
+
+    if {[info exists conflicts]} {
+        foreach cport $conflicts {
+            if {[regexp {[^[:alnum:]_.-]} $cport]} {
+                ui_error "conflicts lists invalid value, should be port name: $cport"
+                incr errors
+                continue
+            }
+            if {[catch {set res [mport_lookup $cport]} error]} {
+                global errorInfo
+                ui_debug "$errorInfo"
+                continue
+            }
+            if {$res eq ""} {
+                ui_error "conflicts references unknown port: $cport"
+                incr errors
+            } else {
+                ui_info "OK: conflicts $cport"
+            }
+        }
+    }
+
     if {[regexp "^(.+)nomaintainer(@macports.org)?(.+)$" $maintainers] } {
         ui_error "Using nomaintainer together with other maintainer"
         incr errors
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.macosforge.org/pipermail/macports-changes/attachments/20150730/66133787/attachment.html>


More information about the macports-changes mailing list