[Esbox-commits] r925 - in branches/sdkPlusSupport: org.maemo.esbox.maemosdk.core/src/org/maemo/esbox/internal/api/maemosdk/core/execEnv org.maemo.esbox.maemosdk.core/src/org/maemo/esbox/internal/api/maemosdk/core/tools org.maemo.esbox.maemosdk.tests/src/org/maemo/esbox/scratchbox/tests/commands org.maemo.esbox.scratchbox.sb2/src/org/maemo/esbox/internal/scratchbox/sb2/command org.maemo.esbox.scratchbox.sb2/src/org/maemo/esbox/internal/scratchbox/sb2/launcher

baranov at garage.maemo.org baranov at garage.maemo.org
Thu Nov 6 15:47:48 EET 2008


Author: baranov
Date: 2008-11-06 15:47:47 +0200 (Thu, 06 Nov 2008)
New Revision: 925

Modified:
   branches/sdkPlusSupport/org.maemo.esbox.maemosdk.core/src/org/maemo/esbox/internal/api/maemosdk/core/execEnv/MaemoExecutionEnvironmentHandler.java
   branches/sdkPlusSupport/org.maemo.esbox.maemosdk.core/src/org/maemo/esbox/internal/api/maemosdk/core/tools/MaemoScriptLauncher.java
   branches/sdkPlusSupport/org.maemo.esbox.maemosdk.tests/src/org/maemo/esbox/scratchbox/tests/commands/TestScratchbox2SDK.java
   branches/sdkPlusSupport/org.maemo.esbox.scratchbox.sb2/src/org/maemo/esbox/internal/scratchbox/sb2/command/MaemoSdkCommand.java
   branches/sdkPlusSupport/org.maemo.esbox.scratchbox.sb2/src/org/maemo/esbox/internal/scratchbox/sb2/launcher/Sb2MaemoLauncherAdapter.java
   branches/sdkPlusSupport/org.maemo.esbox.scratchbox.sb2/src/org/maemo/esbox/internal/scratchbox/sb2/launcher/Scratchbox2EnvironmentProvider.java
   branches/sdkPlusSupport/org.maemo.esbox.scratchbox.sb2/src/org/maemo/esbox/internal/scratchbox/sb2/launcher/Scratchbox2ProcessLauncher.java
   branches/sdkPlusSupport/org.maemo.esbox.scratchbox.sb2/src/org/maemo/esbox/internal/scratchbox/sb2/launcher/Scratchbox2ProcessLauncherFactory.java
Log:
sdk+ runtime support

Modified: branches/sdkPlusSupport/org.maemo.esbox.maemosdk.core/src/org/maemo/esbox/internal/api/maemosdk/core/execEnv/MaemoExecutionEnvironmentHandler.java
===================================================================
--- branches/sdkPlusSupport/org.maemo.esbox.maemosdk.core/src/org/maemo/esbox/internal/api/maemosdk/core/execEnv/MaemoExecutionEnvironmentHandler.java	2008-11-05 07:11:53 UTC (rev 924)
+++ branches/sdkPlusSupport/org.maemo.esbox.maemosdk.core/src/org/maemo/esbox/internal/api/maemosdk/core/execEnv/MaemoExecutionEnvironmentHandler.java	2008-11-06 13:47:47 UTC (rev 925)
@@ -46,7 +46,7 @@
 		} catch (MicaException e) {
 			Activator.getErrorLogger().logAndShowError(
 					"Error querying Maemo status", e);
-			// don't fail the launch
+			// don't fa	il the launch
 		}
 	}
 

