[Esbox-commits] r2094 - in trunk: org.maemo.esbox.scratchbox.core/src/org/maemo/esbox/scratchbox/core/command org.maemo.esbox.scratchbox.sb1/src/org/maemo/esbox/internal/scratchbox/sb1/core

eswartz at garage.maemo.org eswartz at garage.maemo.org
Wed Sep 2 23:08:31 EEST 2009


Author: eswartz
Date: 2009-09-02 23:08:23 +0300 (Wed, 02 Sep 2009)
New Revision: 2094

Modified:
   trunk/org.maemo.esbox.scratchbox.core/src/org/maemo/esbox/scratchbox/core/command/ScratchboxCommand.java
   trunk/org.maemo.esbox.scratchbox.sb1/src/org/maemo/esbox/internal/scratchbox/sb1/core/Scratchbox1SDK.java
Log:
Merge revs 2089:2093 from work_Ed branch

Modified: trunk/org.maemo.esbox.scratchbox.core/src/org/maemo/esbox/scratchbox/core/command/ScratchboxCommand.java
===================================================================
--- trunk/org.maemo.esbox.scratchbox.core/src/org/maemo/esbox/scratchbox/core/command/ScratchboxCommand.java	2009-09-02 19:49:54 UTC (rev 2093)
+++ trunk/org.maemo.esbox.scratchbox.core/src/org/maemo/esbox/scratchbox/core/command/ScratchboxCommand.java	2009-09-02 20:08:23 UTC (rev 2094)
@@ -262,6 +262,7 @@
 			final boolean allowError, final long timeout)
 			throws ScratchboxException {
 		final String[] inputs = { null };
+		final String[] errors = { "" };
 		final Exception[] excs = { null };
 		final int[] exits = { -1 };
 		Runnable runnable = new Runnable() {
@@ -270,11 +271,11 @@
 				try {
 					inputs[0] = getInputFromProcess(process);
 
-					String error = getErrorInputFromProcess(process);
+					errors[0] = getErrorInputFromProcess(process);
 					if (!allowError) {
-						if (error.length() > 0) {
+						if (errors[0].length() > 0) {
 							excs[0] = new ScratchboxInvalidOperationException(
-									error);
+									errors[0]);
 							return;
 						}
 					}
@@ -321,8 +322,8 @@
 			throw new ScratchboxException(excs[0]);
 		} else if (exits[0] != 0) {
 			throw new ScratchboxException(
-					MessageFormat.format("Process failed with exit code {0}",
-							exits[0]));
+					MessageFormat.format("Process failed with exit code {0}\n{1}",
+							exits[0], errors[0]));
 		}
 
 		return inputs[0];

Modified: trunk/org.maemo.esbox.scratchbox.sb1/src/org/maemo/esbox/internal/scratchbox/sb1/core/Scratchbox1SDK.java
===================================================================
--- trunk/org.maemo.esbox.scratchbox.sb1/src/org/maemo/esbox/internal/scratchbox/sb1/core/Scratchbox1SDK.java	2009-09-02 19:49:54 UTC (rev 2093)
+++ trunk/org.maemo.esbox.scratchbox.sb1/src/org/maemo/esbox/internal/scratchbox/sb1/core/Scratchbox1SDK.java	2009-09-02 20:08:23 UTC (rev 2094)
@@ -12,6 +12,7 @@
 package org.maemo.esbox.internal.scratchbox.sb1.core;
 
 import com.nokia.cpp.internal.api.utils.core.FileUtils;
+import com.nokia.cpp.internal.api.utils.ui.WorkbenchUtils;
 
 import org.eclipse.core.filesystem.IFileStore;
 import org.eclipse.core.runtime.*;
@@ -38,6 +39,7 @@
 import org.maemo.mica.common.core.process.*;
 import org.maemo.mica.common.core.sdk.*;
 import org.maemo.mica.common.core.ui.*;
+import org.maemo.mica.common.ui.dialogs.DialogUtils;
 import org.maemo.mica.internal.api.common.core.SudoWrappedProcessLauncherFactory;
 import org.maemo.mica.internal.api.common.core.machine.HostMachineBackend;
 import org.maemo.mica.internal.api.common.core.sdk.SDKPlatform;
@@ -92,6 +94,7 @@
 		
 		ListTargetsCommand listTargetsCommand = new ListTargetsCommand(
 				getCommandAbstractor());
+		
 		List<String> targets = (List<String>) wrapCommand(listTargetsCommand, EMPTY_ARGS);
 	
 		targets = new ArrayList<String>(targets);
@@ -152,25 +155,7 @@
 		// ensure we actually try to invoke sb-conf below
 		getCache().set(VERSION_KEY, null);
 
-		String version = null;
-		try {
-			version = getCurrentSboxVersion();
-		} catch (ScratchboxException e) {
-			if (e.getMessage().contains("vdso support") // need to do the "vdso=0" option dynamically
-					|| e.getMessage().contains("not properly set up") // this MAY be because it has not been enabled with sbox_ctl
-			) {
-				IStatus status = Scratchbox1SDK.startup(getMachine(), sdkRoot, 
-						null, new ProgressReporterAdapter());
-				if (!status.isOK() && !status.matches(IStatus.INFO)) {
-					// already logged
-					throw e;
-				}
-				Activator.getErrorLogger().log(status);
-				
-				// try again
-				version = getCurrentSboxVersion();
-			}
-		}
+		String version = getCurrentSboxVersion();
 		
 		if (version == null) {
 			// no scratchbox?
@@ -936,7 +921,20 @@
 			// might not be turned on yet
 			if (e.getMessage() != null && 
 					(e.getMessage().contains("properly set up")
-							|| e.getMessage().contains("Inconsistency detected by ld.so"))) {
+							|| e.getMessage().contains("Inconsistency detected by ld.so")
+							|| e.getMessage().contains("kernel has vdso support"))) {
+				
+				boolean startup = WorkbenchUtils.isJUnitRunning();
+				if (!startup)
+					startup = DialogUtils.showQuestionDialog(null, "Scratchbox 1 Startup?",
+						MessageFormat.format(
+								"It appears that Scratchbox 1 at {0} is not started, perhaps because the kernel has some incompatible settings or you have not installed its startup script:\n\n{1}\n\nShould I try to start it now?",
+								getInstallRoot().toPortableString(),
+								e.getMessage())
+						);
+				if (!startup)
+					throw e;
+				
 				IStatus status = Scratchbox1SDK.startup(
 						getMachine(), getInstallRoot(), 
 						new NullProgressMonitor(), 



More information about the Esbox-commits mailing list