Changeset 112784


Ignore:
Timestamp:
Oct 31, 2013, 11:30:03 PM (6 years ago)
Author:
ryandesign@…
Message:

compiler_blacklist_versions-1.0.tcl: catch errors running compiler when checking its version; this prevents ports from mysteriously disappearing from the portindex if users have not agreed to the Xcode license agreement (#40967, #40977); use eq for string comparisons

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/dports/_resources/port1.0/group/compiler_blacklist_versions-1.0.tcl

    r103031 r112784  
    22# $Id$
    33#
    4 # Copyright (c) 2012 The MacPorts Project
     4# Copyright (c) 2012-2013 The MacPorts Project
    55# All rights reserved.
    66#
     
    6262
    6363proc compiler_blacklist_versions._set_compiler_blacklist {option action args} {
    64     if {"set" != ${action}} return
     64    if {${action} ne "set"} return
    6565    foreach blacklist [option ${option}] {
    6666        if {[llength ${blacklist}] > 1} {
     
    7070            set compiler_version [compiler_blacklist_versions._get_compiler_version ${compiler}]
    7171            if {[compiler_blacklist_versions._matches_all_versions ${compiler} ${comparisons}]} {
    72                 if {[string equal ${compiler_version} ""]} {
    73                     ui_debug "compiler ${compiler} blacklisted because not installed"
     72                if {${compiler_version} eq ""} {
     73                    ui_debug "compiler ${compiler} blacklisted because it's not installed or it doesn't work"
    7474                } else {
    75                     ui_debug "compiler ${compiler} ${compiler_version} blacklisted because matches {${blacklist}}"
     75                    ui_debug "compiler ${compiler} ${compiler_version} blacklisted because it matches {${blacklist}}"
    7676                }
    7777                compiler.blacklist-append ${compiler}
    7878            } else {
    79                 ui_debug "compiler ${compiler} ${compiler_version} not blacklisted because does not match {${blacklist}}"
     79                ui_debug "compiler ${compiler} ${compiler_version} not blacklisted because it doesn't match {${blacklist}}"
    8080            }
    8181        }
     
    100100proc compiler_blacklist_versions._version_matches {compiler comparison_operator test_version} {
    101101    set actual_version [compiler_blacklist_versions._get_compiler_version ${compiler}]
    102     if {[string equal ${actual_version} ""]} {
     102    if {${actual_version} eq ""} {
    103103        return 1
    104104    }
     
    129129    set cc [portconfigure::configure_get_compiler cc ${compiler}]
    130130    if {![file exists ${cc}]} return
    131     regexp ${re} [exec ${cc} -v 2>@1] -> compiler_version
     131    if {[catch {regexp ${re} [exec ${cc} -v 2>@1] -> compiler_version}]} return
    132132    if {![info exists compiler_version]} {
    133133        return -code error "couldn't determine build number of compiler \"${compiler}\""
Note: See TracChangeset for help on using the changeset viewer.