[118305] trunk/base/src

cal at macports.org cal at macports.org
Sat Mar 29 12:31:50 PDT 2014


Revision: 118305
          https://trac.macports.org/changeset/118305
Author:   cal at macports.org
Date:     2014-03-29 12:31:50 -0700 (Sat, 29 Mar 2014)
Log 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.

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

Modified: trunk/base/src/macports1.0/macports.tcl
===================================================================
--- trunk/base/src/macports1.0/macports.tcl	2014-03-29 19:21:58 UTC (rev 118304)
+++ trunk/base/src/macports1.0/macports.tcl	2014-03-29 19:31:50 UTC (rev 118305)
@@ -1972,10 +1972,9 @@
     } 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 @@
         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 @@
     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
     }

Modified: trunk/base/src/port/port.tcl
===================================================================
--- trunk/base/src/port/port.tcl	2014-03-29 19:21:58 UTC (rev 118304)
+++ trunk/base/src/port/port.tcl	2014-03-29 19:31:50 UTC (rev 118305)
@@ -245,7 +245,7 @@
 # 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 @@
             set status [action_revupgrade $action $portlist $opts]
         }
     }
-    
+
     return $status
 }
 

Modified: trunk/base/src/port1.0/portutil.tcl
===================================================================
--- trunk/base/src/port1.0/portutil.tcl	2014-03-29 19:21:58 UTC (rev 118304)
+++ trunk/base/src/port1.0/portutil.tcl	2014-03-29 19:31:50 UTC (rev 118305)
@@ -1580,12 +1580,16 @@
             # - 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 @@
 
         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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.macosforge.org/pipermail/macports-changes/attachments/20140329/6d822449/attachment-0001.html>


More information about the macports-changes mailing list