[51525] trunk/base/src/macports1.0/macports.tcl

jmr at macports.org jmr at macports.org
Wed May 27 04:47:13 PDT 2009


Revision: 51525
          http://trac.macports.org/changeset/51525
Author:   jmr at macports.org
Date:     2009-05-27 04:47:12 -0700 (Wed, 27 May 2009)
Log Message:
-----------
Add conflict checking during dependency calculation (#18794)

Modified Paths:
--------------
    trunk/base/src/macports1.0/macports.tcl

Modified: trunk/base/src/macports1.0/macports.tcl
===================================================================
--- trunk/base/src/macports1.0/macports.tcl	2009-05-27 11:15:23 UTC (rev 51524)
+++ trunk/base/src/macports1.0/macports.tcl	2009-05-27 11:47:12 UTC (rev 51525)
@@ -1326,6 +1326,30 @@
     }
 }
 
+### _mportconflictsinstalled is private; may change without notice
+
+# Determine if the port, per the conflicts option, has any conflicts with
+# what is installed.
+#
+# mport   the port to check for conflicts
+# Returns a list of which installed ports conflict, or an empty list if none
+proc _mportconflictsinstalled {mport conflictinfo} {
+    set conflictlist {}
+    if {[llength $conflictinfo] > 0} {
+        ui_debug "Checking for conflicts against [_mportkey $mport name]"
+        foreach conflictport ${conflictinfo} {
+            if {[_mportispresent $mport port:${conflictport}]} {
+                lappend conflictlist $conflictport
+            }
+        }
+    } else {
+        ui_debug "[_mportkey $mport name] has no conflicts"
+    }
+
+    return $conflictlist
+}
+
+
 ### _mportexec is private; may change without notice
 
 proc _mportexec {target mport} {
@@ -1959,6 +1983,17 @@
         ui_info -nonewline "."
         flush stdout
     }
+    
+    if {[info exists portinfo(conflicts)] && ($target == "" || $target == "install")} {
+        set conflictports [_mportconflictsinstalled $mport $portinfo(conflicts)]
+        if {[llength ${conflictports}] != 0} {
+            if {[macports::global_option_isset ports_force]} {
+                ui_warn "Force option set; installing $portinfo(name) despite conflicts with: ${conflictports}"
+            } else {
+                return -code error "Can't install $portinfo(name) because conflicting ports are installed: ${conflictports}"
+            }
+        }
+    }
 
     # Determine deptypes to look for based on target
     switch $target {
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/macports-changes/attachments/20090527/909a5573/attachment.html>


More information about the macports-changes mailing list