Skip to content
Permalink
Browse files

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.

git-svn-id: https://svn.macports.org/repository/macports/trunk/base@118305 d073be05-634f-4543-b044-5fe20cf6d1d6
  • Loading branch information
neverpanic committed Mar 29, 2014
1 parent 8ac08e1 commit 03327ffe6624e95fab2e3c2b134879b278fe50cf
Showing with 24 additions and 15 deletions.
  1. +12 −8 src/macports1.0/macports.tcl
  2. +2 −2 src/port/port.tcl
  3. +10 −5 src/port1.0/portutil.tcl
@@ -1972,10 +1972,9 @@ proc _mportexec {target mport} {
} else {
# An error occurred.
global ::logenabled ::debuglogname
ui_error "Failed to install $portname"
ui_debug $::errorInfo
if {[info exists ::logenabled] && $::logenabled && [info exists ::debuglogname]} {
ui_notice "Please see the log file for port $portname for details:\n $::debuglogname"
ui_error "See $::debuglogname for details."
}
macports::pop_log
return 1
@@ -2059,11 +2058,16 @@ proc mportexec {mport target} {
registry::exclusive_unlock

if {$result ne {}} {
set errstring "The following dependencies were not installed:"
foreach ditem $result {
append errstring " [ditem_key $ditem provides]"
}
ui_error $errstring
##
# When this happens, the failing port usually already printed an
# error message. Omit this one to avoid cluttering the output and
# hiding the *real* problem.

#set errstring "The following dependencies were not installed:"
#foreach ditem $result {
# append errstring " [ditem_key $ditem provides]"
#}
#ui_error $errstring
foreach ditem $dlist {
catch {mportclose $ditem}
}
@@ -2101,7 +2105,7 @@ proc mportexec {mport target} {
global ::logenabled ::debuglogname
if {[info exists ::logenabled] && $::logenabled && [info exists ::debuglogname]} {
if {$result != 0} {
ui_notice "Please see the log file for port $portname for details:\n $::debuglogname"
ui_error "See $::debuglogname for details."
}
macports::pop_log
}
@@ -245,7 +245,7 @@ proc break_softcontinue { msg status name_status } {
# show the URL for the ticket reporting instructions
proc print_tickets_url {args} {
if {${macports::prefix} ne "/usr/local" && ${macports::prefix} ne "/usr"} {
ui_notice "To report a bug, follow the instructions in the guide:\n http://guide.macports.org/#project.tickets"
ui_error "Follow http://guide.macports.org/#project.tickets to report a bug."
}
}

@@ -4103,7 +4103,7 @@ proc action_target { action portlist opts } {
set status [action_revupgrade $action $portlist $opts]
}
}

return $status
}

@@ -1580,12 +1580,16 @@ proc target_run {ditem} {
# - this step is not to always be performed
# - this step must be written to file
if {$skipped == 0
&& [ditem_key $ditem runtype] ne "always"
&& [ditem_key $ditem state] ne "no"} {
write_statefile target $targetname $target_state_fd
&& [ditem_key $ditem runtype] ne "always"
&& [ditem_key $ditem state] ne "no"} {
write_statefile target $targetname $target_state_fd
}
} else {
ui_error "$targetname for port $portname returned: $errstr"
if {$errstr ne {}} {
ui_error "Failed to $target $portname: $errstr"
} else {
ui_error "Failed to $target $portname."
}
ui_debug "Error code: $errcode"
ui_debug "Backtrace: $errinfo"
set result 1
@@ -2132,7 +2136,8 @@ proc check_variants {target} {

array set oldvariations {}
if {[check_statefile_variants variations oldvariations $state_fd]} {
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)."
ui_error "Requested variants \"[canonicalize_variants [array get variations]]\" do not match original selection \"[canonicalize_variants [array get oldvariations]]\"."
ui_error "Please use the same variants again, perform 'port clean [option subport]' or specify the force option (-f)."
set result 1
} elseif {!([info exists ports_dryrun] && $ports_dryrun eq "yes")} {
# Write variations out to the statefile

0 comments on commit 03327ff

Please sign in to comment.
You can’t perform that action at this time.