Changeset 118305


Ignore:
Timestamp:
Mar 29, 2014, 7:31:50 PM (6 years ago)
Author:
cal@…
Message:

base: Clean up error output to be more concise.

  • Remove "failed to install $portname" message. The failing port is mentioned earlier in the output and the user knows what port he was installing. Plus, it isn't really important which port the user initially wanted to install, it's important which one failed.
  • Shorten "Please see the log file for port $portname for details:" to a short one-line message and raise its message level to error so the output columns align nicely after a common "Error: " prefix.
  • Remove "The following dependencies were not installed: $list" completely, because it's not relevant -- the user probably wants to know (and should care) about the port that failed, not the dependencies that couldn't be installed because of that.
  • Shorten the ticket URL message to a simple one-liner.
  • Avoid cryptic messages like

"org.macports.activate for port xyz returned: $errstr"

in favor of

"Failed to activate xyz: $errstr"

  • Make the requested variants mismatch line align after a common "Error:" prefix. Ideally, this should be done using some presentational logic in port.tcl that uses some nice formatting heuristics to make the messages more readable, but this is still better than what we had before, IMO.
Location:
trunk/base/src
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/base/src/macports1.0/macports.tcl

    r118304 r118305  
    19731973        # An error occurred.
    19741974        global ::logenabled ::debuglogname
    1975         ui_error "Failed to install $portname"
    19761975        ui_debug $::errorInfo
    19771976        if {[info exists ::logenabled] && $::logenabled && [info exists ::debuglogname]} {
    1978             ui_notice "Please see the log file for port $portname for details:\n    $::debuglogname"
     1977            ui_error "See $::debuglogname for details."
    19791978        }
    19801979        macports::pop_log
     
    20602059
    20612060        if {$result ne {}} {
    2062             set errstring "The following dependencies were not installed:"
    2063             foreach ditem $result {
    2064                 append errstring " [ditem_key $ditem provides]"
    2065             }
    2066             ui_error $errstring
     2061            ##
     2062            # When this happens, the failing port usually already printed an
     2063            # error message. Omit this one to avoid cluttering the output and
     2064            # hiding the *real* problem.
     2065
     2066            #set errstring "The following dependencies were not installed:"
     2067            #foreach ditem $result {
     2068            #    append errstring " [ditem_key $ditem provides]"
     2069            #}
     2070            #ui_error $errstring
    20672071            foreach ditem $dlist {
    20682072                catch {mportclose $ditem}
     
    21022106    if {[info exists ::logenabled] && $::logenabled && [info exists ::debuglogname]} {
    21032107        if {$result != 0} {
    2104             ui_notice "Please see the log file for port $portname for details:\n    $::debuglogname"
     2108            ui_error "See $::debuglogname for details."
    21052109        }
    21062110        macports::pop_log
  • trunk/base/src/port/port.tcl

    r118304 r118305  
    246246proc print_tickets_url {args} {
    247247    if {${macports::prefix} ne "/usr/local" && ${macports::prefix} ne "/usr"} {
    248         ui_notice "To report a bug, follow the instructions in the guide:\n    http://guide.macports.org/#project.tickets"
     248        ui_error "Follow http://guide.macports.org/#project.tickets to report a bug."
    249249    }
    250250}
     
    41044104        }
    41054105    }
    4106    
     4106
    41074107    return $status
    41084108}
  • trunk/base/src/port1.0/portutil.tcl

    r117407 r118305  
    15811581            # - this step must be written to file
    15821582            if {$skipped == 0
    1583           && [ditem_key $ditem runtype] ne "always"
    1584           && [ditem_key $ditem state] ne "no"} {
    1585             write_statefile target $targetname $target_state_fd
     1583                && [ditem_key $ditem runtype] ne "always"
     1584                && [ditem_key $ditem state] ne "no"} {
     1585                write_statefile target $targetname $target_state_fd
    15861586            }
    15871587        } else {
    1588             ui_error "$targetname for port $portname returned: $errstr"
     1588            if {$errstr ne {}} {
     1589                ui_error "Failed to $target $portname: $errstr"
     1590            } else {
     1591                ui_error "Failed to $target $portname."
     1592            }
    15891593            ui_debug "Error code: $errcode"
    15901594            ui_debug "Backtrace: $errinfo"
     
    21332137        array set oldvariations {}
    21342138        if {[check_statefile_variants variations oldvariations $state_fd]} {
    2135             ui_error "Requested variants \"[canonicalize_variants [array get variations]]\" do not match original selection \"[canonicalize_variants [array get oldvariations]]\".\nPlease use the same variants again, perform 'port clean [option subport]' or specify the force option (-f)."
     2139            ui_error "Requested variants \"[canonicalize_variants [array get variations]]\" do not match original selection \"[canonicalize_variants [array get oldvariations]]\"."
     2140            ui_error "Please use the same variants again, perform 'port clean [option subport]' or specify the force option (-f)."
    21362141            set result 1
    21372142        } elseif {!([info exists ports_dryrun] && $ports_dryrun eq "yes")} {
Note: See TracChangeset for help on using the changeset viewer.