Ticket #18794: conflicts.diff

File conflicts.diff, 3.5 KB (added by blb@…, 16 years ago)

diff (in trunk/base)

  • src/port1.0/portmain.tcl

     
    4242
    4343# define options
    4444options prefix macportsuser name version revision epoch categories maintainers
    45 options long_description description homepage
     45options long_description description homepage conflicts
    4646options worksrcdir filesdir distname portdbpath libpath distpath sources_conf os.platform os.version os.major os.arch os.endian platforms default_variants install.user install.group macosx_deployment_target
    4747options universal_variant os.universal_supported
    4848
     
    7070default worksrcdir {$distname}
    7171default filespath {[file join $portpath $filesdir]}
    7272default worksrcpath {[file join $workpath $worksrcdir]}
     73default conflicts {}
    7374
    7475# Configure settings
    7576default macportsuser {${portutil::autoconf::macportsuser}}
  • src/macports1.0/macports.tcl

     
    13311331    }
    13321332}
    13331333
     1334### _mportconflictsinstalled is private; may change without notice
     1335
     1336# Determine if the port, per the conflicts option, has any conflicts with
     1337# what is installed.
     1338#
     1339# mport   the port to check for conflicts
     1340# Returns a list of which installed ports conflict, or an empty list if none
     1341proc _mportconflictsinstalled {mport} {
     1342    set conflictlist {}
     1343    set conflictinfo [_mportkey $mport conflicts]
     1344    if {[llength $conflictinfo] > 0} {
     1345        ui_debug "Checking for conflicts against [_mportkey $mport name]"
     1346        foreach conflictspec ${conflictinfo} {
     1347            switch -regex $conflictspec {
     1348                ^port:([-._A-Za-z0-9]+)$ {
     1349                    set conflict_portname [lindex [split $conflictspec :] end]
     1350                    set conflict_portinfo [mportlookup $conflict_portname]
     1351                    array set portinfo [lindex $conflict_portinfo 1]
     1352                    set conflict_port [mportopen $portinfo(porturl)]
     1353                    if {[string equal ${macports::registry.installtype} "image"]} {
     1354                        if {[_mportactive $conflict_port]} {
     1355                            lappend conflictlist $conflict_portname
     1356                        }
     1357                    } else {
     1358                        if {[_mportinstalled $conflict_port]} {
     1359                            lappend conflictlist $conflict_portname
     1360                        }
     1361                    }
     1362                }
     1363                default {
     1364                    return -code error [format [msgcat::mc "invalid conflictspec: %s"] $conflictspec]
     1365                }
     1366            }
     1367        }
     1368    } else {
     1369        ui_debug "[_mportkey $mport name] has no conflicts"
     1370    }
     1371
     1372    return $conflictlist
     1373}
     1374
     1375
    13341376### _mportexec is private; may change without notice
    13351377
    13361378proc _mportexec {target mport} {
     
    13881430        || $target == "rpm" || $target == "dpkg"
    13891431        || $target == "srpm"|| $target == "portpkg" } {
    13901432
     1433        set conflictports [_mportconflictsinstalled $mport]
     1434        if {[llength ${conflictports}] != 0} {
     1435            return -code error "Can't install [_mportkey $mport name] because conflicting ports are installed: ${conflictports}"
     1436        }
     1437
    13911438        ui_msg -nonewline "--->  Computing dependencies for [_mportkey $mport name]"
    13921439        if {[macports::ui_isset ports_debug]} {
    13931440            # play nice with debug messages