[60770] branches/release_1_8/base/src
jmr at macports.org
jmr at macports.org
Sun Nov 22 20:32:56 PST 2009
Revision: 60770
http://trac.macports.org/changeset/60770
Author: jmr at macports.org
Date: 2009-11-22 20:32:54 -0800 (Sun, 22 Nov 2009)
Log Message:
-----------
1.8 branch: similar change to trunk's r60769:
* include command output in the return value of the system proc only if not in debug or verbose mode (#21084)
* instruct user to run again in debug mode on failure, or give the ticket guidelines URL if in debug mode already
Revision Links:
--------------
http://trac.macports.org/changeset/60769
Modified Paths:
--------------
branches/release_1_8/base/src/pextlib1.0/system.c
branches/release_1_8/base/src/port/port.tcl
Modified: branches/release_1_8/base/src/pextlib1.0/system.c
===================================================================
--- branches/release_1_8/base/src/pextlib1.0/system.c 2009-11-23 03:23:47 UTC (rev 60769)
+++ branches/release_1_8/base/src/pextlib1.0/system.c 2009-11-23 04:32:54 UTC (rev 60770)
@@ -196,21 +196,9 @@
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 */
+ Tcl_Obj* errorCode;
+ const char *portverbose;
- /* 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);
Tcl_ListObjAppendElement(interp, errorCode, Tcl_NewStringObj("CHILDSTATUS", -1));
@@ -223,8 +211,27 @@
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);
+
+ portverbose = Tcl_GetVar(interp, "portverbose", TCL_GLOBAL_ONLY);
+ /* include last 30 lines of output only if they haven't already
+ been shown due to debug or verbose mode */
+ if (portverbose && strcmp("yes", portverbose) != 0) {
+ /* Copy the contents of the circular buffer to errbuf */
+ 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);
+ }
+ Tcl_AppendToObj(tcl_result, "\nCommand output: ", -1);
+ Tcl_AppendObjToObj(tcl_result, errbuf);
+ }
Tcl_SetObjResult(interp, tcl_result);
}
}
Modified: branches/release_1_8/base/src/port/port.tcl
===================================================================
--- branches/release_1_8/base/src/port/port.tcl 2009-11-23 03:23:47 UTC (rev 60769)
+++ branches/release_1_8/base/src/port/port.tcl 2009-11-23 04:32:54 UTC (rev 60770)
@@ -156,6 +156,16 @@
}
}
+# show the URL for the ticket reporting instructions
+proc print_tickets_url {args} {
+ if {![macports::ui_isset ports_quiet]} {
+ if {[macports::ui_isset ports_debug]} {
+ ui_msg "To report a bug, see <http://guide.macports.org/#project.tickets>"
+ } else {
+ ui_msg "Before reporting a bug, first run the command again with the -d flag to get complete output."
+ }
+ }
+}
# Form a composite version as is sometimes used for registry functions
proc composite_version {version variations {emptyVersionOkay 0}} {
@@ -2037,7 +2047,7 @@
if {!$orig_nodeps} {
unset -nocomplain macports::global_options(ports_nodeps)
}
- return $status
+ break
}
}
}
@@ -2045,6 +2055,9 @@
if {!$orig_nodeps} {
unset -nocomplain macports::global_options(ports_nodeps)
}
+ if {$status != 0} {
+ print_tickets_url
+ }
return $status
}
@@ -2932,6 +2945,9 @@
}
}
+ 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/9c1335b4/attachment.html>
More information about the macports-changes
mailing list