Modified: branches/sdkPlusSupport/org.maemo.esbox.maemosdk.core/src/org/maemo/esbox/internal/api/maemosdk/core/tools/MaemoScriptLauncher.java
===================================================================
--- branches/sdkPlusSupport/org.maemo.esbox.maemosdk.core/src/org/maemo/esbox/internal/api/maemosdk/core/tools/MaemoScriptLauncher.java	2008-11-05 07:11:53 UTC (rev 924)
+++ branches/sdkPlusSupport/org.maemo.esbox.maemosdk.core/src/org/maemo/esbox/internal/api/maemosdk/core/tools/MaemoScriptLauncher.java	2008-11-06 13:47:47 UTC (rev 925)
@@ -639,11 +639,11 @@
 	}
 
 	public boolean isMaemoStarted(ISDKTarget sdkTarget) {
-		try {
-			if (!isXServerStarted(sdkTarget))
-				return false;
-		} catch (MicaException e1) {
-		}
+//		try {
+//			if (!isXServerStarted(sdkTarget))
+//				return false;
+//		} catch (MicaException e1) {
+//		}
 
 		IMaemoLauncherAdapter launcher = (IMaemoLauncherAdapter)sdkTarget.getAdapter(IMaemoLauncherAdapter.class);
 		if(launcher!=null){

Modified: branches/sdkPlusSupport/org.maemo.esbox.maemosdk.tests/src/org/maemo/esbox/scratchbox/tests/commands/TestScratchbox2SDK.java
===================================================================
--- branches/sdkPlusSupport/org.maemo.esbox.maemosdk.tests/src/org/maemo/esbox/scratchbox/tests/commands/TestScratchbox2SDK.java	2008-11-05 07:11:53 UTC (rev 924)
+++ branches/sdkPlusSupport/org.maemo.esbox.maemosdk.tests/src/org/maemo/esbox/scratchbox/tests/commands/TestScratchbox2SDK.java	2008-11-06 13:47:47 UTC (rev 925)
@@ -57,7 +57,7 @@
 		IScratchboxSDKPlatformArchitectureProvider 
 			provider = (IScratchboxSDKPlatformArchitectureProvider)sb2Sdk;
 		assertEquals(IScratchboxSDKTarget.ARCHITECTURE_ARMEL,provider.getArchitecture("diablo41_armel"));
-		assertEquals(IScratchboxSDKTarget.ARCHITECTURE_UNKNOWN,provider.getArchitecture("WRONGTARGET"));
+		assertEquals(IScratchboxSDKTarget.ARCHITECTURE_UNKNOWN,provider.getArchitecture("WRONG_TARGET"));
 	}
 	
 	public void testGetPlatform() throws Exception {

Modified: branches/sdkPlusSupport/org.maemo.esbox.scratchbox.sb2/src/org/maemo/esbox/internal/scratchbox/sb2/command/MaemoSdkCommand.java
===================================================================
--- branches/sdkPlusSupport/org.maemo.esbox.scratchbox.sb2/src/org/maemo/esbox/internal/scratchbox/sb2/command/MaemoSdkCommand.java	2008-11-05 07:11:53 UTC (rev 924)
+++ branches/sdkPlusSupport/org.maemo.esbox.scratchbox.sb2/src/org/maemo/esbox/internal/scratchbox/sb2/command/MaemoSdkCommand.java	2008-11-06 13:47:47 UTC (rev 925)
@@ -10,6 +10,7 @@
  *******************************************************************************/
 package org.maemo.esbox.internal.scratchbox.sb2.command;
 
+import java.io.File;
 import java.util.Arrays;
 import java.util.List;
 
@@ -33,6 +34,8 @@
 	private static final String SPECIFIER_ROOTSTRAP = "rootstrap";
 	private static final String COMMAND_LIST = "list";
 	private static final String SPECIFIER_TOOLCHAINS = "toolchains";
+	private static final String COMMAND_ENTER = "enter";
+	private static final String SPECIFIER_RUNTIME = "runtime";
 
 	public MaemoSdkCommand(ICommandAbstractor commandAbstractor, IProcessLauncherFactory launcherFactory) {
 		super(commandAbstractor,launcherFactory);
@@ -71,7 +74,7 @@
 	 */
 	public boolean isUp(String targetName) throws MicaException{
 		Results result = runProcess(MAEMO_SDK,COMMAND_SHOW,SPECIFIER_GUI,targetName);
-		return result.stdout.equals(STATUS_UP);
+		return result.stdout.replaceAll("\\n", "").toLowerCase().equals(STATUS_UP);
 	}
 	
 	/**
@@ -93,4 +96,20 @@
 		Results result = runProcess(MAEMO_SDK,COMMAND_LIST,SPECIFIER_TOOLCHAINS);
 		return Arrays.asList(result.getStdoutLines());
 	}
+
+	public Process runStandalone(String targetName,String path) {
+		Process process = null;
+		String sbPath = "/tmp"+path.substring(path.lastIndexOf(File.separator));
+		try{
+			runProcess("cp",path,sbPath);
+			process = createProcess(Arrays.asList(
+					MAEMO_SDK,
+					COMMAND_ENTER,
+					SPECIFIER_RUNTIME,
+					targetName,"'run-standalone.sh "+sbPath+"'"));
+		}catch(MicaException e){
+			
+		}
+		return process;
+	}
 }

Modified: branches/sdkPlusSupport/org.maemo.esbox.scratchbox.sb2/src/org/maemo/esbox/internal/scratchbox/sb2/launcher/Sb2MaemoLauncherAdapter.java
===================================================================
--- branches/sdkPlusSupport/org.maemo.esbox.scratchbox.sb2/src/org/maemo/esbox/internal/scratchbox/sb2/launcher/Sb2MaemoLauncherAdapter.java	2008-11-05 07:11:53 UTC (rev 924)
+++ branches/sdkPlusSupport/org.maemo.esbox.scratchbox.sb2/src/org/maemo/esbox/internal/scratchbox/sb2/launcher/Sb2MaemoLauncherAdapter.java	2008-11-06 13:47:47 UTC (rev 925)
@@ -44,4 +44,12 @@
 	public void stopMaemo() throws MicaException {
 		command.stopMaemo(target.getName());
 	}
+	
+	/**
+	 * @param path - host environment path
+	 * @return
+	 */
+	public Process createStandaloneProcess(String path){
+		return command.runStandalone(target.getName(),path);
+	}
 }

Modified: branches/sdkPlusSupport/org.maemo.esbox.scratchbox.sb2/src/org/maemo/esbox/internal/scratchbox/sb2/launcher/Scratchbox2EnvironmentProvider.java
===================================================================
--- branches/sdkPlusSupport/org.maemo.esbox.scratchbox.sb2/src/org/maemo/esbox/internal/scratchbox/sb2/launcher/Scratchbox2EnvironmentProvider.java	2008-11-05 07:11:53 UTC (rev 924)
+++ branches/sdkPlusSupport/org.maemo.esbox.scratchbox.sb2/src/org/maemo/esbox/internal/scratchbox/sb2/launcher/Scratchbox2EnvironmentProvider.java	2008-11-06 13:47:47 UTC (rev 925)
@@ -14,6 +14,7 @@
 
 import org.maemo.esbox.internal.api.scratchbox.sb2.core.SB2PreferenceConstants;
 import org.maemo.esbox.internal.scratchbox.sb2.Activator;
+import org.maemo.esbox.scratchbox.sb2.sdk.IScratchbox2SDKTarget;
 import org.maemo.mica.common.core.MicaException;
 import org.maemo.mica.common.core.process.*;
 import org.maemo.mica.common.core.process.ProcessLauncherUtils.Results;
@@ -29,12 +30,12 @@
 public class Scratchbox2EnvironmentProvider implements
 		IStandardEnvironmentProvider {
 	public static Map<ISDKTarget, Properties> cachedStdEnvMap = new HashMap<ISDKTarget, Properties>();
-	private final ISDKTarget sdkTarget;
+	private final IScratchbox2SDKTarget sdkTarget;
 
 	/**
 	 * @param sdkTarget
 	 */
-	public Scratchbox2EnvironmentProvider(ISDKTarget sdkTarget) {
+	public Scratchbox2EnvironmentProvider(IScratchbox2SDKTarget sdkTarget) {
 		this.sdkTarget = sdkTarget;
 	}
 

Modified: branches/sdkPlusSupport/org.maemo.esbox.scratchbox.sb2/src/org/maemo/esbox/internal/scratchbox/sb2/launcher/Scratchbox2ProcessLauncher.java
===================================================================
--- branches/sdkPlusSupport/org.maemo.esbox.scratchbox.sb2/src/org/maemo/esbox/internal/scratchbox/sb2/launcher/Scratchbox2ProcessLauncher.java	2008-11-05 07:11:53 UTC (rev 924)
+++ branches/sdkPlusSupport/org.maemo.esbox.scratchbox.sb2/src/org/maemo/esbox/internal/scratchbox/sb2/launcher/Scratchbox2ProcessLauncher.java	2008-11-06 13:47:47 UTC (rev 925)
@@ -12,7 +12,9 @@
 package org.maemo.esbox.internal.scratchbox.sb2.launcher;
 
 import org.eclipse.core.runtime.IPath;
+import org.maemo.esbox.internal.api.maemosdk.core.tools.IMaemoLauncherAdapter;
 import org.maemo.esbox.internal.api.scratchbox.sb2.core.SB2PreferenceConstants;
+import org.maemo.esbox.scratchbox.sb2.sdk.IScratchbox2SDKTarget;
 import org.maemo.mica.common.core.MicaException;
 import org.maemo.mica.common.core.env.IEnvironmentModifierBlock;
 import org.maemo.mica.common.core.process.*;
@@ -30,9 +32,9 @@
 public class Scratchbox2ProcessLauncher extends BaseSDKTargetProcessLauncher implements
 		IProcessLauncher {
 
-	private ISDKTarget sdkTarget;
+	private IScratchbox2SDKTarget sdkTarget;
 
-	public Scratchbox2ProcessLauncher(ISDKTarget sdkTarget,
+	public Scratchbox2ProcessLauncher(IScratchbox2SDKTarget sdkTarget,
 			IPath workingDirectory, List<String> cmdLine,
 			IEnvironmentModifierBlock environmentModifierBlock, String modeKey,
 			boolean runAsRoot) {
@@ -58,6 +60,11 @@
 		return sdkTarget + " ";
 	}
 
+	@Override
+	protected void setupForLaunch() throws MicaException {
+		super.setupForLaunch();
+	}
+
 	private static List<String> encodeArgumentArray(ISDKTarget sdkTarget,
 			List<String> cmdLine, String modeKey) {
 
@@ -101,9 +108,15 @@
 	 */
 	@Override
 	protected Process doCreateProcess() throws Exception {
-		return sdkTarget.getSDK().getMachine().createProcess(
-				getLaunchCurrentWorkingDirectory(),
-				getLaunchCommandArguments(),
-				getLaunchEnvironmentModifierBlock(), isUsePTY());
+		Sb2MaemoLauncherAdapter launcher = (Sb2MaemoLauncherAdapter)sdkTarget.getAdapter(IMaemoLauncherAdapter.class);
+		if(launcher.isMaemoRunning()){
+			String path = getLaunchCommandArguments().get(6).replace("run-standalone.sh ", "");
+			return launcher.createStandaloneProcess(path);
+		}else{
+			return sdkTarget.getSDK().getMachine().createProcess(
+					getLaunchCurrentWorkingDirectory(),
+					getLaunchCommandArguments(),
+					getLaunchEnvironmentModifierBlock(), isUsePTY());
+		}
 	}
 }

Modified: branches/sdkPlusSupport/org.maemo.esbox.scratchbox.sb2/src/org/maemo/esbox/internal/scratchbox/sb2/launcher/Scratchbox2ProcessLauncherFactory.java
===================================================================
--- branches/sdkPlusSupport/org.maemo.esbox.scratchbox.sb2/src/org/maemo/esbox/internal/scratchbox/sb2/launcher/Scratchbox2ProcessLauncherFactory.java	2008-11-05 07:11:53 UTC (rev 924)
+++ branches/sdkPlusSupport/org.maemo.esbox.scratchbox.sb2/src/org/maemo/esbox/internal/scratchbox/sb2/launcher/Scratchbox2ProcessLauncherFactory.java	2008-11-06 13:47:47 UTC (rev 925)
@@ -12,6 +12,7 @@
 package org.maemo.esbox.internal.scratchbox.sb2.launcher;
 
 import org.eclipse.core.runtime.IPath;
+import org.maemo.esbox.scratchbox.sb2.sdk.IScratchbox2SDKTarget;
 import org.maemo.mica.common.core.env.IEnvironmentModifierBlock;
 import org.maemo.mica.common.core.process.IProcessLauncher;
 import org.maemo.mica.common.core.sdk.ISDKTarget;
@@ -26,7 +27,7 @@
 public class Scratchbox2ProcessLauncherFactory extends
 		BaseProcessLauncherFactory {
 
-	protected ISDKTarget sdkTarget;
+	protected IScratchbox2SDKTarget sdkTarget;
 	private String mappingModeKey;
 	private final boolean runAsRoot;
 
@@ -41,7 +42,7 @@
 	 * @param isBuildMode
 	 *            true: build mode, false: installation mode
 	 */
-	public Scratchbox2ProcessLauncherFactory(ISDKTarget sdkTarget,
+	public Scratchbox2ProcessLauncherFactory(IScratchbox2SDKTarget sdkTarget,
 			String mappingModeKey, boolean runAsRoot) {
 		super(new Scratchbox2EnvironmentProvider(sdkTarget), false);
 		if (sdkTarget == null)



More information about the Esbox-commits mailing list