Date   

[PATCH 1/7] scripts/lib/bsp/engine.py: add yocto_layer_create()

tom.zanussi@...
 

From: Tom Zanussi <tom.zanussi@...>

Add a new yocto_layer_create() function that will be used to generate
a generic yocto layer (for the new 'yocto-layer' command).

Signed-off-by: Tom Zanussi <tom.zanussi@...>
---
scripts/lib/bsp/engine.py | 56 +++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 56 insertions(+)

diff --git a/scripts/lib/bsp/engine.py b/scripts/lib/bsp/engine.py
index 8985544..d406e79 100644
--- a/scripts/lib/bsp/engine.py
+++ b/scripts/lib/bsp/engine.py
@@ -1352,6 +1352,62 @@ def expand_targets(context, bsp_output_dir):
return target_files


+def yocto_layer_create(layer_name, scripts_path, layer_output_dir, codedump, properties_file):
+ """
+ Create yocto layer
+
+ layer_name - user-defined layer name
+ scripts_path - absolute path to yocto /scripts dir
+ bsp_output_dir - dirname to create for BSP
+ codedump - dump generated code to bspgen.out
+ properties_file - use values from here if nonempty i.e no prompting
+
+ arch - the arch for a generic layer is 'generic-layer', defined in
+ scripts/lib/bsp/substrate/target/generic-layer
+ """
+ if os.path.exists(bsp_output_dir):
+ print "\nBSP output dir already exists, exiting. (%s)" % bsp_output_dir
+ sys.exit(1)
+
+ properties = None
+
+ if properties_file:
+ try:
+ infile = open(properties_file, "r")
+ except IOError:
+ print "Couldn't open properties file %s for reading, exiting" % properties_file
+ sys.exit(1)
+
+ properties = json.load(infile)
+
+ os.mkdir(bsp_output_dir)
+
+ context = create_context(machine, arch, scripts_path)
+ target_files = expand_targets(context, bsp_output_dir)
+
+ input_lines = gather_inputlines(target_files)
+
+ program_lines = []
+
+ gen_program_header_lines(program_lines)
+
+ gen_initial_property_vals(input_lines, program_lines)
+
+ if properties:
+ gen_supplied_property_vals(properties, program_lines)
+
+ gen_program_machine_lines(machine, program_lines)
+
+ if not properties:
+ gen_program_input_lines(input_lines, program_lines, context)
+
+ gen_program_lines(target_files, program_lines)
+
+ run_program_lines(program_lines, codedump)
+
+ print "New %s BSP created in %s" % (arch, bsp_output_dir)
+
+
def yocto_bsp_create(machine, arch, scripts_path, bsp_output_dir, codedump, properties_file):
"""
Create bsp
--
1.7.11.4


[PATCH] [Temp-Performance-Patch] Run each command in separate shell and close it accordingly

Ioana Grigoropol <ioanax.grigoropol@...>
 

--needs more testing

Signed-off-by: Ioana Grigoropol <ioanax.grigoropol@...>
---
plugins/org.yocto.bc.ui/META-INF/MANIFEST.MF | 1 +
.../src/org/yocto/bc/bitbake/ShellSession.java | 10 +-
.../org/yocto/bc/remote/utils/RemoteHelper.java | 289 ++++++++++++++++----
.../bc/remote/utils/YoctoRunnableWithProgress.java | 7 +-
.../bc/ui/wizards/NewBitBakeFileRecipeWizard.java | 3 +-
.../ui/wizards/NewBitBakeFileRecipeWizardPage.java | 78 +++---
6 files changed, 295 insertions(+), 93 deletions(-)

diff --git a/plugins/org.yocto.bc.ui/META-INF/MANIFEST.MF b/plugins/org.yocto.bc.ui/META-INF/MANIFEST.MF
index 1f0e63e..4e57f33 100644
--- a/plugins/org.yocto.bc.ui/META-INF/MANIFEST.MF
+++ b/plugins/org.yocto.bc.ui/META-INF/MANIFEST.MF
@@ -29,6 +29,7 @@ Import-Package: org.eclipse.cdt.managedbuilder.core,
org.eclipse.rse.core,
org.eclipse.rse.core.model,
org.eclipse.rse.core.subsystems,
+ org.eclipse.rse.internal.services.local.shells,
org.eclipse.rse.services,
org.eclipse.rse.services.clientserver.messages,
org.eclipse.rse.services.files,
diff --git a/plugins/org.yocto.bc.ui/src/org/yocto/bc/bitbake/ShellSession.java b/plugins/org.yocto.bc.ui/src/org/yocto/bc/bitbake/ShellSession.java
index 6441029..449994c 100644
--- a/plugins/org.yocto.bc.ui/src/org/yocto/bc/bitbake/ShellSession.java
+++ b/plugins/org.yocto.bc.ui/src/org/yocto/bc/bitbake/ShellSession.java
@@ -87,8 +87,11 @@ public class ShellSession {
private void initializeShell(IProgressMonitor monitor) throws IOException {
try {
if (root != null) {
- RemoteHelper.runCommandRemote(projectInfo.getConnection(), new YoctoCommand("source " + initCmd, root.getAbsolutePath(), ""));
- RemoteHelper.runCommandRemote(projectInfo.getConnection(), new YoctoCommand(exportCmd, root.getAbsolutePath(), ""));
+ IHost connection = projectInfo.getConnection();
+// RemoteHelper.runCommandRemote(projectInfo.getConnection(), new YoctoCommand("source " + initCmd, root.getAbsolutePath(), ""));
+ RemoteHelper.handleRunCommandRemote(connection, new YoctoCommand("source " + initCmd, root.getAbsolutePath(), ""), monitor);
+// RemoteHelper.runCommandRemote(projectInfo.getConnection(), new YoctoCommand(exportCmd, root.getAbsolutePath(), ""));
+ RemoteHelper.handleRunCommandRemote(connection, new YoctoCommand(exportCmd, root.getAbsolutePath(), ""), monitor);
} else {
throw new Exception("Root file not found!");
}
@@ -107,7 +110,8 @@ public class ShellSession {

try {
if (projectInfo.getConnection() != null) {
- hasErrors = RemoteHelper.runCommandRemote(projectInfo.getConnection(), new YoctoCommand(command, root.getAbsolutePath() + "/build/", ""));
+// hasErrors = RemoteHelper.runCommandRemote(projectInfo.getConnection(), new YoctoCommand(command, root.getAbsolutePath() + "/build/", ""));
+ RemoteHelper.handleRunCommandRemote(projectInfo.getConnection(), new YoctoCommand(command, root.getAbsolutePath() + "/build/", ""), new NullProgressMonitor());
// return RemoteHelper.getProcessBuffer(projectInfo.getConnection()).getMergedOutputLines();
return root.getAbsolutePath() + "/build/";
}
diff --git a/plugins/org.yocto.bc.ui/src/org/yocto/bc/remote/utils/RemoteHelper.java b/plugins/org.yocto.bc.ui/src/org/yocto/bc/remote/utils/RemoteHelper.java
index 814e3a5..6b8ebfc 100644
--- a/plugins/org.yocto.bc.ui/src/org/yocto/bc/remote/utils/RemoteHelper.java
+++ b/plugins/org.yocto.bc.ui/src/org/yocto/bc/remote/utils/RemoteHelper.java
@@ -10,9 +10,12 @@
********************************************************************************/
package org.yocto.bc.remote.utils;

+import java.io.BufferedReader;
import java.io.File;
+import java.io.InputStreamReader;
import java.net.URI;
import java.net.URISyntaxException;
+import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@@ -25,16 +28,20 @@ import org.eclipse.core.runtime.OperationCanceledException;
import org.eclipse.core.runtime.Path;
import org.eclipse.core.runtime.Status;
import org.eclipse.core.runtime.SubProgressMonitor;
+import org.eclipse.osgi.util.NLS;
import org.eclipse.ptp.remote.core.IRemoteConnection;
import org.eclipse.rse.core.RSECorePlugin;
import org.eclipse.rse.core.model.IHost;
import org.eclipse.rse.core.model.ISystemRegistry;
import org.eclipse.rse.core.subsystems.ISubSystem;
+import org.eclipse.rse.internal.services.local.shells.LocalShellService;
import org.eclipse.rse.services.IService;
import org.eclipse.rse.services.clientserver.messages.SystemMessageException;
import org.eclipse.rse.services.files.IFileService;
import org.eclipse.rse.services.files.IHostFile;
+import org.eclipse.rse.services.shells.HostShellProcessAdapter;
import org.eclipse.rse.services.shells.IHostShell;
+import org.eclipse.rse.services.shells.IShellService;
import org.eclipse.rse.subsystems.files.core.model.RemoteFileUtility;
import org.eclipse.rse.subsystems.files.core.servicesubsystem.FileServiceSubSystem;
import org.eclipse.rse.subsystems.files.core.servicesubsystem.IFileServiceSubSystem;
@@ -49,6 +56,78 @@ public class RemoteHelper {
public static final int TOTALWORKLOAD = 100;
private static Map<IHost, RemoteMachine> machines;

+ public static Map<String, String> environment;
+ public static final String PROXY = "proxy";
+
+ public static ISubSystem getCmdSubsystem(IHost host) {
+ if (host == null)
+ return null;
+ ISubSystem[] subSystems = host.getSubSystems();
+ for (int i = 0; i < subSystems.length; i++) {
+ if (subSystems[i] instanceof IRemoteCmdSubSystem)
+ return subSystems[i];
+ }
+ return null;
+ }
+ public static ISubSystem getConnectedCmdService(
+ IHost currentConnection, IProgressMonitor monitor) throws Exception {
+ final ISubSystem subsystem = getCmdSubsystem(currentConnection);
+
+ if (subsystem == null)
+ throw new Exception(Messages.ErrorNoSubsystem);
+
+ try {
+ subsystem.connect(monitor, false);
+ } catch (CoreException e) {
+ throw e;
+ } catch (OperationCanceledException e) {
+ throw new CoreException(Status.CANCEL_STATUS);
+ }
+
+ if (!subsystem.isConnected())
+ throw new Exception(Messages.ErrorConnectSubsystem);
+
+
+ return (subsystem);
+ }
+ public static void getRemoteEnvProxyVars(IHost connection, String initialDir, IProgressMonitor monitor){
+ try {
+ if (environment != null && !environment.isEmpty())
+ return;
+
+ environment = new HashMap<String, String>();
+
+ IShellService shellService = (IShellService) getConnectedShellService(connection, new SubProgressMonitor(monitor, 7));
+
+
+ HostShellProcessAdapter p = null;
+ ProcessStreamBuffer buffer = null;
+ try {
+ SubProgressMonitor subMonitor = new SubProgressMonitor(monitor, 3);
+ IHostShell hostShell = shellService.runCommand(initialDir, "env" + " ; echo " + TERMINATOR + "; exit;", new String[]{}, subMonitor);
+ p = new HostShellProcessAdapter(hostShell);
+ buffer = processOutput(p, subMonitor);
+ for(int i = 0; i < buffer.getOutputLines().size(); i++) {
+ String out = buffer.getOutputLines().get(i);
+ String[] tokens = out.split("=");
+ if (tokens.length != 2)
+ continue;
+ String varName = tokens[0];
+ String varValue = tokens[1];
+ if (varName.contains(PROXY))
+ environment.put(varName, varValue);
+ }
+ } catch (Exception e) {
+ if (p != null) {
+ p.destroy();
+ }
+ e.printStackTrace();
+ }
+
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ }
public static RemoteMachine getRemoteMachine(IHost connection){
if (!getMachines().containsKey(connection))
getMachines().put(connection, new RemoteMachine(connection));
@@ -198,15 +277,115 @@ public class RemoteHelper {
return getRemoteMachine(connection).getShellService(monitor);
}

- public static ISubSystem getCmdSubsystem(IHost host) {
- if (host == null)
- return null;
- ISubSystem[] subSystems = host.getSubSystems();
- for (int i = 0; i < subSystems.length; i++) {
- if (subSystems[i] instanceof IRemoteCmdSubSystem)
- return subSystems[i];
+ public static void handleRunCommandRemote(IHost connection, YoctoCommand cmd, IProgressMonitor monitor){
+ try {
+ Process process = testRunCommandRemote(connection, cmd, monitor);
+ cmd.setProcessBuffer(processOutput(process, monitor));
+ } catch (Exception e) {
+ e.printStackTrace();
}
- return null;
+ }
+ private static ProcessStreamBuffer processOutput(Process process, IProgressMonitor monitor) throws Exception {
+ if (process == null)
+ throw new Exception("An error has occured while trying to run remote command!");
+ ProcessStreamBuffer processBuffer = new ProcessStreamBuffer();
+
+ BufferedReader inbr = new BufferedReader(new InputStreamReader(process.getInputStream()));
+ BufferedReader errbr = new BufferedReader(new InputStreamReader(process.getErrorStream()));
+ boolean cancel = false;
+ while (!cancel) {
+ if(monitor.isCanceled()) {
+ cancel = true;
+ throw new InterruptedException("User Cancelled");
+ }
+ StringBuffer buffer = new StringBuffer();
+ int c;
+ while ((c = errbr.read()) != -1) {
+ char ch = (char) c;
+ buffer.append(ch);
+ if (ch == '\n'){
+ String str = buffer.toString();
+ processBuffer.addErrorLine(str);
+ System.out.println(str);
+ if (str.trim().equals(TERMINATOR)) {
+ break;
+ }
+ buffer.delete(0, buffer.length());
+ }
+ }
+
+ while ((c = inbr.read()) != -1) {
+ char ch = (char) c;
+ buffer.append(ch);
+ if (ch == '\n'){
+ String str = buffer.toString();
+ processBuffer.addOutputLine(str);
+ System.out.println(str);
+ if (str.trim().equals(TERMINATOR)) {
+ break;
+ }
+ buffer.delete(0, buffer.length());
+ }
+ }
+ cancel = true;
+ }
+ return processBuffer;
+ }
+
+ public static String[] prepareEnvString(IHost connection, String initialDir, IProgressMonitor monitor){
+ IShellService shellService;
+ String[] env = null;
+ try {
+ shellService = (IShellService) getConnectedShellService(connection, new SubProgressMonitor(monitor, 7));
+ if (shellService instanceof LocalShellService) {
+ env = shellService.getHostEnvironment();
+ } else {
+ List<String> envList = new ArrayList<String>();
+ getRemoteEnvProxyVars(connection, initialDir, monitor);
+ String value = "";
+ for (String varName : environment.keySet()){
+ value = varName + "=" + environment.get(varName);
+ envList.add(value);
+ }
+ env = envList.toArray(new String[envList.size()]);
+ }
+ } catch (Exception e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+
+ return env;
+ }
+ public static Process testRunCommandRemote(IHost connection, YoctoCommand cmd,
+ IProgressMonitor monitor) throws CoreException {
+
+ monitor.beginTask(NLS.bind(Messages.RemoteShellExec_1,
+ cmd, cmd.getArguments()), 10);
+
+ String remoteCommand = cmd + " " + cmd.getArguments() + " ; echo " + TERMINATOR + "; exit ;";
+
+ IShellService shellService;
+ Process p = null;
+// boolean cancel = false;
+ try {
+ shellService = (IShellService) getConnectedShellService(connection, new SubProgressMonitor(monitor, 7));
+
+ String env[] = prepareEnvString(connection, cmd.getInitialDirectory(), monitor);
+
+ try {
+ IHostShell hostShell = shellService.runCommand(cmd.getInitialDirectory(), remoteCommand, env, new SubProgressMonitor(monitor, 3));
+ p = new HostShellProcessAdapter(hostShell);
+
+ } catch (Exception e) {
+ if (p != null) {
+ p.destroy();
+ }
+ e.printStackTrace();
+ }
+ } catch (Exception e1) {
+ e1.printStackTrace();
+ }
+ return p;
}

public static void getRemoteFile(IHost connection, String localExePath, String remoteExePath,
@@ -248,53 +427,53 @@ public class RemoteHelper {
return null;
}

- public static boolean runCommandRemote(final IHost connection, final YoctoCommand cmd) throws Exception {
- final String remoteCommand = cmd.getCommand() + " " + cmd.getArguments();
- final boolean hasErrors = false;
-
- if (!cmd.getInitialDirectory().isEmpty()) {
- writeToShell(connection, "cd " + cmd.getInitialDirectory());
- }
- if (!hasErrors)
- writeToShell(connection, remoteCommand);
-
- return hasErrors;
- }
-
- public static boolean writeToShell(final IHost connection, final String remoteCommand){
- new Thread(new Runnable() {
- @Override
- public void run() {
- try {
- YoctoHostShellProcessAdapter adapter = getHostShellProcessAdapter(connection);
- String fullRemoteCommand = remoteCommand + "; echo " + TERMINATOR + ";";
- adapter.setLastCommand(fullRemoteCommand);
- getHostShell(connection).writeToShell(fullRemoteCommand);
- while (!adapter.isFinished())
- Thread.sleep(2);
- } catch (Exception e) {
- e.printStackTrace();
- }
- }
- }).run();
- return true;
- }
-
- public static void runBatchRemote(IHost connection, List<YoctoCommand> cmds, boolean displayOutput) throws CoreException {
- try {
- String remoteCommand = "";
- for (YoctoCommand cmd : cmds) {
- remoteCommand = cmd.getCommand() + " " + cmd.getArguments();
- if (!cmd.getInitialDirectory().isEmpty()) {
- writeToShell(connection, "cd " + cmd.getInitialDirectory());
- }
- writeToShell(connection, remoteCommand);
- }
-
- } catch (Exception e1) {
- e1.printStackTrace();
- }
- }
+// public static boolean runCommandRemote(final IHost connection, final YoctoCommand cmd) throws Exception {
+// final String remoteCommand = cmd.getCommand() + " " + cmd.getArguments();
+// final boolean hasErrors = false;
+//
+// if (!cmd.getInitialDirectory().isEmpty()) {
+// writeToShell(connection, "cd " + cmd.getInitialDirectory());
+// }
+// if (!hasErrors)
+// writeToShell(connection, remoteCommand);
+//
+// return hasErrors;
+// }
+//
+// public static boolean writeToShell(final IHost connection, final String remoteCommand){
+// new Thread(new Runnable() {
+// @Override
+// public void run() {
+// try {
+// YoctoHostShellProcessAdapter adapter = getHostShellProcessAdapter(connection);
+// String fullRemoteCommand = remoteCommand + "; echo " + TERMINATOR + "; exit ;";
+// adapter.setLastCommand(fullRemoteCommand);
+// getHostShell(connection).writeToShell(fullRemoteCommand);
+// while (!adapter.isFinished())
+// Thread.sleep(2);
+// } catch (Exception e) {
+// e.printStackTrace();
+// }
+// }
+// }).run();
+// return true;
+// }
+
+// public static void runBatchRemote(IHost connection, List<YoctoCommand> cmds, boolean displayOutput) throws CoreException {
+// try {
+// String remoteCommand = "";
+// for (YoctoCommand cmd : cmds) {
+// remoteCommand = cmd.getCommand() + " " + cmd.getArguments();
+// if (!cmd.getInitialDirectory().isEmpty()) {
+// writeToShell(connection, "cd " + cmd.getInitialDirectory());
+// }
+// writeToShell(connection, remoteCommand);
+// }
+//
+// } catch (Exception e1) {
+// e1.printStackTrace();
+// }
+// }

/**
* Throws a core exception with an error status object built from the given
diff --git a/plugins/org.yocto.bc.ui/src/org/yocto/bc/remote/utils/YoctoRunnableWithProgress.java b/plugins/org.yocto.bc.ui/src/org/yocto/bc/remote/utils/YoctoRunnableWithProgress.java
index b6ed2b8..82ba0ba 100644
--- a/plugins/org.yocto.bc.ui/src/org/yocto/bc/remote/utils/YoctoRunnableWithProgress.java
+++ b/plugins/org.yocto.bc.ui/src/org/yocto/bc/remote/utils/YoctoRunnableWithProgress.java
@@ -20,7 +20,7 @@ public class YoctoRunnableWithProgress extends YoctoHostShellProcessAdapter
private String cmd;
private String args;
private IProgressMonitor monitor;
-
+
public YoctoRunnableWithProgress(IHostShell hostShell,
ProcessStreamBuffer processStreamBuffer,
CommandResponseHandler commandResponseHandler) throws IOException {
@@ -33,7 +33,7 @@ public class YoctoRunnableWithProgress extends YoctoHostShellProcessAdapter
try {
this.monitor = monitor;
this.monitor.beginTask(taskName, RemoteHelper.TOTALWORKLOAD);
-
+
if (!remoteConnection.isOpen()) {
try {
remoteConnection.open(monitor);
@@ -48,7 +48,8 @@ public class YoctoRunnableWithProgress extends YoctoHostShellProcessAdapter

try {
IHost connection = RemoteHelper.getRemoteConnectionByName(remoteConnection.getName());
- RemoteHelper.runCommandRemote(connection, new YoctoCommand(cmd, "", args));
+// RemoteHelper.runCommandRemote(connection, new YoctoCommand(cmd, "", args));
+ RemoteHelper.handleRunCommandRemote(connection, new YoctoCommand(cmd, "", args), monitor);
} catch (Exception e) {
e.printStackTrace();
} finally {
diff --git a/plugins/org.yocto.bc.ui/src/org/yocto/bc/ui/wizards/NewBitBakeFileRecipeWizard.java b/plugins/org.yocto.bc.ui/src/org/yocto/bc/ui/wizards/NewBitBakeFileRecipeWizard.java
index 7345b77..66c4b9d 100644
--- a/plugins/org.yocto.bc.ui/src/org/yocto/bc/ui/wizards/NewBitBakeFileRecipeWizard.java
+++ b/plugins/org.yocto.bc.ui/src/org/yocto/bc/ui/wizards/NewBitBakeFileRecipeWizard.java
@@ -204,7 +204,8 @@ public class NewBitBakeFileRecipeWizard extends Wizard implements INewWizard {
public void run(IProgressMonitor monitor) throws InvocationTargetException {
try {
doFinish(element, monitor);
- RemoteHelper.runCommandRemote(connection, new YoctoCommand("rm -rf " + element.getMetaDir() + "/temp", "", ""));
+// RemoteHelper.runCommandRemote(connection, new YoctoCommand("rm -rf " + element.getMetaDir() + "/temp", "", ""));
+ RemoteHelper.handleRunCommandRemote(connection, new YoctoCommand("rm -rf " + element.getMetaDir() + "/temp", "", ""), monitor);
} catch (Exception e) {
throw new InvocationTargetException(e);
} finally {
diff --git a/plugins/org.yocto.bc.ui/src/org/yocto/bc/ui/wizards/NewBitBakeFileRecipeWizardPage.java b/plugins/org.yocto.bc.ui/src/org/yocto/bc/ui/wizards/NewBitBakeFileRecipeWizardPage.java
index a52c2fe..114a484 100644
--- a/plugins/org.yocto.bc.ui/src/org/yocto/bc/ui/wizards/NewBitBakeFileRecipeWizardPage.java
+++ b/plugins/org.yocto.bc.ui/src/org/yocto/bc/ui/wizards/NewBitBakeFileRecipeWizardPage.java
@@ -91,7 +91,6 @@ public class NewBitBakeFileRecipeWizardPage extends WizardPage {
private static final String MIRRORS_FILE = "mirrors.bbclass";
private static final String CLASSES_FOLDER = "classes";
private static final String COPYING_FILE = "COPYING";
- private static final String WHITESPACES = "\\s+";
private static final String CMAKE_LIST = "cmakelists.txt";
private static final String CMAKE = "cmake";
private static final String SETUP_SCRIPT = "setup.py";
@@ -104,9 +103,9 @@ public class NewBitBakeFileRecipeWizardPage extends WizardPage {

private HashMap<String, String> mirrorTable;
private URI extractDir;
- private YoctoCommand licenseChecksumCmd;
- protected YoctoCommand md5YCmd;
- protected YoctoCommand sha256YCmd;
+ protected ProcessStreamBuffer md5Buffer;
+ protected ProcessStreamBuffer sha256Buffer;
+ protected ProcessStreamBuffer md5CopyingBuffer;

public NewBitBakeFileRecipeWizardPage(ISelection selection, IHost connection) {
super("wizardPage");
@@ -331,7 +330,7 @@ public class NewBitBakeFileRecipeWizardPage extends WizardPage {
}

private void handleLocalPopulate(URI srcURI, IProgressMonitor monitor) {
- populateLicenseFileChecksum(srcURI);
+ populateLicenseFileChecksum(srcURI, monitor);
populateInheritance(srcURI, monitor);
}

@@ -345,47 +344,61 @@ public class NewBitBakeFileRecipeWizardPage extends WizardPage {
public void run(IProgressMonitor monitor) throws InvocationTargetException,
InterruptedException {
monitor.beginTask("Populating recipe fields ... ", 100);
- List<YoctoCommand> commands = new ArrayList<YoctoCommand>();
+// List<YoctoCommand> commands = new ArrayList<YoctoCommand>();

try {
String metaDirLocPath = metaDirLoc.getPath();

monitor.subTask("Cleaning environment");
- commands.add(new YoctoCommand("rm -rf " + TEMP_FOLDER_NAME, metaDirLocPath, ""));
- commands.add(new YoctoCommand( "mkdir " + TEMP_FOLDER_NAME, metaDirLocPath, ""));
+// commands.add(new YoctoCommand("rm -rf " + TEMP_FOLDER_NAME, metaDirLocPath, ""));
+ YoctoCommand rmYCmd = new YoctoCommand("rm -rf " + TEMP_FOLDER_NAME, metaDirLocPath, "");
+ RemoteHelper.handleRunCommandRemote(connection, rmYCmd, monitor);
+
+// commands.add(new YoctoCommand( "mkdir " + TEMP_FOLDER_NAME, metaDirLocPath, ""));
+ YoctoCommand mkdirYCmd = new YoctoCommand( "mkdir " + TEMP_FOLDER_NAME, metaDirLocPath, "");
+ RemoteHelper.handleRunCommandRemote(connection, mkdirYCmd, monitor);
+
updateTempFolderPath();
monitor.worked(10);

monitor.subTask("Downloading package sources");
- commands.add(new YoctoCommand("wget " + srcURI.toURL(), tempFolderPath, ""));
+// commands.add(new YoctoCommand("wget " + srcURI.toURL(), tempFolderPath, ""));

updateTempFolderPath();
- RemoteHelper.runBatchRemote(connection, commands, true);
+// RemoteHelper.runBatchRemote(connection, commands, true);

- commands.clear();
+ YoctoCommand wgetYCmd = new YoctoCommand("wget " + srcURI.toURL(), tempFolderPath, "");
+ RemoteHelper.handleRunCommandRemote(connection, wgetYCmd, monitor);
+
+// commands.clear();
monitor.worked(50);

monitor.subTask("Compute package checksums");
String md5Cmd = "md5sum " + srcFileNameExt;
- md5YCmd = new YoctoCommand(md5Cmd, tempFolderPath, "");
- RemoteHelper.runCommandRemote(connection, md5YCmd);
+ YoctoCommand md5YCmd = new YoctoCommand(md5Cmd, tempFolderPath, "");
+// RemoteHelper.runCommandRemote(connection, md5YCmd);
+ RemoteHelper.handleRunCommandRemote(connection, md5YCmd, monitor);
+ md5Buffer = md5YCmd.getProcessBuffer();

monitor.worked(60);

String sha256Cmd = "sha256sum " + srcFileNameExt;
- sha256YCmd = new YoctoCommand(sha256Cmd, tempFolderPath, "");
- RemoteHelper.runCommandRemote(connection, sha256YCmd);
+ YoctoCommand sha256YCmd = new YoctoCommand(sha256Cmd, tempFolderPath, "");
+// RemoteHelper.runCommandRemote(connection, sha256YCmd);
+ RemoteHelper.handleRunCommandRemote(connection, sha256YCmd, monitor);
+ sha256Buffer = sha256YCmd.getProcessBuffer();

monitor.worked(70);

monitor.subTask("Extracting package");
- extractDir = extractPackage(srcURI);
+ extractDir = extractPackage(srcURI, monitor);
monitor.worked(80);

- licenseChecksumCmd = populateLicenseFileChecksum(extractDir);
+ YoctoCommand licenseChecksumCmd = populateLicenseFileChecksum(extractDir, monitor);
+ md5CopyingBuffer = licenseChecksumCmd.getProcessBuffer();

monitor.subTask("Creating mirror lookup table");
- mirrorTable = createMirrorLookupTable();
+ mirrorTable = createMirrorLookupTable(monitor);

monitor.worked(90);
monitor.done();
@@ -397,20 +410,20 @@ public class NewBitBakeFileRecipeWizardPage extends WizardPage {
updateSrcUri(mirrorTable, srcURI);
populateInheritance(extractDir, monitor);

- String md5Val = retrieveSum(srcFileNameExt, md5Pattern);
+ String md5Val = md5Buffer.getOutputLineContaining(srcFileNameExt, md5Pattern);
md5sumText.setText(Pattern.matches(md5Pattern, md5Val) ? md5Val : "");
- String sha256Val = retrieveSum(srcFileNameExt, sha256Pattern);
+ String sha256Val = sha256Buffer.getOutputLineContaining(srcFileNameExt, sha256Pattern);
sha256sumText.setText(Pattern.matches(sha256Pattern, sha256Val) ? sha256Val : "");
- String checkSumVal = retrieveSum(COPYING_FILE, md5Pattern);
+ String checkSumVal = md5CopyingBuffer.getOutputLineContaining(COPYING_FILE, md5Pattern);
checksumText.setText(RemoteHelper.createNewURI(extractDir, COPYING_FILE).toString() + ";md5=" + (Pattern.matches(md5Pattern, checkSumVal) ? checkSumVal : ""));
}

- private String retrieveSum(String arg, String pattern) {
- ProcessStreamBuffer buffer = RemoteHelper.getProcessBuffer(this.connection);
- return buffer.getOutputLineContaining(arg, pattern);
- }
+// private String retrieveSum(String arg, String pattern) {
+// ProcessStreamBuffer buffer = RemoteHelper.getProcessBuffer(this.connection);
+// return buffer.getOutputLineContaining(arg, pattern);
+// }

- private URI extractPackage(URI srcURI) {
+ private URI extractPackage(URI srcURI, IProgressMonitor monitor) {
try {
String path = srcFileNameExt;
String tarCmd = "tar ";
@@ -420,7 +433,8 @@ public class NewBitBakeFileRecipeWizardPage extends WizardPage {
tarCmd += "-xvf ";
}

- RemoteHelper.runCommandRemote(connection, new YoctoCommand(tarCmd + path, tempFolderPath, ""));
+// RemoteHelper.runCommandRemote(connection, new YoctoCommand(tarCmd + path, tempFolderPath, ""));
+ RemoteHelper.handleRunCommandRemote(connection, new YoctoCommand(tarCmd + path, tempFolderPath, ""), new NullProgressMonitor());

return RemoteHelper.createNewURI(metaDirLoc, TEMP_FOLDER_NAME + "/" + srcFileName);

@@ -456,13 +470,14 @@ public class NewBitBakeFileRecipeWizardPage extends WizardPage {
}
}

- private YoctoCommand populateLicenseFileChecksum(URI extractDir) {
+ private YoctoCommand populateLicenseFileChecksum(URI extractDir, IProgressMonitor monitor) {
if (extractDir == null)
throw new RuntimeException("Something went wrong during source extraction!");

try {
YoctoCommand catCmd = new YoctoCommand("md5sum " + COPYING_FILE, extractDir.getPath(), "");
- RemoteHelper.runCommandRemote(connection, catCmd);
+// RemoteHelper.runCommandRemote(connection, catCmd);
+ RemoteHelper.handleRunCommandRemote(connection, catCmd, monitor);
return catCmd;
} catch (Exception e) {
throw new RuntimeException("Unable to process file for MD5 calculation", e);
@@ -491,11 +506,12 @@ public class NewBitBakeFileRecipeWizardPage extends WizardPage {
return "";
}

- private HashMap<String, String> createMirrorLookupTable() throws Exception {
+ private HashMap<String, String> createMirrorLookupTable(IProgressMonitor monitor) throws Exception {
HashMap<String, String> mirrorMap = new HashMap<String, String>();

YoctoCommand cmd = new YoctoCommand("cat " + MIRRORS_FILE, getMetaFolderPath() + CLASSES_FOLDER, "");
- RemoteHelper.runCommandRemote(connection, cmd);
+// RemoteHelper.runCommandRemote(connection, cmd);
+ RemoteHelper.handleRunCommandRemote(connection, cmd, monitor);

if (!cmd.getProcessBuffer().hasErrors()){
String delims = "[\\t]+";
--
1.7.9.5


Re: gcov on target

Robert Berger <gmane@...>
 

Hi Thomas,

On 01/11/2013 06:19 PM, Thomas Petazzoni wrote:
Did someone manage to build/run gcov for an armv7a?
... or let's put it otherwise: Why doesn't it exist on the target?
I supposed the idea is to generate to coverage data on the target, and
then analyze them with gcov on the build machine. See
http://gcc.gnu.org/onlinedocs/gcc/Cross_002dprofiling.html#Cross_002dprofiling.

Yes this should work. Thanks!
It's also documented in the kernel source tree [1].


Best regards,

Thomas
[1]:
http://git.kernel.org/?p=linux/kernel/git/stable/linux-stable.git;a=blob;f=Documentation/gcov.txt;h=e7ca6478cd93d4e6422d1ae92455b347dbdf7ccb;hb=HEAD

Regards,

Robert
..."About Basic: mentally mutilated potential programmers beyond hope of
regeneration." -- Dijkstra

My public pgp key is available,at:
http://pgp.mit.edu:11371/pks/lookup?op=get&search=0x90320BF1


Re: meta-cedartrail - where is grub configured for 'install' option?

Darren Hart <dvhart@...>
 

On 01/11/2013 01:00 AM, Chris Tapp wrote:

BTW the change I need to make to the grub file is partially related -
the boot device is sda and the internal (install target) is sdb. Grub
gets configured to boot from sdb but the device is sda on a clean
boot.
That is definitely a weakness in the installer. Would you please open a
bug for this? An improved installer is something we are working on and
this would be good input to track.

Thanks,

--
Darren Hart
Intel Open Source Technology Center
Yocto Project - Technical Lead - Linux Kernel


Re: gcov on target

Thomas Petazzoni
 

Dear Robert Berger,

On Fri, 11 Jan 2013 12:24:47 +0200, Robert Berger wrote:

I use Yocto Project, 1.3 "danny" for a beagle-xm and would like to show
kernel code coverage with a core-image-sato-sdk.
This image is pretty complete. Unfortunately there is no gcov available
on the target.

It looks like it's only built for the host.

Did someone manage to build/run gcov for an armv7a?
... or let's put it otherwise: Why doesn't it exist on the target?
I supposed the idea is to generate to coverage data on the target, and
then analyze them with gcov on the build machine. See
http://gcc.gnu.org/onlinedocs/gcc/Cross_002dprofiling.html#Cross_002dprofiling.

Best regards,

Thomas
--
Thomas Petazzoni, Free Electrons
Kernel, drivers, real-time and embedded Linux
development, consulting, training and support.
http://free-electrons.com


gcov on target

Robert Berger <gmane@...>
 

Hi,

I use Yocto Project, 1.3 "danny" for a beagle-xm and would like to show
kernel code coverage with a core-image-sato-sdk.
This image is pretty complete. Unfortunately there is no gcov available
on the target.

It looks like it's only built for the host.

Did someone manage to build/run gcov for an armv7a?
... or let's put it otherwise: Why doesn't it exist on the target?

Regards,

Robert...The most likely way for the world to be destroyed, most experts
agree, is by accident. That's where we come in; we're computer
professionals. We cause accidents.

My public pgp key is available,at:
http://pgp.mit.edu:11371/pks/lookup?op=get&search=0x90320BF1


Re: meta-cedartrail - where is grub configured for 'install' option?

Chris Tapp
 

On 10 Jan 2013, at 17:15, Darren Hart wrote:



On 01/10/2013 12:09 AM, Chris Tapp wrote:
Hi Darren,

On 7 Jan 2013, at 16:44, Darren Hart wrote:

On 12/09/2012 01:39 PM, Chris Tapp wrote:
I am trying to change the 'install' behaviour for the meta-cedartrail image so that the installed system has a different grub.cfg file. Is there a file I can bbappend to achieve this?

image_live.bbclass refers to the 'install' syslinux label that triggers the install, but I've not been able to get from this to how/where grub.cfg is created.
This is currently rather crudely implemented here:

meta/recipes-core/initrdscripts/files/init-install.sh

A better deployment mechanism is something being discussed and which
should make this more configurable.

For now, you could bbappend initramfs-live-install_1.0.bb and replace the
init-install.sh script with your own.
Thanks. I've already got to look at that script anyway as it fails to
install to an internal USB drive on a DN2800-MT board as (I think) it
isn't waiting long enough for it to enumerate when booting the
'install' image.
Hrm, I thought it waited indefinitely for the device to appear. Or is it
finding something else and bailing out of the loop? Where is the failure?
The only other device is the USB drive I booted from. I've not had a chance yet to really look at what's going on, but it looks as if it's not waiting long enough as it reports no installable devices. If I then check when it exits to the shell I can see the drive is there and re-running the script then means it does find it (the script then fails for other reasons to do with the failed run).

It will sometimes install, so it looks as if the wait is nearly long enough.

I'm using an ATP AF512SSGH if that makes a difference.

BTW the change I need to make to the grub file is partially related - the boot device is sda and the internal (install target) is sdb. Grub gets configured to boot from sdb but the device is sda on a clean boot.

--
Darren Hart
Intel Open Source Technology Center
Yocto Project - Technical Lead - Linux Kernel
Chris Tapp

opensource@...
www.keylevel.com


Re: [PATCH 0/3][eclipse-poky][branch:windows-build]

Zhang, Jessica
 

Hi Ioana,

I'm still seeing problems:

1. seems the reinstate OEFilesystem etc. changes is not taking effect, I'm still running into heap space error with my metadata directory with huge build data. So can you create such a metadata directory and run toolchain, and sato-sdk build and see whether you can create the project against it?
2. Ran into another issue while playing with these patch set, if I leave the clone box checked, even though I do see the error message telling me the directory/project already a clone directory, I was still able to click on finish and all process continue on instead of being blocked by the error message.

Thanks,
Jessica

-----Original Message-----
From: yocto-bounces@... [mailto:yocto-bounces@...] On Behalf Of Ioana Grigoropol
Sent: Thursday, January 10, 2013 7:25 AM
To: yocto@...
Subject: [yocto] [PATCH 0/3][eclipse-poky][branch:windows-build]

*** BLURB HERE ***

Ioana Grigoropol (1):
Fix variables hoover & remote file system detection

yocto (2):
Allow '-' in project names Signed-off-by: yocto
<yocto@yocto-VirtualBox.(none)>
Reinstate OEFileSystem, OEFile and Ignored Paths for Linux

plugins/org.yocto.bc.ui/META-INF/MANIFEST.MF | 2 +-
plugins/org.yocto.bc.ui/plugin.xml | 3 +-
.../src/org/yocto/bc/bitbake/BBSession.java | 4 +
.../org/yocto/bc/bitbake/ProjectInfoHelper.java | 24 ++--
.../src/org/yocto/bc/bitbake/ShellSession.java | 13 ++-
.../org/yocto/bc/remote/utils/RemoteHelper.java | 7 +-
.../org/yocto/bc/remote/utils/RemoteMachine.java | 8 +-
.../src/org/yocto/bc/ui/Activator.java | 45 +++++---
.../org/yocto/bc/ui/BCResourceChangeListener.java | 1 -
.../bc/ui/editors/bitbake/BBVariableTextHover.java | 12 +-
.../src/org/yocto/bc/ui/filesystem/OEFile.java | 120 ++++----------------
.../org/yocto/bc/ui/filesystem/OEFileSystem.java | 50 ++++++--
.../bc/ui/filesystem/OEFileSystemContributor.java | 7 +-
.../org/yocto/bc/ui/filesystem/OEIgnoreFile.java | 31 ++++-
.../src/org/yocto/bc/ui/model/ProjectInfo.java | 21 +++-
.../src/org/yocto/bc/ui/model/YoctoHostFile.java | 100 ++++++++++++----
.../yocto/bc/ui/wizards/install/OptionsPage.java | 3 +-
.../newproject/CreateBBCProjectOperation.java | 23 ++--
18 files changed, 281 insertions(+), 193 deletions(-)

--
1.7.9.5

_______________________________________________
yocto mailing list
yocto@...
https://lists.yoctoproject.org/listinfo/yocto


Re: Shouldn't linux/version.h appear in the SDK's host sysroot?

Zhang, Jessica
 

Hi Patrick,

The toolchain and sysroot are behaving correctly, the x86_64-pokysdk-linux contains the cross tools for your development host, whereas armv7a-vfp-neon-poky-linux-gnueabi contains your target sysroot, and all your target programs should be using files against that sysroot. By not knowing how your compile your package, but if you look at our ADT manual, you should source the environment setup script before you try to use the toolchain and you also need to pass sysroot option to your compiler and linker for them to go to the target sysroot location for headers and libraries.

Thanks,
Jessica

-----Original Message-----
From: yocto-bounces@... [mailto:yocto-bounces@...] On Behalf Of Patrick Turley
Sent: Thursday, January 10, 2013 2:46 PM
To: yocto@...
Subject: [yocto] Shouldn't linux/version.h appear in the SDK's host sysroot?

I'm using a Yocto-based SDK, produced by:

bitbake meta-toolchain-sdk

This creates the file

poky-eglibc-x86_64-arm-toolchain-gmae-1.3.sh

in the directory

build/tmp/deploy/sdk

I ran the installation script to install the SDK on my build system. Within the SDK installation directory, under "sysroots", I have the following two directories:

armv7a-vfp-neon-poky-linux-gnueabi
x86_64-pokysdk-linux

Unless I'm mistaken, the first one reflects the target environment, and the second one contains what I need to do cross-compilation. Thus, the latter contains the cross-compilation tools, and that's the sysroot to which all my builds are directed.

I'm compiling the lm_sensors package for my target. As part of its work, it tries to discover the version of the target linux kernel. To do this, it compiles a very small file (etc/config.c) that includes the header file <linux/kernel.h>.

As it happens, <linux/kernel.h> does *not* appear in the cross-compilation sysroot, so this simple task fails. That header file *does* appear in the target sysroot, but that's of no use to me in the cross-compilation process.

I believe one of the following is true:

1) The lm_sensors package is doing something entirely legitimate, and the file <linux/kernel.h> *should* appear in the cross-compilation sysroot to support this. The Yocto SDK build target needs a small fix so that <linux/kernel.h> is properly added to the cross-compilation sys root. In the meantime, I can work around this oversight by creating a symbolic link.

2) I've made a mistake in setting up my build environment because I don't understand how cross-compilation *should* be done. If done properly, the cross-compilation process will have access to *both* sysroots and get what it needs from each. If this is the case, please tell me what I appear to have done wrong.

3) Something else.

_______________________________________________
yocto mailing list
yocto@...
https://lists.yoctoproject.org/listinfo/yocto


Shouldn't linux/version.h appear in the SDK's host sysroot?

Patrick Turley <PatrickTurley@...>
 

I'm using a Yocto-based SDK, produced by:

bitbake meta-toolchain-sdk

This creates the file

poky-eglibc-x86_64-arm-toolchain-gmae-1.3.sh

in the directory

build/tmp/deploy/sdk

I ran the installation script to install the SDK on my build system. Within the SDK installation directory, under "sysroots", I have the following two directories:

armv7a-vfp-neon-poky-linux-gnueabi
x86_64-pokysdk-linux

Unless I'm mistaken, the first one reflects the target environment, and the second one contains what I need to do cross-compilation. Thus, the latter contains the cross-compilation tools, and that's the sysroot to which all my builds are directed.

I'm compiling the lm_sensors package for my target. As part of its work, it tries to discover the version of the target linux kernel. To do this, it compiles a very small file (etc/config.c) that includes the header file <linux/kernel.h>.

As it happens, <linux/kernel.h> does *not* appear in the cross-compilation sysroot, so this simple task fails. That header file *does* appear in the target sysroot, but that's of no use to me in the cross-compilation process.

I believe one of the following is true:

1) The lm_sensors package is doing something entirely legitimate, and the file <linux/kernel.h> *should* appear in the cross-compilation sysroot to support this. The Yocto SDK build target needs a small fix so that <linux/kernel.h> is properly added to the cross-compilation sys root. In the meantime, I can work around this oversight by creating a symbolic link.

2) I've made a mistake in setting up my build environment because I don't understand how cross-compilation *should* be done. If done properly, the cross-compilation process will have access to *both* sysroots and get what it needs from each. If this is the case, please tell me what I appear to have done wrong.

3) Something else.


recipes for git gfortran java

Edward Vidal <vidal.develone@...>
 

All,
what is the best way to install git gfortran and  java to beagleboards and pandaboards.
With angstrom builds you use opkg.  Since Yocto is rpm base are there repo that have compiled software.
Any and all help will be appreciated.
Thanks


Re: meta-cedartrail - where is grub configured for 'install' option?

Darren Hart <dvhart@...>
 

On 01/10/2013 12:09 AM, Chris Tapp wrote:
Hi Darren,

On 7 Jan 2013, at 16:44, Darren Hart wrote:

On 12/09/2012 01:39 PM, Chris Tapp wrote:
I am trying to change the 'install' behaviour for the meta-cedartrail image so that the installed system has a different grub.cfg file. Is there a file I can bbappend to achieve this?

image_live.bbclass refers to the 'install' syslinux label that triggers the install, but I've not been able to get from this to how/where grub.cfg is created.
This is currently rather crudely implemented here:

meta/recipes-core/initrdscripts/files/init-install.sh

A better deployment mechanism is something being discussed and which
should make this more configurable.

For now, you could bbappend initramfs-live-install_1.0.bb and replace the
init-install.sh script with your own.
Thanks. I've already got to look at that script anyway as it fails to
install to an internal USB drive on a DN2800-MT board as (I think) it
isn't waiting long enough for it to enumerate when booting the
'install' image.
Hrm, I thought it waited indefinitely for the device to appear. Or is it
finding something else and bailing out of the loop? Where is the failure?

--
Darren Hart
Intel Open Source Technology Center
Yocto Project - Technical Lead - Linux Kernel


[PATCH] Send output from bitbake environment parsing in the background

Ioana Grigoropol <ioanax.grigoropol@...>
 

- after creating the project, the wizard should not block waiting for the environment to be populated and instead should be ran in the background

Signed-off-by: Ioana Grigoropol <ioanax.grigoropol@...>
---
.../src/org/yocto/bc/bitbake/BBSession.java | 83 ++++++++++++--------
.../src/org/yocto/bc/bitbake/ShellSession.java | 3 +-
.../org/yocto/bc/remote/utils/RemoteHelper.java | 3 +-
.../org/yocto/bc/remote/utils/RemoteMachine.java | 3 -
.../remote/utils/YoctoHostShellProcessAdapter.java | 16 +++-
.../org/yocto/bc/ui/filesystem/OEFileSystem.java | 6 --
.../yocto/bc/ui/wizards/FiniteStateWizardPage.java | 54 +++++++------
.../bc/ui/wizards/NewBitBakeFileRecipeWizard.java | 58 +++++++-------
.../yocto/bc/ui/wizards/install/InstallWizard.java | 63 +++++++++------
.../yocto/bc/ui/wizards/install/OptionsPage.java | 10 ++-
10 files changed, 174 insertions(+), 125 deletions(-)

diff --git a/plugins/org.yocto.bc.ui/src/org/yocto/bc/bitbake/BBSession.java b/plugins/org.yocto.bc.ui/src/org/yocto/bc/bitbake/BBSession.java
index 66a6083..124b9a2 100644
--- a/plugins/org.yocto.bc.ui/src/org/yocto/bc/bitbake/BBSession.java
+++ b/plugins/org.yocto.bc.ui/src/org/yocto/bc/bitbake/BBSession.java
@@ -13,8 +13,8 @@ package org.yocto.bc.bitbake;
import java.io.BufferedReader;
import java.io.File;
import java.io.FileFilter;
+import java.io.FileReader;
import java.io.IOException;
-import java.io.StringReader;
import java.net.URI;
import java.util.ArrayList;
import java.util.Arrays;
@@ -48,7 +48,7 @@ import org.yocto.bc.ui.model.ProjectInfo;
/**
* BBSession encapsulates a global bitbake configuration and is the primary interface
* for actions against a BitBake installation.
- *
+ *
* @author kgilmer
*
*/
@@ -57,7 +57,9 @@ public class BBSession implements IBBSessionListener, IModelElement, Map {
public static final int TYPE_UNKNOWN = 2;
public static final int TYPE_STATEMENT = 3;
public static final int TYPE_FLAG = 4;
-
+
+ public static final String BB_ENV_FILE = "bitbake.env";
+
public static final String BUILDDIR_INDICATORS [] = {
"/conf/local.conf",
"/conf/bblayers.conf",
@@ -74,20 +76,20 @@ public class BBSession implements IBBSessionListener, IModelElement, Map {
private final Lock wlock = rwlock.writeLock();
protected String parsingCmd;
private boolean silent = false;
-
+
public BBSession(ShellSession ssession, URI projectRoot) throws IOException {
shell = ssession;
this.pinfo = new ProjectInfo();
pinfo.setLocation(projectRoot);
pinfo.setInitScriptPath(ProjectInfoHelper.getInitScriptPath(projectRoot));
- this.parsingCmd = "DISABLE_SANITY_CHECKS=\"1\" bitbake -e";
+ this.parsingCmd = "sh -c 'DISABLE_SANITY_CHECKS=\"1\" bitbake -e >& " + BB_ENV_FILE + " '" ;
}

public BBSession(ShellSession ssession, URI projectRoot, boolean silent) throws IOException {
this(ssession, projectRoot);
this.silent = silent;
}
-
+
private Collection adapttoIPath(List<File> asList, IProject project) {

List pathList = new ArrayList();
@@ -102,7 +104,7 @@ public class BBSession implements IBBSessionListener, IModelElement, Map {

return pathList;
}
-
+
private String appendAll(String[] elems, int st) {
StringBuffer sb = new StringBuffer();

@@ -112,7 +114,7 @@ public class BBSession implements IBBSessionListener, IModelElement, Map {

return sb.toString();
}
-
+
private int charCount(String trimmed, char c) {
int i = 0;
int p = 0;
@@ -124,11 +126,13 @@ public class BBSession implements IBBSessionListener, IModelElement, Map {

return i;
}
-
+
+ @Override
public void clear() {
throw new RuntimeException("BB configuration is read-only.");
}

+ @Override
public boolean containsKey(Object arg0) {
try {
checkValidAndLock(true);
@@ -141,6 +145,7 @@ public class BBSession implements IBBSessionListener, IModelElement, Map {
}
}

+ @Override
public boolean containsValue(Object arg0) {
try {
checkValidAndLock(true);
@@ -153,6 +158,7 @@ public class BBSession implements IBBSessionListener, IModelElement, Map {
}
}

+ @Override
public Set entrySet() {
try {
checkValidAndLock(true);
@@ -188,7 +194,7 @@ public class BBSession implements IBBSessionListener, IModelElement, Map {

/**
* Recursively generate list of Recipe files from a root directory.
- *
+ *
* @param rootDir
* @param recipes
* @param fileExtension
@@ -197,6 +203,7 @@ public class BBSession implements IBBSessionListener, IModelElement, Map {
private void findRecipes(File rootDir, List recipes, final String fileExtension, IProject project) {
File[] children = rootDir.listFiles(new FileFilter() {

+ @Override
public boolean accept(File pathname) {
return pathname.isFile() && pathname.getName().endsWith(fileExtension);
}
@@ -209,6 +216,7 @@ public class BBSession implements IBBSessionListener, IModelElement, Map {

File[] childDirs = rootDir.listFiles(new FileFilter() {

+ @Override
public boolean accept(File pathname) {
return pathname.isDirectory();
}
@@ -240,6 +248,7 @@ public class BBSession implements IBBSessionListener, IModelElement, Map {
return recipes;
}

+ @Override
public Object get(Object arg0) {
try {
checkValidAndLock(true);
@@ -274,9 +283,9 @@ public class BBSession implements IBBSessionListener, IModelElement, Map {
conMan.addConsoles(new IConsole[] { sessionConsole });
}
}
-
+
ConsolePlugin.getDefault().getConsoleManager().showConsoleView(sessionConsole);
-
+
return sessionConsole;
}

@@ -348,6 +357,7 @@ public class BBSession implements IBBSessionListener, IModelElement, Map {
if(clear)
console.clearConsole();
new WorkbenchJob("Display parsing result") {
+ @Override
public IStatus runInUIThread(IProgressMonitor monitor) {
if(code != 0) {
info.setColor(JFaceResources.getColorRegistry().get(JFacePreferences.ERROR_COLOR));
@@ -378,11 +388,11 @@ public class BBSession implements IBBSessionListener, IModelElement, Map {
if(!initialized) { //recheck
boolean hasErrors = false;
String result = shell.execute(parsingCmd, hasErrors);
- if(!hasErrors) {
- properties = parseBBEnvironment(result);
- } else {
- properties = parseBBEnvironment("");
- }
+
+ //FIXME : wait for bitbake to finish
+
+ properties = parseBBEnvironment(result);
+
initialized = true;
}
} finally {
@@ -396,6 +406,7 @@ public class BBSession implements IBBSessionListener, IModelElement, Map {
//not release lock
}

+ @Override
public void initialize() throws Exception {
try {
checkValidAndLock(false);
@@ -414,6 +425,7 @@ public class BBSession implements IBBSessionListener, IModelElement, Map {
// return trimmed.indexOf('{') > -1 && trimmed.indexOf('}') == -1;
}

+ @Override
public boolean isEmpty() {
try {
checkValidAndLock(true);
@@ -425,7 +437,8 @@ public class BBSession implements IBBSessionListener, IModelElement, Map {
rlock.unlock();
}
}
-
+
+ @Override
public Set keySet() {
try {
checkValidAndLock(true);
@@ -438,10 +451,8 @@ public class BBSession implements IBBSessionListener, IModelElement, Map {
}
}

- protected void parse(String content, Map outMap) throws Exception {
- if (content == null)
- return;
- BufferedReader reader = new BufferedReader(new StringReader(content));
+ protected void parse(String bbOutfilePath, Map outMap) throws Exception {
+ BufferedReader reader = new BufferedReader(new FileReader(bbOutfilePath + BB_ENV_FILE));
String line;
boolean inLine = false;
StringBuffer sb = null;
@@ -484,7 +495,7 @@ public class BBSession implements IBBSessionListener, IModelElement, Map {
parseLine(line, outMap);
}
}
-
+
private void parseAdditiveAssignment(String line, String operator, Map mo) throws Exception {
String[] elems = splitAssignment(line, "\\+=");

@@ -507,18 +518,18 @@ public class BBSession implements IBBSessionListener, IModelElement, Map {
protected URI getDefaultDepends() {
return null;
}
-
- protected Map parseBBEnvironment(String bbOut) throws Exception {
+
+ protected Map parseBBEnvironment(String bbOutFilePath) throws Exception {
Map env = new Hashtable();
this.depends = new ArrayList<URI>();

- parse(bbOut, env);
+ parse(bbOutFilePath, env);

String included = (String) env.get("BBINCLUDED");
if(getDefaultDepends() != null) {
this.depends.add(getDefaultDepends());
- }
-
+ }
+
if(included != null) {
String[] includedSplitted = included.split(" ");
for (String incl : includedSplitted){
@@ -531,13 +542,13 @@ public class BBSession implements IBBSessionListener, IModelElement, Map {

return env;
}
-
+

private List parseBBFiles(String bbfiles) {
return Arrays.asList(bbfiles.split(" "));
}
-
- //Map delegate methods
+
+ //Map delegate methods

private void parseConditionalAssignment(String line, Map mo) throws Exception {
String[] elems = splitAssignment(line, "\\?=");
@@ -611,14 +622,17 @@ public class BBSession implements IBBSessionListener, IModelElement, Map {
return l;
}

+ @Override
public Object put(Object arg0, Object arg1) {
throw new RuntimeException("BB configuration is read-only.");
}

+ @Override
public void putAll(Map arg0) {
throw new RuntimeException("BB configuration is read-only.");
}

+ @Override
public Object remove(Object arg0) {
throw new RuntimeException("BB configuration is read-only.");
}
@@ -637,6 +651,7 @@ public class BBSession implements IBBSessionListener, IModelElement, Map {
return line;
}

+ @Override
public int size() {
try {
checkValidAndLock(true);
@@ -686,7 +701,7 @@ public class BBSession implements IBBSessionListener, IModelElement, Map {

/**
* Return a string with variable substitutions in place.
- *
+ *
* @param expression
* @return Input string with any substitutions from this file.
*/
@@ -710,6 +725,7 @@ public class BBSession implements IBBSessionListener, IModelElement, Map {
return expression;
}

+ @Override
public Collection values() {
try {
checkValidAndLock(true);
@@ -722,6 +738,7 @@ public class BBSession implements IBBSessionListener, IModelElement, Map {
}
}

+ @Override
public void changeNotified(IResource[] added, IResource[] removed, IResource[] changed) {
wlock.lock();
try {
@@ -746,8 +763,8 @@ public class BBSession implements IBBSessionListener, IModelElement, Map {
wlock.unlock();
}
}
-
public Map<String, String> getProperties() {
return (Map<String, String>) properties;
}
+
}
diff --git a/plugins/org.yocto.bc.ui/src/org/yocto/bc/bitbake/ShellSession.java b/plugins/org.yocto.bc.ui/src/org/yocto/bc/bitbake/ShellSession.java
index 38e2557..6441029 100644
--- a/plugins/org.yocto.bc.ui/src/org/yocto/bc/bitbake/ShellSession.java
+++ b/plugins/org.yocto.bc.ui/src/org/yocto/bc/bitbake/ShellSession.java
@@ -108,7 +108,8 @@ public class ShellSession {
try {
if (projectInfo.getConnection() != null) {
hasErrors = RemoteHelper.runCommandRemote(projectInfo.getConnection(), new YoctoCommand(command, root.getAbsolutePath() + "/build/", ""));
- return RemoteHelper.getProcessBuffer(projectInfo.getConnection()).getMergedOutputLines();
+// return RemoteHelper.getProcessBuffer(projectInfo.getConnection()).getMergedOutputLines();
+ return root.getAbsolutePath() + "/build/";
}
return null;
} catch (Exception e) {
diff --git a/plugins/org.yocto.bc.ui/src/org/yocto/bc/remote/utils/RemoteHelper.java b/plugins/org.yocto.bc.ui/src/org/yocto/bc/remote/utils/RemoteHelper.java
index e511e06..814e3a5 100644
--- a/plugins/org.yocto.bc.ui/src/org/yocto/bc/remote/utils/RemoteHelper.java
+++ b/plugins/org.yocto.bc.ui/src/org/yocto/bc/remote/utils/RemoteHelper.java
@@ -272,7 +272,6 @@ public class RemoteHelper {
getHostShell(connection).writeToShell(fullRemoteCommand);
while (!adapter.isFinished())
Thread.sleep(2);
-// return hostShellProcessAdapter.hasErrors();
} catch (Exception e) {
e.printStackTrace();
}
@@ -281,7 +280,7 @@ public class RemoteHelper {
return true;
}

- public static void runBatchRemote(IHost connection, List<YoctoCommand> cmds, boolean waitForOutput) throws CoreException {
+ public static void runBatchRemote(IHost connection, List<YoctoCommand> cmds, boolean displayOutput) throws CoreException {
try {
String remoteCommand = "";
for (YoctoCommand cmd : cmds) {
diff --git a/plugins/org.yocto.bc.ui/src/org/yocto/bc/remote/utils/RemoteMachine.java b/plugins/org.yocto.bc.ui/src/org/yocto/bc/remote/utils/RemoteMachine.java
index a25eea4..76c8e8a 100644
--- a/plugins/org.yocto.bc.ui/src/org/yocto/bc/remote/utils/RemoteMachine.java
+++ b/plugins/org.yocto.bc.ui/src/org/yocto/bc/remote/utils/RemoteMachine.java
@@ -123,9 +123,6 @@ public class RemoteMachine {
}

public IHost getConnection() {
-// if (connection == null) {
-// connection = RemoteHelper.getRemoteConnectionForURI(, new NullProgressMonitor());
-// }
return connection;
}
public void setConnection(IHost connection) {
diff --git a/plugins/org.yocto.bc.ui/src/org/yocto/bc/remote/utils/YoctoHostShellProcessAdapter.java b/plugins/org.yocto.bc.ui/src/org/yocto/bc/remote/utils/YoctoHostShellProcessAdapter.java
index bb137b1..2072102 100644
--- a/plugins/org.yocto.bc.ui/src/org/yocto/bc/remote/utils/YoctoHostShellProcessAdapter.java
+++ b/plugins/org.yocto.bc.ui/src/org/yocto/bc/remote/utils/YoctoHostShellProcessAdapter.java
@@ -138,9 +138,10 @@ public class YoctoHostShellProcessAdapter extends HostShellProcessAdapter {
if (value.isEmpty()) {
continue;
}
- System.out.println(value);
+// System.out.println(value);
this.processStreamBuffer.addErrorLine(value);
- this.commandResponseHandler.response(value, false);
+ if (this.commandResponseHandler != null)
+ this.commandResponseHandler.response(value, false);
}
} else {
for (IHostOutput line : lines) {
@@ -156,7 +157,8 @@ public class YoctoHostShellProcessAdapter extends HostShellProcessAdapter {
reportProgress(value);
System.out.println(value);
this.processStreamBuffer.addOutputLine(value);
- this.commandResponseHandler.response(value, false);
+ if (this.commandResponseHandler != null)
+ this.commandResponseHandler.response(value, false);
}
}

@@ -185,4 +187,12 @@ public class YoctoHostShellProcessAdapter extends HostShellProcessAdapter {
return new NullProgressMonitor();
}

+ public CommandResponseHandler getCommandResponseHandler() {
+ return commandResponseHandler;
+ }
+
+ public void setCommandResponseHandler(CommandResponseHandler commandResponseHandler) {
+ this.commandResponseHandler = commandResponseHandler;
+ }
+
}
diff --git a/plugins/org.yocto.bc.ui/src/org/yocto/bc/ui/filesystem/OEFileSystem.java b/plugins/org.yocto.bc.ui/src/org/yocto/bc/ui/filesystem/OEFileSystem.java
index 5efdcdc..4cb0921 100644
--- a/plugins/org.yocto.bc.ui/src/org/yocto/bc/ui/filesystem/OEFileSystem.java
+++ b/plugins/org.yocto.bc.ui/src/org/yocto/bc/ui/filesystem/OEFileSystem.java
@@ -49,12 +49,6 @@ public class OEFileSystem extends FileSystem {
fileStoreCache = new Hashtable();
}

-// public OEFileSystem(ProjectInfo pInfo) {
-// ref = this;
-// projInfo = pInfo;
-// fileStoreCache = new Hashtable();
-// }
-
@Override
public IFileStore getStore(URI uri) {

diff --git a/plugins/org.yocto.bc.ui/src/org/yocto/bc/ui/wizards/FiniteStateWizardPage.java b/plugins/org.yocto.bc.ui/src/org/yocto/bc/ui/wizards/FiniteStateWizardPage.java
index 2ef150a..ef795ff 100644
--- a/plugins/org.yocto.bc.ui/src/org/yocto/bc/ui/wizards/FiniteStateWizardPage.java
+++ b/plugins/org.yocto.bc.ui/src/org/yocto/bc/ui/wizards/FiniteStateWizardPage.java
@@ -29,21 +29,22 @@ public abstract class FiniteStateWizardPage extends WizardPage {

/*
* (non-Javadoc)
- *
+ *
* @see org.eclipse.jface.dialogs.IDialogPage#createControl(org.eclipse.swt.widgets.Composite)
*/
- public abstract void createControl(Composite parent);
+ @Override
+ public abstract void createControl(Composite parent);

protected void setModelWizard() {
if (wizard == null) {
wizard = (FiniteStateWizard)FiniteStateWizardPage.this.getWizard();
}
}
-
+
/**
* Add page validation logic here. Returning <code>true</code> means that
* the page is complete and the user can go to the next page.
- *
+ *
* @return
*/
protected abstract boolean validatePage();
@@ -63,28 +64,29 @@ public abstract class FiniteStateWizardPage extends WizardPage {
protected boolean hasContents(String value) {
if (value == null || value.length() == 0) {
return false;
- }
-
+ }
+
return true;
}
-
+
/**
* This method is called right before a page is displayed.
* This occurs on user action (Next/Back buttons).
*/
public abstract void pageDisplay();
-
+
/**
* This method is called on the concrete WizardPage after the user has
* gone to the page after.
*/
public abstract void pageCleanup();
-
+
/* (non-Javadoc)
* @see org.eclipse.jface.dialogs.IDialogPage#setVisible(boolean)
*/
+ @Override
public void setVisible(boolean arg0) {
-
+
if (!arg0 && previousState) {
pageCleanup();
} else if (arg0 && !previousState) {
@@ -92,59 +94,63 @@ public abstract class FiniteStateWizardPage extends WizardPage {
} else if (arg0 && previousState) {
pageDisplay();
}
-
+
previousState = arg0;
-
+
super.setVisible(arg0);
}
-
+
public class ValidationListener implements SelectionListener, ModifyListener, Listener, ISelectionChangedListener, FocusListener {

/*
* (non-Javadoc)
- *
+ *
* @see org.eclipse.swt.events.SelectionListener#widgetSelected(org.eclipse.swt.events.SelectionEvent)
*/
- public void widgetSelected(SelectionEvent e) {
+ @Override
+ public void widgetSelected(SelectionEvent e) {
validate();
}

/*
* (non-Javadoc)
- *
+ *
* @see org.eclipse.swt.events.SelectionListener#widgetDefaultSelected(org.eclipse.swt.events.SelectionEvent)
*/
- public void widgetDefaultSelected(SelectionEvent e) {
+ @Override
+ public void widgetDefaultSelected(SelectionEvent e) {
}

/*
* (non-Javadoc)
- *
+ *
* @see org.eclipse.swt.events.ModifyListener#modifyText(org.eclipse.swt.events.ModifyEvent)
*/
- public void modifyText(ModifyEvent e) {
+ @Override
+ public void modifyText(ModifyEvent e) {
validate();
}

- public void validate() {
+ public void validate() {
if (validatePage()) {
updateModel();
setPageComplete(true);
return;
}
-
setPageComplete(false);
}

/* (non-Javadoc)
* @see org.eclipse.swt.widgets.Listener#handleEvent(org.eclipse.swt.widgets.Event)
*/
- public void handleEvent(Event event) {
-
+ @Override
+ public void handleEvent(Event event) {
+
validate();
}

- public void selectionChanged(SelectionChangedEvent event) {
+ @Override
+ public void selectionChanged(SelectionChangedEvent event) {
validate();
}

diff --git a/plugins/org.yocto.bc.ui/src/org/yocto/bc/ui/wizards/NewBitBakeFileRecipeWizard.java b/plugins/org.yocto.bc.ui/src/org/yocto/bc/ui/wizards/NewBitBakeFileRecipeWizard.java
index 8457996..7345b77 100644
--- a/plugins/org.yocto.bc.ui/src/org/yocto/bc/ui/wizards/NewBitBakeFileRecipeWizard.java
+++ b/plugins/org.yocto.bc.ui/src/org/yocto/bc/ui/wizards/NewBitBakeFileRecipeWizard.java
@@ -26,7 +26,6 @@ import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.NullProgressMonitor;
import org.eclipse.core.runtime.Path;
import org.eclipse.core.runtime.Status;
import org.eclipse.jface.dialogs.MessageDialog;
@@ -51,12 +50,12 @@ public class NewBitBakeFileRecipeWizard extends Wizard implements INewWizard {
private NewBitBakeFileRecipeWizardPage page;
private ISelection selection;
private IHost connection;
-
+
public NewBitBakeFileRecipeWizard() {
super();
setNeedsProgressMonitor(true);
}
-
+
@Override
public void addPages() {
page = new NewBitBakeFileRecipeWizardPage(selection, connection);
@@ -72,12 +71,12 @@ public class NewBitBakeFileRecipeWizard extends Wizard implements INewWizard {
throwCoreException("Container \"" + element.getContainer() + "\" does not exist.");
}
IContainer container = (IContainer) resource;
-
+
// If the extension wasn't specified, assume .bb
if (!fileName.endsWith(".bb") && !fileName.endsWith(".inc") && !fileName.endsWith(".conf")) {
fileName = fileName + ".bb";
}
-
+
final IFile file = container.getFile(new Path(fileName));
try {
InputStream stream = openContentStream(element);
@@ -92,6 +91,7 @@ public class NewBitBakeFileRecipeWizard extends Wizard implements INewWizard {
monitor.worked(1);
monitor.setTaskName("Opening file for editing...");
getShell().getDisplay().asyncExec(new Runnable() {
+ @Override
public void run() {
IWorkbenchPage page = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage();
try {
@@ -106,14 +106,15 @@ public class NewBitBakeFileRecipeWizard extends Wizard implements INewWizard {
/**
* We will accept the selection in the workbench to see if we can initialize
* from it.
- *
+ *
* @see IWorkbenchWizard#init(IWorkbench, IStructuredSelection)
*/
+ @Override
public void init(IWorkbench workbench, IStructuredSelection selection) {
this.selection = selection;
if (selection instanceof IStructuredSelection) {
- Object element = ((IStructuredSelection)selection).getFirstElement();
-
+ Object element = selection.getFirstElement();
+
if (element instanceof IResource) {
IProject p = ((IResource)element).getProject();
try {
@@ -126,28 +127,28 @@ public class NewBitBakeFileRecipeWizard extends Wizard implements INewWizard {
} catch (InterruptedException e) {
e.printStackTrace();
}
-
+
}
}
}

/**
* We will initialize file contents with a sample text.
- * @param srcuri
- * @param author
- * @param homepage
- * @param license
- * @param description
- * @param fileName
- * @param newPage
+ * @param srcuri
+ * @param author
+ * @param homepage
+ * @param license
+ * @param description
+ * @param fileName
+ * @param newPage
*/

private InputStream openContentStream(BitbakeRecipeUIElement element) {
-
+
StringBuffer sb = new StringBuffer();
-
+
sb.append("DESCRIPTION = \"" + element.getDescription() + "\"\n");
-
+
if (element.getAuthor().length() > 0) {
sb.append("AUTHOR = \"" + element.getAuthor() + "\"\n");
}
@@ -155,11 +156,11 @@ public class NewBitBakeFileRecipeWizard extends Wizard implements INewWizard {
if (element.getHomePage().length() > 0) {
sb.append("HOMEPAGE = \"" + element.getHomePage() + "\"\n");
}
-
+
if (element.getSection().length() > 0) {
sb.append("SECTION = \"" + element.getSection() + "\"\n");
}
-
+
if (element.getLicense().length() > 0) {
sb.append("LICENSE = \"" + element.getLicense() + "\"\n");
}
@@ -167,26 +168,26 @@ public class NewBitBakeFileRecipeWizard extends Wizard implements INewWizard {
if (element.getChecksum().length() > 0) {
sb.append("LIC_FILES_CHKSUM = \"" + element.getChecksum() + "\"\n");
}
-
+
if (element.getSrcuri().length() > 0) {
sb.append("SRC_URI = \"" + element.getSrcuri() + "\"\n");
}
-
+
if (element.getMd5sum().length() > 0) {
sb.append("SRC_URI[md5sum] = \"" + element.getMd5sum() + "\"\n");
}
-
+
if (element.getsha256sum().length() > 0) {
sb.append("SRC_URI[sha256sum] = \"" + element.getsha256sum() + "\"\n");
}
-
+
ArrayList<String> inheritance = element.getInheritance();
if (!inheritance.isEmpty()) {
Object ia[] = inheritance.toArray();
String inheritance_str = "inherit ";
for(int i=0; i<ia.length; i++)
inheritance_str += ((String) ia[i]) + " ";
- sb.append(inheritance_str);
+ sb.append(inheritance_str);
}
sb.append("\n");

@@ -195,10 +196,11 @@ public class NewBitBakeFileRecipeWizard extends Wizard implements INewWizard {

@Override
public boolean performFinish() {
-
+
final BitbakeRecipeUIElement element = page.populateUIElement();
-
+
IRunnableWithProgress op = new IRunnableWithProgress() {
+ @Override
public void run(IProgressMonitor monitor) throws InvocationTargetException {
try {
doFinish(element, monitor);
diff --git a/plugins/org.yocto.bc.ui/src/org/yocto/bc/ui/wizards/install/InstallWizard.java b/plugins/org.yocto.bc.ui/src/org/yocto/bc/ui/wizards/install/InstallWizard.java
index 77f4d2c..4fbaca3 100644
--- a/plugins/org.yocto.bc.ui/src/org/yocto/bc/ui/wizards/install/InstallWizard.java
+++ b/plugins/org.yocto.bc.ui/src/org/yocto/bc/ui/wizards/install/InstallWizard.java
@@ -6,6 +6,7 @@ import java.util.Hashtable;
import java.util.Map;

import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.NullProgressMonitor;
import org.eclipse.core.runtime.Status;
import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.jface.wizard.IWizardContainer;
@@ -28,13 +29,13 @@ import org.yocto.bc.ui.wizards.newproject.CreateBBCProjectOperation;

/**
* A wizard for installing a fresh copy of an OE system.
- *
+ *
* @author kgilmer
- *
+ *
* A Wizard for creating a fresh Yocto bitbake project and new poky build tree from git
- *
+ *
* @modified jzhang
- *
+ *
*/
public class InstallWizard extends FiniteStateWizard implements IWorkbenchWizard {

@@ -43,14 +44,14 @@ public class InstallWizard extends FiniteStateWizard implements IWorkbenchWizard
protected static final String INSTALL_SCRIPT = "INSTALL_SCRIPT";
protected static final String INSTALL_DIRECTORY = "Install Directory";
protected static final String INIT_SCRIPT = "Init Script";
-
+
protected static final String SELECTED_CONNECTION = "SEL_CONNECTION";
protected static final String SELECTED_REMOTE_SERVICE = "SEL_REMOTE_SERVICE";

protected static final String PROJECT_NAME = "Project Name";
protected static final String DEFAULT_INIT_SCRIPT = "oe-init-build-env";
protected static final String DEFAULT_INSTALL_DIR = "~/yocto";
-
+
protected static final String GIT_CLONE = "Git Clone";
public static final String VALIDATION_FILE = DEFAULT_INIT_SCRIPT;

@@ -61,12 +62,11 @@ public class InstallWizard extends FiniteStateWizard implements IWorkbenchWizard
this.model = new Hashtable<String, Object>();
model.put(INSTALL_DIRECTORY, DEFAULT_INSTALL_DIR);
model.put(INIT_SCRIPT, DEFAULT_INIT_SCRIPT);
-
+
setWindowTitle("Yocto Project BitBake Commander");
setNeedsProgressMonitor(true);
-
- }

+ }

public InstallWizard(IStructuredSelection selection) {
model = new Hashtable<String, Object>();
@@ -77,13 +77,13 @@ public class InstallWizard extends FiniteStateWizard implements IWorkbenchWizard
* instanceof WelcomePage) { if (model.containsKey(WelcomePage.ACTION_USE))
* { return bbcProjectPage; } } else if (page instanceof ProgressPage) {
* return bitbakePage; }
- *
+ *
* if (super.getNextPage(page) != null) { System.out.println("next page: " +
* super.getNextPage(page).getClass().getName()); } else {
* System.out.println("end page"); }
- *
+ *
* return super.getNextPage(page); }
- *
+ *
* @Override public boolean canFinish() { System.out.println("can finish: "
* + super.canFinish()); return super.canFinish(); }
*/
@@ -102,7 +102,7 @@ public class InstallWizard extends FiniteStateWizard implements IWorkbenchWizard
WizardPage page = (WizardPage) getPage("Options");
page.setPageComplete(true);
Map<String, Object> options = model;
-
+
try {
URI uri = new URI("");
if (options.containsKey(INSTALL_DIRECTORY)) {
@@ -110,20 +110,20 @@ public class InstallWizard extends FiniteStateWizard implements IWorkbenchWizard
}
IRemoteConnection remoteConnection = ((IRemoteConnection)model.get(InstallWizard.SELECTED_CONNECTION));
IRemoteServices remoteServices = ((IRemoteServices)model.get(InstallWizard.SELECTED_REMOTE_SERVICE));
- IHost connection = RemoteHelper.getRemoteConnectionByName(remoteConnection.getName());
- CommandResponseHandler cmdHandler = RemoteHelper.getCommandHandler(connection);
-
+ final IHost connection = RemoteHelper.getRemoteConnectionByName(remoteConnection.getName());
+ final CommandResponseHandler cmdHandler = RemoteHelper.getCommandHandler(connection);
+ final YoctoRunnableWithProgress adapter = (YoctoRunnableWithProgress)RemoteHelper.getHostShellProcessAdapter(connection);
+ final IWizardContainer container = this.getContainer();
if (((Boolean)options.get(GIT_CLONE)).booleanValue()) {
String cmd = "/usr/bin/git clone --progress";
String args = "git://git.yoctoproject.org/poky.git " + uri.getPath();
String taskName = "Checking out Yocto git repository";
- YoctoRunnableWithProgress adapter = (YoctoRunnableWithProgress)RemoteHelper.getHostShellProcessAdapter(connection);
+
adapter.setRemoteConnection(remoteConnection);
adapter.setRemoteServices(remoteServices);
adapter.setTaskName(taskName);
adapter.setCmd(cmd);
adapter.setArgs(args);
- IWizardContainer container = this.getContainer();
try {
container.run(true, true, adapter);
} catch (InvocationTargetException e) {
@@ -146,19 +146,35 @@ public class InstallWizard extends FiniteStateWizard implements IWorkbenchWizard
pinfo.setName(prjName);
pinfo.setConnection(connection);
pinfo.setRemoteServices(remoteServices);
-
- ConsoleWriter cw = new ConsoleWriter();
- this.getContainer().run(true, true, new BBConfigurationInitializeOperation(pinfo, cw));
+
+ final ConsoleWriter cw = new ConsoleWriter();
+ final ProjectInfo pInfoFinal = pinfo;
+
+ Thread t = new Thread(new Runnable() {
+
+ @Override
+ public void run() {
+ try {
+ Thread.sleep(2000);
+ new BBConfigurationInitializeOperation(pInfoFinal, null).run(new NullProgressMonitor());
+ } catch (InvocationTargetException e) {
+ e.printStackTrace();
+ } catch (InterruptedException e) {
+ e.printStackTrace();
+ }
+ }
+ });
+
console = RemoteHelper.getConsole(connection);
console.newMessageStream().println(cw.getContents());

model.put(InstallWizard.KEY_PINFO, pinfo);
Activator.putProjInfo(pinfo.getURI(), pinfo);

- this.getContainer().run(true, true, new CreateBBCProjectOperation(pinfo));
+ container.run(true, true, new CreateBBCProjectOperation(pinfo));
+ t.start();
return true;
}
- return true;
} catch (Exception e) {
Activator.getDefault().getLog().log(new Status(IStatus.ERROR, Activator.PLUGIN_ID,
IStatus.ERROR, e.getMessage(), e));
@@ -167,6 +183,7 @@ public class InstallWizard extends FiniteStateWizard implements IWorkbenchWizard
return false;
}

+ @Override
public void init(IWorkbench workbench, IStructuredSelection selection) {
}

diff --git a/plugins/org.yocto.bc.ui/src/org/yocto/bc/ui/wizards/install/OptionsPage.java b/plugins/org.yocto.bc.ui/src/org/yocto/bc/ui/wizards/install/OptionsPage.java
index ac33760..486bd8b 100644
--- a/plugins/org.yocto.bc.ui/src/org/yocto/bc/ui/wizards/install/OptionsPage.java
+++ b/plugins/org.yocto.bc.ui/src/org/yocto/bc/ui/wizards/install/OptionsPage.java
@@ -29,6 +29,7 @@ import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Group;
import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.Text;
import org.yocto.bc.remote.utils.RemoteHelper;
@@ -88,8 +89,13 @@ public class OptionsPage extends FiniteStateWizardPage {
@Override
public void reportError(String errorMessage, boolean infoOnly) {
setMessage(errorMessage);
- validatePage();
- updateModel();
+ if (validatePage()) {
+ updateModel();
+ setPageComplete(true);
+ return;
+ }
+
+ setPageComplete(false);
}
};

--
1.7.9.5


[PATCH v2 3/3] Reinstate OEFileSystem, OEFile and Ignored Paths for Linux

Ioana Grigoropol <ioanax.grigoropol@...>
 

- OEFileSystem and OEFile were dropped due to the use of hardcoded scheme "oefs://" that stopped remote connection from working. There is a need to have a custom file system in order to skip indexing large directories (such as build, tmp) and ignore some paths--was not tested under Windows

Signed-off-by: Ioana Grigoropol <ioanax.grigoropol@...>
---
plugins/org.yocto.bc.ui/META-INF/MANIFEST.MF | 2 +-
plugins/org.yocto.bc.ui/plugin.xml | 3 +-
.../org/yocto/bc/bitbake/ProjectInfoHelper.java | 24 ++--
.../src/org/yocto/bc/ui/Activator.java | 45 +++++---
.../org/yocto/bc/ui/BCResourceChangeListener.java | 1 -
.../src/org/yocto/bc/ui/filesystem/OEFile.java | 120 ++++----------------
.../org/yocto/bc/ui/filesystem/OEFileSystem.java | 50 ++++++--
.../bc/ui/filesystem/OEFileSystemContributor.java | 7 +-
.../org/yocto/bc/ui/filesystem/OEIgnoreFile.java | 31 ++++-
.../src/org/yocto/bc/ui/model/ProjectInfo.java | 21 +++-
.../src/org/yocto/bc/ui/model/YoctoHostFile.java | 100 ++++++++++++----
.../yocto/bc/ui/wizards/install/OptionsPage.java | 1 -
.../newproject/CreateBBCProjectOperation.java | 23 ++--
13 files changed, 248 insertions(+), 180 deletions(-)

diff --git a/plugins/org.yocto.bc.ui/META-INF/MANIFEST.MF b/plugins/org.yocto.bc.ui/META-INF/MANIFEST.MF
index 9e8c523..1f0e63e 100644
--- a/plugins/org.yocto.bc.ui/META-INF/MANIFEST.MF
+++ b/plugins/org.yocto.bc.ui/META-INF/MANIFEST.MF
@@ -2,7 +2,7 @@ Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: %Bundle-Name
Bundle-SymbolicName: org.yocto.bc.ui;singleton:=true
-Bundle-Version: 1.4.0.qualifier
+Bundle-Version: 1.2.0.qualifier
Bundle-Activator: org.yocto.bc.ui.Activator
Bundle-Vendor: %Bundle-Vendor
Require-Bundle: org.eclipse.ui,
diff --git a/plugins/org.yocto.bc.ui/plugin.xml b/plugins/org.yocto.bc.ui/plugin.xml
index cb0561c..6ba9b5f 100644
--- a/plugins/org.yocto.bc.ui/plugin.xml
+++ b/plugins/org.yocto.bc.ui/plugin.xml
@@ -180,8 +180,7 @@
</extension>
<extension
point="org.eclipse.core.filesystem.filesystems">
- <filesystem
- scheme="OEFS">
+ <filesystem scheme="OEFS">
<run
class="org.yocto.bc.ui.filesystem.OEFileSystem">
</run>
diff --git a/plugins/org.yocto.bc.ui/src/org/yocto/bc/bitbake/ProjectInfoHelper.java b/plugins/org.yocto.bc.ui/src/org/yocto/bc/bitbake/ProjectInfoHelper.java
index 2938c95..f5259e5 100644
--- a/plugins/org.yocto.bc.ui/src/org/yocto/bc/bitbake/ProjectInfoHelper.java
+++ b/plugins/org.yocto.bc.ui/src/org/yocto/bc/bitbake/ProjectInfoHelper.java
@@ -10,27 +10,25 @@
*******************************************************************************/
package org.yocto.bc.bitbake;

-import java.io.BufferedReader;
-import java.io.File;
-import java.io.FileReader;
import java.io.IOException;
import java.net.URI;
-import java.net.URISyntaxException;

import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.rse.core.model.IHost;
-import org.yocto.bc.remote.utils.RemoteHelper;
import org.yocto.bc.ui.model.ProjectInfo;

/**
* A helper class for ProjectInfo related tasks.
- *
+ *
* @author kgilmer
- *
+ *
*/
public class ProjectInfoHelper {
+ public static final String OEFS_SCHEME = "OEFS://";
+ public static final String FILE_SCHEME = "file";
+ public static final String RSE_SCHEME = "rse";

protected static final String DEFAULT_INIT_SCRIPT = "oe-init-build-env";
/**
@@ -54,17 +52,17 @@ public class ProjectInfoHelper {
// }
return val;
}
-
+
// public static String getInitScript(String path) throws IOException {
// File inFile = new File(path);
// BufferedReader br = new BufferedReader(new FileReader(inFile));
// StringBuffer sb = new StringBuffer();
// String line = null;
-//
+//
// while ((line = br.readLine()) != null) {
// sb.append(line);
// }
-//
+//
// br.close();
//
// return sb.toString();
@@ -89,7 +87,7 @@ public class ProjectInfoHelper {
/**
* This method will store the path to the bitbake init script for future
* reference.
- *
+ *
* @param path
* @param projInfo
* @throws IOException
@@ -121,8 +119,8 @@ public class ProjectInfoHelper {
} catch (Exception e) {
e.printStackTrace();
}
-
-
+
+
}

}
diff --git a/plugins/org.yocto.bc.ui/src/org/yocto/bc/ui/Activator.java b/plugins/org.yocto.bc.ui/src/org/yocto/bc/ui/Activator.java
index 48c59d5..188efe6 100644
--- a/plugins/org.yocto.bc.ui/src/org/yocto/bc/ui/Activator.java
+++ b/plugins/org.yocto.bc.ui/src/org/yocto/bc/ui/Activator.java
@@ -14,6 +14,7 @@ import java.io.IOException;
import java.io.Writer;
import java.lang.reflect.InvocationTargetException;
import java.net.URI;
+import java.net.URISyntaxException;
import java.util.Hashtable;
import java.util.Iterator;
import java.util.Map;
@@ -130,25 +131,43 @@ public class Activator extends AbstractUIPlugin {
public static ImageDescriptor getImageDescriptor(String path) {
return imageDescriptorFromPlugin(PLUGIN_ID, path);
}
-
+ public static URI convertOEFSUri(URI uri){
+ if (ProjectInfoHelper.OEFS_SCHEME.startsWith(uri.getScheme())) {
+ String scheme = "";
+ if (uri.getHost() == null)
+ scheme = ProjectInfoHelper.FILE_SCHEME;
+ else
+ scheme = ProjectInfoHelper.RSE_SCHEME;
+ try {
+ return new URI(scheme, uri.getHost(), uri.getPath(), uri.getFragment());
+ } catch (URISyntaxException e) {
+ e.printStackTrace();
+ return null;
+ }
+ }
+ return null;
+ }
public static ProjectInfo getProjInfo(URI location) throws CoreException, InvocationTargetException, InterruptedException {
if (projInfoMap == null) {
projInfoMap = new Hashtable<URI, ProjectInfo>();
}
- ProjectInfo pi = projInfoMap.get(location);
- if (pi == null) {
- pi = new ProjectInfo();
- pi.setLocation(location);
- try {
- pi.setInitScriptPath(ProjectInfoHelper.getInitScriptPath(location));
- } catch (IOException e) {
- throw new InvocationTargetException(e);
+ location = convertOEFSUri(location);
+ if (location != null) {
+ ProjectInfo pi = projInfoMap.get(location);
+ if (pi == null) {
+ pi = new ProjectInfo();
+ pi.setLocation(location);
+ try {
+ pi.setInitScriptPath(ProjectInfoHelper.getInitScriptPath(location));
+ } catch (IOException e) {
+ throw new InvocationTargetException(e);
+ }
+
+ projInfoMap.put(location, pi);
}
-
- projInfoMap.put(location, pi);
+ return pi;
}
-
- return pi;
+ return null;
}

public static void notifyAllBBSession(IResource[] added, IResource[] removed, IResource[] changed) {
diff --git a/plugins/org.yocto.bc.ui/src/org/yocto/bc/ui/BCResourceChangeListener.java b/plugins/org.yocto.bc.ui/src/org/yocto/bc/ui/BCResourceChangeListener.java
index f22f583..8a2bfdd 100644
--- a/plugins/org.yocto.bc.ui/src/org/yocto/bc/ui/BCResourceChangeListener.java
+++ b/plugins/org.yocto.bc.ui/src/org/yocto/bc/ui/BCResourceChangeListener.java
@@ -41,7 +41,6 @@ public class BCResourceChangeListener implements IResourceChangeListener {
removed.add(res);
break;
case IResourceDelta.CHANGED:
- res.getLocation();
changed.add(res);
break;
}
diff --git a/plugins/org.yocto.bc.ui/src/org/yocto/bc/ui/filesystem/OEFile.java b/plugins/org.yocto.bc.ui/src/org/yocto/bc/ui/filesystem/OEFile.java
index 7e780cb..eb6fc11 100644
--- a/plugins/org.yocto.bc.ui/src/org/yocto/bc/ui/filesystem/OEFile.java
+++ b/plugins/org.yocto.bc.ui/src/org/yocto/bc/ui/filesystem/OEFile.java
@@ -12,14 +12,9 @@
package org.yocto.bc.ui.filesystem;

import java.io.File;
-import java.io.FileInputStream;
-import java.io.FileNotFoundException;
-import java.io.FileOutputStream;
-import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.net.URI;
-import java.util.ArrayList;
import java.util.List;

import org.eclipse.core.filesystem.EFS;
@@ -32,14 +27,10 @@ import org.eclipse.core.filesystem.provider.FileStore;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.MultiStatus;
import org.eclipse.core.runtime.NullProgressMonitor;
-import org.eclipse.core.runtime.Status;
import org.eclipse.osgi.util.NLS;
import org.eclipse.rse.services.clientserver.messages.SystemMessageException;
-import org.eclipse.rse.services.files.IFileService;
-import org.eclipse.rse.services.files.IHostFile;
import org.yocto.bc.bitbake.BBSession;
import org.yocto.bc.bitbake.ProjectInfoHelper;
import org.yocto.bc.bitbake.ShellSession;
@@ -52,18 +43,13 @@ import org.yocto.bc.ui.model.YoctoHostFile;
* operating system's file system.
*/
public class OEFile extends FileStore {
- private static int attributes(File aFile) {
- if (!aFile.exists() || aFile.canWrite())
- return EFS.NONE;
- return EFS.ATTRIBUTE_READ_ONLY;
- }
-
+
/**
* The java.io.File that this store represents.
*/
protected final YoctoHostFile file;
-
- private List<?> ignoredPaths;
+
+ private List<Object> ignoredPaths;

/**
* The absolute file system path of the file represented by this store.
@@ -74,35 +60,18 @@ public class OEFile extends FileStore {

/**
* Creates a new local file.
- *
+ *
* @param file The file this local file represents
- * @param root
- * @throws SystemMessageException
+ * @param root
+ * @throws SystemMessageException
*/
- public OEFile(URI fileURI, List<?> ignoredPaths, URI root, ProjectInfo projInfo, IProgressMonitor monitor) throws SystemMessageException {
+ public OEFile(URI fileURI, List<Object> ignoredPaths, URI root, ProjectInfo projInfo, IProgressMonitor monitor) throws SystemMessageException {
this.ignoredPaths = ignoredPaths;
this.root = root;
this.file = new YoctoHostFile(projInfo, fileURI, monitor);
this.filePath = file.getAbsolutePath();
}

- /**
- * This method is called after a failure to modify a file or directory.
- * Check to see if the parent is read-only and if so then
- * throw an exception with a more specific message and error code.
- *
- * @param target The file that we failed to modify
- * @param exception The low level exception that occurred, or <code>null</code>
- * @throws CoreException A more specific exception if the parent is read-only
- */
- private void checkReadOnlyParent(File target, Throwable exception) throws CoreException {
- File parent = target.getParentFile();
- if (parent != null && (attributes(parent) & EFS.ATTRIBUTE_READ_ONLY) != 0) {
- String message = NLS.bind(Messages.readOnlyParent, target.getAbsolutePath());
- Policy.error(EFS.ERROR_PARENT_READ_ONLY, message, exception);
- }
- }
-
@Override
public String[] childNames(int options, IProgressMonitor monitor) {
return file.getChildNames(monitor);
@@ -125,11 +94,11 @@ public class OEFile extends FileStore {
/*
* try to find items for ignoreList
*/
- private void updateIgnorePaths(String path, List list, IProgressMonitor monitor) {
+ private void updateIgnorePaths(String path, List<Object> list, IProgressMonitor monitor) {
if(isPotentialBuildDir(path)) {
BBSession config = null;
try {
- ShellSession shell = new ShellSession(file.getProjectInfo(), ShellSession.SHELL_TYPE_BASH, RemoteHelper.getRemoteHostFile(file.getConnection(), root.getPath(), monitor),
+ ShellSession shell = new ShellSession(file.getProjectInfo(), ShellSession.SHELL_TYPE_BASH, RemoteHelper.getRemoteHostFile(file.getConnection(), root.getPath(), monitor),
ProjectInfoHelper.getInitScriptPath(root) + " " + path, null);
config = new BBSession(shell, root, true);
config.initialize();
@@ -158,18 +127,18 @@ public class OEFile extends FileStore {
public IFileStore[] childStores(int options, IProgressMonitor monitor) throws CoreException {
String[] children = childNames(options, monitor);
IFileStore[] wrapped = new IFileStore[children.length];
-
+
for (int i = 0; i < wrapped.length; i++) {
String fullPath = file.toString() +File.separatorChar + children[i];
-
+
updateIgnorePaths(fullPath, ignoredPaths, monitor);
if (ignoredPaths.contains(fullPath)) {
wrapped[i] = getDeadChild(children[i]);
} else {
wrapped[i] = getChild(children[i]);
- }
+ }
}
-
+
return wrapped;
}

@@ -177,7 +146,7 @@ public class OEFile extends FileStore {
public void copy(IFileStore destFileStore, int options, IProgressMonitor monitor) throws CoreException {
if (destFileStore instanceof OEFile) {
file.copy(destFileStore, monitor);
-
+
// File source = file;
// File destination = ((OEFile) destFile).file;
// //handle case variants on a case-insensitive OS, or copying between
@@ -194,7 +163,7 @@ public class OEFile extends FileStore {
// }
}
//fall through to super implementation
-// super.copy(destFile, options, monitor);
+// super.copy(destFileStore, options, monitor);
}

@Override
@@ -207,13 +176,13 @@ public class OEFile extends FileStore {
monitor.beginTask(NLS.bind(Messages.deleting, this), 200);
String message = Messages.deleteProblem;
MultiStatus result = new MultiStatus(Policy.PI_FILE_SYSTEM, EFS.ERROR_DELETE, message, null);
-
+
//don't allow Eclipse to delete entire OE directory
-
+
if (!isProject()) {
internalDelete(file, filePath, result, monitor);
}
-
+
if (!result.isOK())
throw new CoreException(result);
} finally {
@@ -249,10 +218,9 @@ public class OEFile extends FileStore {
info.setAttribute(EFS.ATTRIBUTE_HIDDEN, file.isHidden());
return info;
}
-
+
@Override
public IFileStore getChild(IPath path) {
- //URI fileURI, List<?> ignoredPaths, URI root, ProjectInfo projInfo, IProgressMonitor monitor
try {
return new OEFile(file.getChildURIformPath(path), ignoredPaths, root, file.getProjectInfo(), new NullProgressMonitor());
} catch (SystemMessageException e) {
@@ -263,12 +231,14 @@ public class OEFile extends FileStore {

@Override
public IFileStore getChild(String name) {
+
try {
return new OEFile(file.getChildURI(name), ignoredPaths, root, file.getProjectInfo(), new NullProgressMonitor());
} catch (SystemMessageException e) {
e.printStackTrace();
}
return null;
+
}

private IFileStore getDeadChild(String name) {
@@ -311,6 +281,7 @@ public class OEFile extends FileStore {
* to optimize java.io.File object creation.
*/
private boolean internalDelete(YoctoHostFile target, String pathToDelete, MultiStatus status, IProgressMonitor monitor) {
+ target.delete(monitor);
//first try to delete - this should succeed for files and symbolic links to directories
// if (target.delete() || !target.exists())
// return true;
@@ -395,6 +366,7 @@ public class OEFile extends FileStore {
// String message = NLS.bind(Messages.failedCreateWrongType, filePath);
// Policy.error(EFS.ERROR_WRONG_TYPE, message);
// }
+ file.mkdir(options);
return this;
}

@@ -463,59 +435,17 @@ public class OEFile extends FileStore {

@Override
public InputStream openInputStream(int options, IProgressMonitor monitor) throws CoreException {
- file.getInputStream(options, monitor);
-// monitor = Policy.monitorFor(monitor);
-// try {
-// monitor.beginTask("", 1); //$NON-NLS-1$
-// return new FileInputStream(file);
-// } catch (FileNotFoundException e) {
-// String message;
-// if (!file.exists())
-// message = NLS.bind(Messages.fileNotFound, filePath);
-// else if (file.isDirectory())
-// message = NLS.bind(Messages.notAFile, filePath);
-// else
-// message = NLS.bind(Messages.couldNotRead, filePath);
-// Policy.error(EFS.ERROR_READ, message, e);
-// return null;
-// } finally {
-// monitor.done();
-// }
- return null;
+ return file.getInputStream(options, monitor);
}

@Override
public OutputStream openOutputStream(int options, IProgressMonitor monitor) throws CoreException {
- file.getOutputStream(options, monitor);
-// monitor = Policy.monitorFor(monitor);
-// try {
-// monitor.beginTask("", 1); //$NON-NLS-1$
-// return new FileOutputStream(file, (options & EFS.APPEND) != 0);
-// } catch (FileNotFoundException e) {
-// checkReadOnlyParent(file, e);
-// String message;
-// String path = filePath;
-// if (file.isDirectory())
-// message = NLS.bind(Messages.notAFile, path);
-// else
-// message = NLS.bind(Messages.couldNotWrite, path);
-// Policy.error(EFS.ERROR_WRITE, message, e);
-// return null;
-// } finally {
-// monitor.done();
-// }
- return null;
+ return file.getOutputStream(options, monitor);
}

@Override
public void putInfo(IFileInfo info, int options, IProgressMonitor monitor) throws CoreException {
file.putInfo(info, options, monitor);
-// boolean success = true;
-// native does not currently set last modified
-// if ((options & EFS.SET_LAST_MODIFIED) != 0)
-// success &= file.setLastModified(info.getLastModified());
-// if (!success && !file.exists())
-// Policy.error(EFS.ERROR_NOT_EXISTS, NLS.bind(Messages.fileNotFound, filePath));
}

/* (non-Javadoc)
diff --git a/plugins/org.yocto.bc.ui/src/org/yocto/bc/ui/filesystem/OEFileSystem.java b/plugins/org.yocto.bc.ui/src/org/yocto/bc/ui/filesystem/OEFileSystem.java
index 8422f05..5efdcdc 100644
--- a/plugins/org.yocto.bc.ui/src/org/yocto/bc/ui/filesystem/OEFileSystem.java
+++ b/plugins/org.yocto.bc.ui/src/org/yocto/bc/ui/filesystem/OEFileSystem.java
@@ -10,6 +10,7 @@
*******************************************************************************/
package org.yocto.bc.ui.filesystem;

+import java.lang.reflect.InvocationTargetException;
import java.net.URI;
import java.util.ArrayList;
import java.util.Hashtable;
@@ -19,7 +20,9 @@ import java.util.Map;
import org.eclipse.core.filesystem.IFileStore;
import org.eclipse.core.filesystem.IFileSystem;
import org.eclipse.core.filesystem.provider.FileSystem;
+import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.NullProgressMonitor;
+import org.eclipse.rse.services.clientserver.messages.SystemMessageException;
import org.yocto.bc.bitbake.BBSession;
import org.yocto.bc.ui.Activator;
import org.yocto.bc.ui.model.ProjectInfo;
@@ -34,28 +37,34 @@ public class OEFileSystem extends FileSystem {

private static IFileSystem ref;
private ProjectInfo projInfo;
-
+
public static IFileSystem getInstance() {
return ref;
}

private Map fileStoreCache;

- public OEFileSystem(ProjectInfo pInfo) {
+ public OEFileSystem() {
ref = this;
- projInfo = pInfo;
fileStoreCache = new Hashtable();
}
-
+
+// public OEFileSystem(ProjectInfo pInfo) {
+// ref = this;
+// projInfo = pInfo;
+// fileStoreCache = new Hashtable();
+// }
+
@Override
public IFileStore getStore(URI uri) {
-
+
OEFile uf = (OEFile) fileStoreCache.get(uri);
-
+ setProjInfo(uri);
+
if (uf == null) {
BBSession config = null;
try {
- config = Activator.getBBSession(uf.getProjectInfo(), new NullProgressMonitor());
+ config = Activator.getBBSession(projInfo, new NullProgressMonitor());
config.initialize();
} catch (Exception e) {
e.printStackTrace();
@@ -65,19 +74,36 @@ public class OEFileSystem extends FileSystem {
if (config.get("TMPDIR") == null || config.get("DL_DIR") == null || config.get("SSTATE_DIR")== null) {
throw new RuntimeException("Invalid local.conf: TMPDIR or DL_DIR or SSTATE_DIR undefined.");
}
-
+
List ignoreList = new ArrayList();

//These directories are ignored because they contain too many files for Eclipse to handle efficiently.
ignoreList.add(config.get("TMPDIR"));
ignoreList.add(config.get("DL_DIR"));
ignoreList.add(config.get("SSTATE_DIR"));
-
+
//FIXME: add project info
- //uf = new OEFile(uri, ignoreList, uri, projectInfo, new NullProgressMonitor());
- fileStoreCache.put(uri, uf);
+ try {
+ uf = new OEFile(uri, ignoreList, uri, projInfo, new NullProgressMonitor());
+ fileStoreCache.put(uri, uf);
+ } catch (SystemMessageException e) {
+ e.printStackTrace();
+ }
}
-
+
return uf;
}
+
+ private void setProjInfo(URI uri) {
+ try {
+ if(projInfo == null)
+ projInfo = Activator.getProjInfo(uri);
+ } catch (CoreException e) {
+ e.printStackTrace();
+ } catch (InvocationTargetException e) {
+ e.printStackTrace();
+ } catch (InterruptedException e) {
+ e.printStackTrace();
+ }
+ }
}
diff --git a/plugins/org.yocto.bc.ui/src/org/yocto/bc/ui/filesystem/OEFileSystemContributor.java b/plugins/org.yocto.bc.ui/src/org/yocto/bc/ui/filesystem/OEFileSystemContributor.java
index 4ac2998..dfa2bff 100644
--- a/plugins/org.yocto.bc.ui/src/org/yocto/bc/ui/filesystem/OEFileSystemContributor.java
+++ b/plugins/org.yocto.bc.ui/src/org/yocto/bc/ui/filesystem/OEFileSystemContributor.java
@@ -17,14 +17,17 @@ import org.eclipse.ui.ide.fileSystem.FileSystemContributor;

public class OEFileSystemContributor extends FileSystemContributor {

+ public OEFileSystemContributor() {
+ }
+
@Override
public URI browseFileSystem(String initialPath, Shell shell) {
return null;
}
-
+
@Override
public URI getURI(String string) {
return super.getURI(string);
}
-
+
}
diff --git a/plugins/org.yocto.bc.ui/src/org/yocto/bc/ui/filesystem/OEIgnoreFile.java b/plugins/org.yocto.bc.ui/src/org/yocto/bc/ui/filesystem/OEIgnoreFile.java
index 26da202..9764ca1 100644
--- a/plugins/org.yocto.bc.ui/src/org/yocto/bc/ui/filesystem/OEIgnoreFile.java
+++ b/plugins/org.yocto.bc.ui/src/org/yocto/bc/ui/filesystem/OEIgnoreFile.java
@@ -22,7 +22,6 @@ import org.eclipse.core.filesystem.provider.FileInfo;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.rse.services.files.IHostFile;
import org.yocto.bc.ui.model.YoctoHostFile;

public class OEIgnoreFile implements IFileStore {
@@ -33,94 +32,116 @@ public class OEIgnoreFile implements IFileStore {
this.file = file;
}

+ @Override
public IFileInfo[] childInfos(int options, IProgressMonitor monitor) throws CoreException {

return new IFileInfo[0];
}

+ @Override
public String[] childNames(int options, IProgressMonitor monitor) throws CoreException {
return new String[0];
}

+ @Override
public IFileStore[] childStores(int options, IProgressMonitor monitor) throws CoreException {

return new IFileStore[0];
}

+ @Override
public void copy(IFileStore destination, int options, IProgressMonitor monitor) throws CoreException {
}

+ @Override
public void delete(int options, IProgressMonitor monitor) throws CoreException {
}
-
+
+ @Override
public IFileInfo fetchInfo() {
return new FileInfo(file.getName());
}

+ @Override
public IFileInfo fetchInfo(int options, IProgressMonitor monitor) throws CoreException {
return new FileInfo(file.getName());
}

+ @Override
public Object getAdapter(Class adapter) {
return null;
}

+ @Override
public IFileStore getChild(IPath path) {
return null;
}



+ @Override
public IFileStore getChild(String name) {
return null;
}

+ @Override
public IFileSystem getFileSystem() {
return OEFileSystem.getInstance();
}

+ @Override
public String getName() {
return file.getName();
}

+ @Override
public IFileStore getParent() {
return null;
}

+ @Override
public boolean isParentOf(IFileStore other) {
return false;
}

+ @Override
public IFileStore mkdir(int options, IProgressMonitor monitor) throws CoreException {
return null;
}

+ @Override
public void move(IFileStore destination, int options, IProgressMonitor monitor) throws CoreException {
}

+ @Override
public InputStream openInputStream(int options, IProgressMonitor monitor) throws CoreException {
return null;
}

+ @Override
public OutputStream openOutputStream(int options, IProgressMonitor monitor) throws CoreException {
return null;
}

+ @Override
public void putInfo(IFileInfo info, int options, IProgressMonitor monitor) throws CoreException {
}

-
+
+ @Override
public File toLocalFile(int options, IProgressMonitor monitor) throws CoreException {
return file.toLocalFile();
}

+ @Override
public URI toURI() {
return file.toURI();
}

+ @Override
public IFileStore getFileStore(IPath path) {
return null;
}
-
-
+
+
}
diff --git a/plugins/org.yocto.bc.ui/src/org/yocto/bc/ui/model/ProjectInfo.java b/plugins/org.yocto.bc.ui/src/org/yocto/bc/ui/model/ProjectInfo.java
index 4530bb3..089c1ac 100644
--- a/plugins/org.yocto.bc.ui/src/org/yocto/bc/ui/model/ProjectInfo.java
+++ b/plugins/org.yocto.bc.ui/src/org/yocto/bc/ui/model/ProjectInfo.java
@@ -14,7 +14,6 @@ import java.net.URI;

import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.NullProgressMonitor;
-import org.eclipse.ptp.remote.core.IRemoteConnection;
import org.eclipse.ptp.remote.core.IRemoteServices;
import org.eclipse.rse.core.model.IHost;
import org.eclipse.rse.services.files.IFileService;
@@ -24,13 +23,14 @@ import org.yocto.bc.remote.utils.RemoteHelper;
public class ProjectInfo implements IModelElement {
private String name;
private URI location;
+ private URI oefsLocation;
private String init;
private IHost connection;
private IRemoteServices remoteServices;
-
+
public ProjectInfo() {
}
-
+
public String getInitScriptPath() {
return init;
}
@@ -40,6 +40,7 @@ public class ProjectInfo implements IModelElement {
public URI getURI() {
return location;
}
+ @Override
public void initialize() throws Exception {
name = new String();
location = new URI("");
@@ -53,7 +54,7 @@ public class ProjectInfo implements IModelElement {
public void setLocation(URI location) {
this.location = location;
}
-
+
public void setName(String name) {
this.name = name;
}
@@ -76,13 +77,21 @@ public class ProjectInfo implements IModelElement {
public void setRemoteServices(IRemoteServices remoteServices) {
this.remoteServices = remoteServices;
}
-
+
public IFileService getFileService(IProgressMonitor monitor){
try {
- return (IFileService)RemoteHelper.getConnectedRemoteFileService(connection, monitor);
+ return RemoteHelper.getConnectedRemoteFileService(connection, monitor);
} catch (Exception e) {
e.printStackTrace();
return null;
}
}
+
+ public URI getOefsLocation() {
+ return oefsLocation;
+ }
+
+ public void setOefsLocation(URI oefsLocation) {
+ this.oefsLocation = oefsLocation;
+ }
}
diff --git a/plugins/org.yocto.bc.ui/src/org/yocto/bc/ui/model/YoctoHostFile.java b/plugins/org.yocto.bc.ui/src/org/yocto/bc/ui/model/YoctoHostFile.java
index 08ff7fa..04b483c 100644
--- a/plugins/org.yocto.bc.ui/src/org/yocto/bc/ui/model/YoctoHostFile.java
+++ b/plugins/org.yocto.bc.ui/src/org/yocto/bc/ui/model/YoctoHostFile.java
@@ -1,6 +1,8 @@
package org.yocto.bc.ui.model;

import java.io.File;
+import java.io.InputStream;
+import java.io.OutputStream;
import java.net.URI;
import java.net.URISyntaxException;
import java.util.ArrayList;
@@ -8,35 +10,42 @@ import java.util.ArrayList;
import org.eclipse.core.filesystem.EFS;
import org.eclipse.core.filesystem.IFileInfo;
import org.eclipse.core.filesystem.IFileStore;
+import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.NullProgressMonitor;
+import org.eclipse.osgi.util.NLS;
import org.eclipse.rse.core.model.IHost;
import org.eclipse.rse.services.clientserver.messages.SystemMessageException;
import org.eclipse.rse.services.files.IFileService;
import org.eclipse.rse.services.files.IHostFile;
+import org.yocto.bc.remote.utils.RemoteHelper;
+import org.yocto.bc.ui.filesystem.Messages;
+import org.yocto.bc.ui.filesystem.Policy;

public class YoctoHostFile implements IHostFile{
private IHostFile file;
private URI fileURI;
private ProjectInfo projectInfo;
private IFileService fileService;
-
+
public YoctoHostFile(ProjectInfo pInfo, URI fileURI, IProgressMonitor monitor) throws SystemMessageException {
this.projectInfo = pInfo;
this.fileURI = fileURI;
String path = fileURI.getPath();
- int parentEnd = path.lastIndexOf("/");
- String parentPath = path.substring(0, parentEnd);
- String fileName = path.substring(parentEnd + 1);
+// int parentEnd = path.lastIndexOf("/");
+// String parentPath = path.substring(0, parentEnd);
+// String fileName = path.substring(parentEnd + 1);
fileService = projectInfo.getFileService(monitor);
- fileService.getFile(parentPath, fileName, monitor);
+ file = RemoteHelper.getRemoteHostFile(projectInfo.getConnection(), path, monitor);
+// fileService.getFile(parentPath, fileName, monitor);
}
-
+
public YoctoHostFile(ProjectInfo projectInfo, URI uri) {
this.fileURI = uri;
this.projectInfo = projectInfo;
}
-
+
public IHostFile getFile() {
return file;
}
@@ -49,9 +58,11 @@ public class YoctoHostFile implements IHostFile{
public void setProjectInfo(ProjectInfo projectInfo) {
this.projectInfo = projectInfo;
}
+ @Override
public String getAbsolutePath() {
return file.getAbsolutePath();
}
+ @Override
public String getName() {
return file.getName();
}
@@ -62,23 +73,26 @@ public class YoctoHostFile implements IHostFile{
projectInfo.getURI().getPath().indexOf(file.getAbsolutePath());
return projectInfo.getURI();
}
+ @Override
public boolean isDirectory() {
return file.isDirectory();
}
+ @Override
public String getParentPath() {
return file.getParentPath();
}
public boolean copy(IFileStore destFileStore, IProgressMonitor monitor) {
IHostFile destFile;
try {
- destFile = fileService.getFile(destFileStore.toURI().getPath(), destFileStore.getName(), monitor);
- fileService.copy(file.getParentPath(), file.getName(), destFile.getParentPath(), destFile.getAbsolutePath(), monitor);
+ destFile = fileService.createFile(destFileStore.getParent().toURI().getPath(), destFileStore.getName(), monitor);
+ fileService.copy(file.getParentPath(), file.getName(), destFile.getParentPath(), destFile.getName(), monitor);
} catch (SystemMessageException e) {
e.printStackTrace();
return false;
}
return true;
}
+ @Override
public boolean exists() {
return file.exists();
}
@@ -137,30 +151,76 @@ public class YoctoHostFile implements IHostFile{
}
return true;
}
- public void mkdir() {
-
+
+ /**
+ * This method is called after a failure to modify a file or directory.
+ * Check to see if the parent is read-only and if so then
+ * throw an exception with a more specific message and error code.
+ *
+ * @param target The file that we failed to modify
+ * @param exception The low level exception that occurred, or <code>null</code>
+ * @throws CoreException A more specific exception if the parent is read-only
+ */
+ private void checkReadOnlyParent() throws CoreException {
+ String parent = file.getParentPath();
+ String parentOfParent = parent.substring(0, parent.lastIndexOf("/"));
+ IHostFile parentFile;
+ try {
+ parentFile = fileService.getFile(parentOfParent, parent, new NullProgressMonitor());
+ if (parentFile == null || !parentFile.canRead() || !parentFile.canWrite()) {
+ String message = NLS.bind(Messages.readOnlyParent, parent);
+ Policy.error(EFS.ERROR_PARENT_READ_ONLY, message, null);
+ }
+ } catch (SystemMessageException e) {
+ e.printStackTrace();
+ }
+
}
+
+ public void mkdir(int options) {
+// boolean shallow = (options & EFS.SHALLOW) != 0;
+ try {
+
+ if (!file.isDirectory()) {
+ file = fileService.createFolder(file.getParentPath(), file.getName(), new NullProgressMonitor());
+ if (!file.isDirectory()) {
+ checkReadOnlyParent();
+ String message = NLS.bind(Messages.failedCreateWrongType, file.getAbsolutePath());
+ Policy.error(EFS.ERROR_WRONG_TYPE, message);
+ }
+ }
+ } catch (SystemMessageException e1) {
+ e1.printStackTrace();
+ } catch (CoreException e) {
+ e.printStackTrace();
+ }
+
+ }
+
public String[] getChildNames(IProgressMonitor monitor) {
if (file.isDirectory()) {
IHostFile[] files;
try {
files = fileService.list(file.getAbsolutePath(), "*", IFileService.FILE_TYPE_FILES_AND_FOLDERS, monitor);
ArrayList<String> names = new ArrayList<String>();
-
+
for (IHostFile f : files) {
names.add(f.getName());
}
- return (String[])names.toArray();
+
+ String[] arrNames = new String[names.size()];
+ names.toArray(arrNames);
+ return arrNames;
} catch (SystemMessageException e) {
e.printStackTrace();
}
- }
+ }
return new String[]{};
}
public IHost getConnection() {
return projectInfo.getConnection();
}
-
+
public URI getChildURI(String name) {
try {
return new URI(fileURI.getScheme(), fileURI.getHost(), fileService.getFile(file.getAbsolutePath(), name, null).getAbsolutePath(), fileURI.getFragment());
@@ -208,19 +268,21 @@ public class YoctoHostFile implements IHostFile{
}
}

- public void getOutputStream(int options, IProgressMonitor monitor) {
+ public OutputStream getOutputStream(int options, IProgressMonitor monitor) {
try {
- fileService.getOutputStream(file.getParentPath(), file.getName(), options, monitor);
+ return fileService.getOutputStream(file.getParentPath(), file.getName(), options, monitor);
} catch (SystemMessageException e) {
e.printStackTrace();
+ return null;
}
}

- public void getInputStream(int options, IProgressMonitor monitor) {
+ public InputStream getInputStream(int options, IProgressMonitor monitor) {
try {
- fileService.getInputStream(file.getParentPath(), file.getName(), false, monitor);
+ return fileService.getInputStream(file.getParentPath(), file.getName(), false, monitor);
} catch (SystemMessageException e) {
e.printStackTrace();
+ return null;
}
}

diff --git a/plugins/org.yocto.bc.ui/src/org/yocto/bc/ui/wizards/install/OptionsPage.java b/plugins/org.yocto.bc.ui/src/org/yocto/bc/ui/wizards/install/OptionsPage.java
index 97d1ad0..ac33760 100644
--- a/plugins/org.yocto.bc.ui/src/org/yocto/bc/ui/wizards/install/OptionsPage.java
+++ b/plugins/org.yocto.bc.ui/src/org/yocto/bc/ui/wizards/install/OptionsPage.java
@@ -29,7 +29,6 @@ import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Group;
import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.Text;
import org.yocto.bc.remote.utils.RemoteHelper;
diff --git a/plugins/org.yocto.bc.ui/src/org/yocto/bc/ui/wizards/newproject/CreateBBCProjectOperation.java b/plugins/org.yocto.bc.ui/src/org/yocto/bc/ui/wizards/newproject/CreateBBCProjectOperation.java
index 42fa5b1..5ba661c 100644
--- a/plugins/org.yocto.bc.ui/src/org/yocto/bc/ui/wizards/newproject/CreateBBCProjectOperation.java
+++ b/plugins/org.yocto.bc.ui/src/org/yocto/bc/ui/wizards/newproject/CreateBBCProjectOperation.java
@@ -12,10 +12,11 @@ package org.yocto.bc.ui.wizards.newproject;

import java.io.IOException;
import java.lang.reflect.InvocationTargetException;
+import java.net.URI;
+import java.net.URISyntaxException;
import java.util.Arrays;
import java.util.Vector;

-import org.eclipse.core.internal.resources.ResourceException;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.IProjectDescription;
import org.eclipse.core.resources.IWorkspace;
@@ -23,10 +24,13 @@ import org.eclipse.core.resources.IWorkspaceRoot;
import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.QualifiedName;
+import org.eclipse.core.runtime.Status;
import org.eclipse.ui.actions.WorkspaceModifyOperation;
import org.yocto.bc.bitbake.ProjectInfoHelper;
import org.yocto.bc.remote.utils.RemoteHelper;
+import org.yocto.bc.ui.Activator;
import org.yocto.bc.ui.builder.BitbakeCommanderNature;
import org.yocto.bc.ui.model.ProjectInfo;

@@ -38,7 +42,6 @@ import org.yocto.bc.ui.model.ProjectInfo;
*/
public class CreateBBCProjectOperation extends WorkspaceModifyOperation {

- public static final String OEFS_SCHEME = "OEFS://";
public static final QualifiedName BBC_PROJECT_INIT = new QualifiedName(null, "BBC_PROJECT_INIT");
public static void addNatureToProject(IProject proj, String nature_id, IProgressMonitor monitor) throws CoreException {
IProjectDescription desc = proj.getDescription();
@@ -61,11 +64,15 @@ public class CreateBBCProjectOperation extends WorkspaceModifyOperation {
addNatureToProject(proj, BitbakeCommanderNature.NATURE_ID, monitor);
}

- private IProjectDescription createProjectDescription(IWorkspace workspace, ProjectInfo projInformation) throws CoreException {
- IProjectDescription desc = workspace.newProjectDescription(projInformation.getProjectName());
-
- desc.setLocationURI(projInformation.getURI());
+ private IProjectDescription createProjectDescription(IWorkspace workspace, ProjectInfo projInfo) throws CoreException {
+ IProjectDescription desc = workspace.newProjectDescription(projInfo.getProjectName());

+// desc.setLocationURI(projInfo.getURI());
+ try {
+ desc.setLocationURI(new URI(ProjectInfoHelper.OEFS_SCHEME + projInfo.getURI().getPath()));
+ } catch (URISyntaxException e) {
+ throw new CoreException(new Status(IStatus.ERROR, Activator.PLUGIN_ID, "Unable to load filesystem.", e));
+ }
return desc;
}

@@ -83,10 +90,6 @@ public class CreateBBCProjectOperation extends WorkspaceModifyOperation {
proj.open(monitor);
} catch (IOException e) {
throw new InvocationTargetException(e);
- } catch (ResourceException e){
- // ignore this exception since it only occurs for special internal files from the repository on Windows platform
- // the resource names on Windows must not contain '<', '>', ':','"', '/', '\', '|', '?', '*'
- // the ignored files must not be removed since they are internal cooking files, but the user does not need to see/modify them
} catch (Exception e) {
e.printStackTrace();
}
--
1.7.9.5


[PATCH v2 2/3] Allow '-' in project names

Ioana Grigoropol <ioanax.grigoropol@...>
 

Signed-off-by: Ioana Grigoropol <ioanax.grigoropol@...>
---
.../yocto/bc/ui/wizards/install/OptionsPage.java | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/plugins/org.yocto.bc.ui/src/org/yocto/bc/ui/wizards/install/OptionsPage.java b/plugins/org.yocto.bc.ui/src/org/yocto/bc/ui/wizards/install/OptionsPage.java
index 72aeec2..97d1ad0 100644
--- a/plugins/org.yocto.bc.ui/src/org/yocto/bc/ui/wizards/install/OptionsPage.java
+++ b/plugins/org.yocto.bc.ui/src/org/yocto/bc/ui/wizards/install/OptionsPage.java
@@ -313,7 +313,7 @@ public class OptionsPage extends FiniteStateWizardPage {
if (!Character.isJavaIdentifierStart(chars[0]))
return false;
for (int i = 1; i < chars.length; i++)
- if (!Character.isJavaIdentifierPart(chars[i]))
+ if (!Character.isJavaIdentifierPart(chars[i]) && chars[i] != '-')
return false;
return true;
}
--
1.7.9.5


[PATCH v2 1/3] Fix variables hoover & remote file system detection

Ioana Grigoropol <ioanax.grigoropol@...>
 

- initialize bitbake session for recipe:
- when starting a new project, the session environment variables are obtained by calling "bitbake -e"
- when a new recipe is created and edited, the session variables should be updated with the values obtained from "bitbake -e -b package" => overwrite the session with the new one
- if we try to retrive a "remote" file (local file system, remote host) using RSE protocol before the system is initialized, null will be returned causing every remote operation to fail:
- add exception handling
- make sure that the "remote" FileSystem gets initialized, as well as the project connection

Signed-off-by: Ioana Grigoropol <ioanax.grigoropol@...>
---
.../src/org/yocto/bc/bitbake/BBSession.java | 4 ++++
.../src/org/yocto/bc/bitbake/ShellSession.java | 13 ++++++++-----
.../org/yocto/bc/remote/utils/RemoteHelper.java | 7 ++++++-
.../org/yocto/bc/remote/utils/RemoteMachine.java | 8 +++++---
.../bc/ui/editors/bitbake/BBVariableTextHover.java | 12 +++++++++---
5 files changed, 32 insertions(+), 12 deletions(-)

diff --git a/plugins/org.yocto.bc.ui/src/org/yocto/bc/bitbake/BBSession.java b/plugins/org.yocto.bc.ui/src/org/yocto/bc/bitbake/BBSession.java
index 3aa4efe..66a6083 100644
--- a/plugins/org.yocto.bc.ui/src/org/yocto/bc/bitbake/BBSession.java
+++ b/plugins/org.yocto.bc.ui/src/org/yocto/bc/bitbake/BBSession.java
@@ -746,4 +746,8 @@ public class BBSession implements IBBSessionListener, IModelElement, Map {
wlock.unlock();
}
}
+
+ public Map<String, String> getProperties() {
+ return (Map<String, String>) properties;
+ }
}
diff --git a/plugins/org.yocto.bc.ui/src/org/yocto/bc/bitbake/ShellSession.java b/plugins/org.yocto.bc.ui/src/org/yocto/bc/bitbake/ShellSession.java
index c127c25..38e2557 100644
--- a/plugins/org.yocto.bc.ui/src/org/yocto/bc/bitbake/ShellSession.java
+++ b/plugins/org.yocto.bc.ui/src/org/yocto/bc/bitbake/ShellSession.java
@@ -86,8 +86,12 @@ public class ShellSession {

private void initializeShell(IProgressMonitor monitor) throws IOException {
try {
- RemoteHelper.runCommandRemote(projectInfo.getConnection(), new YoctoCommand("source " + initCmd, root.getAbsolutePath(), ""));
- RemoteHelper.runCommandRemote(projectInfo.getConnection(), new YoctoCommand(exportCmd, root.getAbsolutePath(), ""));
+ if (root != null) {
+ RemoteHelper.runCommandRemote(projectInfo.getConnection(), new YoctoCommand("source " + initCmd, root.getAbsolutePath(), ""));
+ RemoteHelper.runCommandRemote(projectInfo.getConnection(), new YoctoCommand(exportCmd, root.getAbsolutePath(), ""));
+ } else {
+ throw new Exception("Root file not found!");
+ }
} catch (Exception e) {
e.printStackTrace();
}
@@ -103,9 +107,8 @@ public class ShellSession {

try {
if (projectInfo.getConnection() != null) {
- IHost connection = RemoteHelper.getRemoteConnectionByName(projectInfo.getConnection().getName());
- hasErrors = RemoteHelper.runCommandRemote(connection, new YoctoCommand(command, root.getAbsolutePath() + "/build/", ""));
- return RemoteHelper.getProcessBuffer(connection).getMergedOutputLines();
+ hasErrors = RemoteHelper.runCommandRemote(projectInfo.getConnection(), new YoctoCommand(command, root.getAbsolutePath() + "/build/", ""));
+ return RemoteHelper.getProcessBuffer(projectInfo.getConnection()).getMergedOutputLines();
}
return null;
} catch (Exception e) {
diff --git a/plugins/org.yocto.bc.ui/src/org/yocto/bc/remote/utils/RemoteHelper.java b/plugins/org.yocto.bc.ui/src/org/yocto/bc/remote/utils/RemoteHelper.java
index c230fd6..e511e06 100644
--- a/plugins/org.yocto.bc.ui/src/org/yocto/bc/remote/utils/RemoteHelper.java
+++ b/plugins/org.yocto.bc.ui/src/org/yocto/bc/remote/utils/RemoteHelper.java
@@ -99,7 +99,11 @@ public class RemoteHelper {
if (host == null) {
// this is a local connection
ISystemRegistry sr = RSECorePlugin.getTheSystemRegistry();
- return sr.getLocalHost();
+ IHost local = null;
+ while (local == null) {
+ local = sr.getLocalHost();
+ }
+ return local;
}
ISystemRegistry sr = RSECorePlugin.getTheSystemRegistry();
IHost[] connections = sr.getHosts();
@@ -237,6 +241,7 @@ public class RemoteHelper {
IHostFile remoteFile = fileService.getFile(remotePath.removeLastSegments(1).toString(), remotePath.lastSegment(), new SubProgressMonitor(monitor, 5));
return remoteFile;
} catch (Exception e) {
+ e.printStackTrace();
}finally {
monitor.done();
}
diff --git a/plugins/org.yocto.bc.ui/src/org/yocto/bc/remote/utils/RemoteMachine.java b/plugins/org.yocto.bc.ui/src/org/yocto/bc/remote/utils/RemoteMachine.java
index 6eb2945..a25eea4 100644
--- a/plugins/org.yocto.bc.ui/src/org/yocto/bc/remote/utils/RemoteMachine.java
+++ b/plugins/org.yocto.bc.ui/src/org/yocto/bc/remote/utils/RemoteMachine.java
@@ -123,6 +123,9 @@ public class RemoteMachine {
}

public IHost getConnection() {
+// if (connection == null) {
+// connection = RemoteHelper.getRemoteConnectionForURI(, new NullProgressMonitor());
+// }
return connection;
}
public void setConnection(IHost connection) {
@@ -132,9 +135,8 @@ public class RemoteMachine {
public IFileService getRemoteFileService(IProgressMonitor monitor) throws Exception {
if (fileService == null) {

- if (getFileSubsystem() == null)
- throw new Exception(Messages.ErrorNoSubsystem);
-
+ while(getFileSubsystem() == null)
+ Thread.sleep(2);
try {
getFileSubsystem().connect(monitor, false);
} catch (CoreException e) {
diff --git a/plugins/org.yocto.bc.ui/src/org/yocto/bc/ui/editors/bitbake/BBVariableTextHover.java b/plugins/org.yocto.bc.ui/src/org/yocto/bc/ui/editors/bitbake/BBVariableTextHover.java
index cd18d54..329ec6b 100644
--- a/plugins/org.yocto.bc.ui/src/org/yocto/bc/ui/editors/bitbake/BBVariableTextHover.java
+++ b/plugins/org.yocto.bc.ui/src/org/yocto/bc/ui/editors/bitbake/BBVariableTextHover.java
@@ -29,11 +29,17 @@ class BBVariableTextHover implements ITextHover {

public BBVariableTextHover(BBSession session, URI file) {
this.session = session;
-// envMap = session;
+ envMap = getEnvironmentMap();
LoadRecipeJob loadRecipeJob = new LoadRecipeJob(getFilename(file), file);
loadRecipeJob.schedule();
}

+ private Map<String, String> getEnvironmentMap() {
+ if (envMap == null)
+ envMap = this.session.getProperties();
+ return envMap;
+ }
+
private String getFilename(URI uri) {
return uri.getPath();
}
@@ -77,7 +83,7 @@ class BBVariableTextHover implements ITextHover {
}

String key = new String(line, start + 2, i - start - 2);
- String val = (String) envMap.get(key);
+ String val = (String) getEnvironmentMap().get(key);

if (val == null) {
val = "";
@@ -103,7 +109,7 @@ class BBVariableTextHover implements ITextHover {
try {
BBRecipe recipe = Activator.getBBRecipe(session, filePath);
recipe.initialize();
-// envMap = recipe;
+ envMap = recipe;
} catch (Exception e) {
return new Status(IStatus.WARNING, Activator.PLUGIN_ID, "Unable to load session for " + filePath, e);
}
--
1.7.9.5


[PATCH v2 0/3][eclipse-poky][branch:windows-build]Multiple fixes for windows-build branch

Ioana Grigoropol <ioanax.grigoropol@...>
 

Ioana Grigoropol (3):
Fix variables hoover & remote file system detection
Allow '-' in project names
Reinstate OEFileSystem, OEFile and Ignored Paths for Linux

plugins/org.yocto.bc.ui/META-INF/MANIFEST.MF | 2 +-
plugins/org.yocto.bc.ui/plugin.xml | 3 +-
.../src/org/yocto/bc/bitbake/BBSession.java | 4 +
.../org/yocto/bc/bitbake/ProjectInfoHelper.java | 24 ++--
.../src/org/yocto/bc/bitbake/ShellSession.java | 13 ++-
.../org/yocto/bc/remote/utils/RemoteHelper.java | 7 +-
.../org/yocto/bc/remote/utils/RemoteMachine.java | 8 +-
.../src/org/yocto/bc/ui/Activator.java | 45 +++++---
.../org/yocto/bc/ui/BCResourceChangeListener.java | 1 -
.../bc/ui/editors/bitbake/BBVariableTextHover.java | 12 +-
.../src/org/yocto/bc/ui/filesystem/OEFile.java | 120 ++++----------------
.../org/yocto/bc/ui/filesystem/OEFileSystem.java | 50 ++++++--
.../bc/ui/filesystem/OEFileSystemContributor.java | 7 +-
.../org/yocto/bc/ui/filesystem/OEIgnoreFile.java | 31 ++++-
.../src/org/yocto/bc/ui/model/ProjectInfo.java | 21 +++-
.../src/org/yocto/bc/ui/model/YoctoHostFile.java | 100 ++++++++++++----
.../yocto/bc/ui/wizards/install/OptionsPage.java | 3 +-
.../newproject/CreateBBCProjectOperation.java | 23 ++--
18 files changed, 281 insertions(+), 193 deletions(-)

--
1.7.9.5


[PATCH 0/3][eclipse-poky][branch:windows-build]

Ioana Grigoropol <ioanax.grigoropol@...>
 

*** BLURB HERE ***

Ioana Grigoropol (1):
Fix variables hoover & remote file system detection

yocto (2):
Allow '-' in project names Signed-off-by: yocto
<yocto@yocto-VirtualBox.(none)>
Reinstate OEFileSystem, OEFile and Ignored Paths for Linux

plugins/org.yocto.bc.ui/META-INF/MANIFEST.MF | 2 +-
plugins/org.yocto.bc.ui/plugin.xml | 3 +-
.../src/org/yocto/bc/bitbake/BBSession.java | 4 +
.../org/yocto/bc/bitbake/ProjectInfoHelper.java | 24 ++--
.../src/org/yocto/bc/bitbake/ShellSession.java | 13 ++-
.../org/yocto/bc/remote/utils/RemoteHelper.java | 7 +-
.../org/yocto/bc/remote/utils/RemoteMachine.java | 8 +-
.../src/org/yocto/bc/ui/Activator.java | 45 +++++---
.../org/yocto/bc/ui/BCResourceChangeListener.java | 1 -
.../bc/ui/editors/bitbake/BBVariableTextHover.java | 12 +-
.../src/org/yocto/bc/ui/filesystem/OEFile.java | 120 ++++----------------
.../org/yocto/bc/ui/filesystem/OEFileSystem.java | 50 ++++++--
.../bc/ui/filesystem/OEFileSystemContributor.java | 7 +-
.../org/yocto/bc/ui/filesystem/OEIgnoreFile.java | 31 ++++-
.../src/org/yocto/bc/ui/model/ProjectInfo.java | 21 +++-
.../src/org/yocto/bc/ui/model/YoctoHostFile.java | 100 ++++++++++++----
.../yocto/bc/ui/wizards/install/OptionsPage.java | 3 +-
.../newproject/CreateBBCProjectOperation.java | 23 ++--
18 files changed, 281 insertions(+), 193 deletions(-)

--
1.7.9.5


Re: Recipes for Xilinx ZC706 (Zynq 7045) and Avnet Zedboard

Andreas Schweigstill <andreas@...>
 

Dear Philip,

I just checked the Xilinx Linux kernel and found out that all configuration
items for Zynq development boards have been removed, so we can already use a
unified kernel for ZC702/706/770 and Zedboard. DTS files for all flavours are
located in arch/arm/boot/dts.

We just received the first ZC706 board a few days ago.

With best regards,
Andreas Schweigstill

Am Do, 01/10/2013 14:43, hat Philip Balister <philip@...> geschrieben:

On 01/10/2013 05:26 AM, Andreas Schweigstill wrote:
Hello,

after successfully using the recipe for the ZC702 development board I would
like to know if anybody is working on recipes for the Xilinx ZC706 (Zynq 7045)
and Avnet Zedboard.

Trying ....

I am looking at the best way to do this. My goal is to get one kernel in
meta-zynq that is pretty good across the public boards and do the board
selection via the device tree.

In the meantime, you can build a rootfs for the zc702 and use a kernel
built outside OE. Do you know if there is support for the zc706 in the
code on the public Xilnx git repo.

Philip



Thank you very much in advance!

With best regards,
Andreas Schweigstill

​--
Dipl.-Phys. Andreas Schweigstill
Schweigstill IT | Embedded Systems
Schauenburgerstraße 116, D-24118 Kiel, Germany
Phone: (+49) 431 530354-35, Fax: (+49) 431 530354-36
Mobile: (+49) 171 6921973, Web: http://www.schweigstill.de/
_______________________________________________
yocto mailing list
yocto@...
https://lists.yoctoproject.org/listinfo/yocto


Re: Recipes for Xilinx ZC706 (Zynq 7045) and Avnet Zedboard

Philip Balister
 

On 01/10/2013 05:26 AM, Andreas Schweigstill wrote:
Hello,

after successfully using the recipe for the ZC702 development board I would
like to know if anybody is working on recipes for the Xilinx ZC706 (Zynq 7045)
and Avnet Zedboard.

Trying ....

I am looking at the best way to do this. My goal is to get one kernel in
meta-zynq that is pretty good across the public boards and do the board
selection via the device tree.

In the meantime, you can build a rootfs for the zc702 and use a kernel
built outside OE. Do you know if there is support for the zc706 in the
code on the public Xilnx git repo.

Philip



Thank you very much in advance!

With best regards,
Andreas Schweigstill

​--
Dipl.-Phys. Andreas Schweigstill
Schweigstill IT | Embedded Systems
Schauenburgerstraße 116, D-24118 Kiel, Germany
Phone: (+49) 431 530354-35, Fax: (+49) 431 530354-36
Mobile: (+49) 171 6921973, Web: http://www.schweigstill.de/
_______________________________________________
yocto mailing list
yocto@...
https://lists.yoctoproject.org/listinfo/yocto