[60769] trunk/base/src

jmr at macports.org jmr at macports.org
Sun Nov 22 19:23:51 PST 2009


Revision: 60769
          http://trac.macports.org/changeset/60769
Author:   jmr at macports.org
Date:     2009-11-22 19:23:47 -0800 (Sun, 22 Nov 2009)
Log Message:
-----------
stop including command output in the return value of the system proc (#21084), print log file location and ticket guidelines URL when a target fails

Modified Paths:
--------------
    trunk/base/src/macports1.0/macports.tcl
    trunk/base/src/pextlib1.0/system.c
    trunk/base/src/port/port.tcl

Modified: trunk/base/src/macports1.0/macports.tcl
===================================================================
--- trunk/base/src/macports1.0/macports.tcl	2009-11-23 00:54:11 UTC (rev 60768)
+++ trunk/base/src/macports1.0/macports.tcl	2009-11-23 03:23:47 UTC (rev 60769)
@@ -1605,6 +1605,11 @@
         catch {cd $portpath}
         $workername eval eval_targets clean
     }
+    
+    global ::debuglogname
+    if {$result != 0 && ![macports::ui_isset ports_quiet] && [info exists ::debuglogname]} {
+        ui_msg "Log for $portname is at: $::debuglogname"
+    }
 
     return $result
 }

Modified: trunk/base/src/pextlib1.0/system.c
===================================================================
--- trunk/base/src/pextlib1.0/system.c	2009-11-23 00:54:11 UTC (rev 60768)
+++ trunk/base/src/pextlib1.0/system.c	2009-11-23 03:23:47 UTC (rev 60769)
@@ -79,7 +79,6 @@
 	int fline, pos, ret;
 	int osetsid = 0;
 	pid_t pid;
-	Tcl_Obj *errbuf;
 	Tcl_Obj *tcl_result;
 	int read_failed, status;
 
@@ -197,36 +196,25 @@
 		if (WEXITSTATUS(ret) == 0) {
 			status = TCL_OK;
 		} else {
-			/* Copy the contents of the circular buffer to errbuf */
-		  	Tcl_Obj* errorCode;
-			errbuf = Tcl_NewStringObj(NULL, 0);
-			for (fline = pos; pos < fline + CBUFSIZ; pos++) {
-				if (circbuf[pos % CBUFSIZ].len == 0)
-				continue; /* skip empty lines */
-
-				/* Append line, minus trailing NULL */
-				Tcl_AppendToObj(errbuf, circbuf[pos % CBUFSIZ].line,
-						circbuf[pos % CBUFSIZ].len - 1);
-
-				/* Re-add previously stripped newline */
-				Tcl_AppendToObj(errbuf, "\n", 1);
-			}
-
-			/* set errorCode [list CHILDSTATUS <pid> <code>] */
-			errorCode = Tcl_NewListObj(0, NULL);
+		    char *errorstr;
+		    size_t errorstrlen;
+		  	/* set errorCode [list CHILDSTATUS <pid> <code>] */
+			Tcl_Obj* errorCode = Tcl_NewListObj(0, NULL);
 			Tcl_ListObjAppendElement(interp, errorCode, Tcl_NewStringObj("CHILDSTATUS", -1));
 			Tcl_ListObjAppendElement(interp, errorCode, Tcl_NewIntObj(pid));
 			Tcl_ListObjAppendElement(interp, errorCode, Tcl_NewIntObj(WEXITSTATUS(ret)));
 			Tcl_SetObjErrorCode(interp, errorCode);
 
-			/* set result */
-			tcl_result = Tcl_NewStringObj("shell command \"", -1);
-			Tcl_AppendToObj(tcl_result, cmdstring, -1);
-			Tcl_AppendToObj(tcl_result, "\" returned error ", -1);
-			Tcl_AppendObjToObj(tcl_result, Tcl_NewIntObj(WEXITSTATUS(ret)));
-			Tcl_AppendToObj(tcl_result, "\nCommand output: ", -1);
-			Tcl_AppendObjToObj(tcl_result, errbuf);
-			Tcl_SetObjResult(interp, tcl_result);
+			/* print error */
+			errorstrlen = strlen("shell command \"")+strlen(cmdstring)+strlen("\" returned error ")+12;
+			errorstr = malloc(errorstrlen);
+			if (errorstr) {
+                *errorstr = '\0';
+                snprintf(errorstr, errorstrlen, "%s%s%s%d", "shell command \"", cmdstring, "\" returned error ", WEXITSTATUS(ret));
+			    ui_info(interp, errorstr);
+			    free(errorstr);
+			}
+			Tcl_SetObjResult(interp, Tcl_NewStringObj("shell command failed", -1));
 		}
 	}
 

Modified: trunk/base/src/port/port.tcl
===================================================================
--- trunk/base/src/port/port.tcl	2009-11-23 00:54:11 UTC (rev 60768)
+++ trunk/base/src/port/port.tcl	2009-11-23 03:23:47 UTC (rev 60769)
@@ -155,6 +155,13 @@
     }
 }
 
+# show the URL for the ticket reporting instructions
+proc print_tickets_url {args} {
+    if {![macports::ui_isset ports_quiet]} {
+        ui_msg "To report a bug, see <http://guide.macports.org/#project.tickets>"
+    }
+}
+
 # Form a composite version as is sometimes used for registry functions
 proc composite_version {version variations {emptyVersionOkay 0}} {
     # Form a composite version out of the version and variations
@@ -2114,10 +2121,14 @@
         if {![info exists depscache(port:$portname)]} {
             set status [macports::upgrade $portname "port:$portname" [array get requested_variations] [array get options] depscache]
             if {$status != 0 && ![macports::ui_isset ports_processall]} {
-                return $status
+                break
             }
         }
     }
+    
+    if {$status != 0} {
+        print_tickets_url
+    }
 
     return $status
 }
@@ -3009,6 +3020,10 @@
         }
     }
     
+    if {$status != 0} {
+        print_tickets_url
+    }
+    
     return $status
 }
 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/macports-changes/attachments/20091122/ae8cd477/attachment.html>


More information about the macports-changes mailing list