Skip to contentSkip to conversation

Multiple fixes

PATCH New Ioana Grigoropol 1 participant 6 messages Jan 15, 2013

lore
Share & tools
lore
#0 lore raw

v3 cover Multiple fixes

- applies onto commit 5a27bb1f9e45f0a9408453f9e7e70cc333b97afe (windows-build HEAD)

Ioana Grigoropol (5):
Fix variables hoover & remote file system detection Allow '-' in project names
Reinstate OEFileSystem, OEFile and Ignored Paths for Linux Disable "Finish" when project location is invalid Send output from bitbake environment parsing in the background

 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        |   91 ++++++++-----
 .../org/yocto/bc/bitbake/ProjectInfoHelper.java    |   24 ++--
 .../src/org/yocto/bc/bitbake/ShellSession.java     |   14 +-
 .../org/yocto/bc/remote/utils/RemoteHelper.java    |   10 +-
 .../org/yocto/bc/remote/utils/RemoteMachine.java   |   25 ++--
 .../remote/utils/YoctoHostShellProcessAdapter.java |   14 +-
 .../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     |  143 ++++++--------------
 .../org/yocto/bc/ui/filesystem/OEFileSystem.java   |   52 ++++---
 .../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   |  110 ++++++++++++---
 .../yocto/bc/ui/wizards/FiniteStateWizardPage.java |   54 ++++----
 .../bc/ui/wizards/NewBitBakeFileRecipeWizard.java  |   58 ++++----
 .../ui/wizards/NewBitBakeFileRecipeWizardPage.java |    5 +-
 .../yocto/bc/ui/wizards/install/InstallWizard.java |   63 +++++----
 .../yocto/bc/ui/wizards/install/OptionsPage.java   |   11 +-
 .../BBConfigurationInitializeOperation.java        |    2 +
 .../newproject/CreateBBCProjectOperation.java      |   23 ++--
 24 files changed, 494 insertions(+), 327 deletions(-)
Signature · 1 line
1.7.9.5
#1 lore raw

PATCH v3 1/5 Fix variables hoover & remote file system detection

- 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

---
 .../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(-)
plugins/org.yocto.bc.ui/src/org/yocto/bc/bitbake/BBSession.java +4 -0
index 3aa4efe..66a6083 100644
@@ -746,4 +746,8 @@ public class BBSession implements IBBSessionListener, IModelElement, Map {
 			wlock.unlock();
 		}
 	}
+
+	public Map<String, String> getProperties() {
+		return (Map<String, String>) properties;
+	}
 }
plugins/org.yocto.bc.ui/src/org/yocto/bc/bitbake/ShellSession.java +8 -5
index c127c25..38e2557 100644
@@ -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) {
plugins/org.yocto.bc.ui/src/org/yocto/bc/remote/utils/RemoteHelper.java +6 -1
index c230fd6..e511e06 100644
@@ -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();
 		}
plugins/org.yocto.bc.ui/src/org/yocto/bc/remote/utils/RemoteMachine.java +5 -3
index 6eb2945..a25eea4 100644
@@ -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) {
plugins/org.yocto.bc.ui/src/org/yocto/bc/ui/editors/bitbake/BBVariableTextHover.java +9 -3
index cd18d54..329ec6b 100644
@@ -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);
 			} 
Signature · 1 line
1.7.9.5
#2 lore raw

PATCH v3 2/5 Allow '-' in project names

In reply to Ioana Grigoropol
---
 .../yocto/bc/ui/wizards/install/OptionsPage.java   |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
plugins/org.yocto.bc.ui/src/org/yocto/bc/ui/wizards/install/OptionsPage.java +1 -1
index 72aeec2..97d1ad0 100644
@@ -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;
 	}
Signature · 1 line
1.7.9.5
#3 lore raw

PATCH v3 3/5 Reinstate OEFileSystem, OEFile and Ignored Paths for Linux

In reply to Ioana 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

---
 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        |   62 ++++++---
 .../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     |  143 ++++++--------------
 .../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   |  110 ++++++++++++---
 .../yocto/bc/ui/wizards/install/OptionsPage.java   |    2 +-
 .../newproject/CreateBBCProjectOperation.java      |   23 ++--
 14 files changed, 318 insertions(+), 206 deletions(-)
plugins/org.yocto.bc.ui/META-INF/MANIFEST.MF +1 -1
index 9e8c523..1f0e63e 100644
@@ -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,
plugins/org.yocto.bc.ui/plugin.xml +1 -2
index cb0561c..6ba9b5f 100644
@@ -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>
plugins/org.yocto.bc.ui/src/org/yocto/bc/bitbake/BBSession.java +40 -22

248 lines not on this page · raw message

plugins/org.yocto.bc.ui/src/org/yocto/bc/bitbake/ProjectInfoHelper.java +11 -13
index 2938c95..f5259e5 100644
@@ -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();
 		}
-		
-		
+
+
 	}
 
 }
plugins/org.yocto.bc.ui/src/org/yocto/bc/ui/Activator.java +32 -13

63 lines not on this page · raw message

plugins/org.yocto.bc.ui/src/org/yocto/bc/ui/BCResourceChangeListener.java +0 -1
index f22f583..8a2bfdd 100644
@@ -41,7 +41,6 @@ public class BCResourceChangeListener implements IResourceChangeListener {
             			        	  removed.add(res);
             			              break;
             			           case IResourceDelta.CHANGED:
-            			        	  res.getLocation();
             			        	  changed.add(res);
             			              break;
             			        }
plugins/org.yocto.bc.ui/src/org/yocto/bc/ui/filesystem/OEFile.java +45 -98

283 lines not on this page · raw message

plugins/org.yocto.bc.ui/src/org/yocto/bc/ui/filesystem/OEFileSystem.java +38 -12

98 lines not on this page · raw message

plugins/org.yocto.bc.ui/src/org/yocto/bc/ui/filesystem/OEFileSystemContributor.java +5 -2
index 4ac2998..dfa2bff 100644
@@ -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);
 	}
-	
+
 }
plugins/org.yocto.bc.ui/src/org/yocto/bc/ui/filesystem/OEIgnoreFile.java +26 -5
index 26da202..9764ca1 100644
@@ -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;
 	}
-	
-	
+
+
 }
plugins/org.yocto.bc.ui/src/org/yocto/bc/ui/model/ProjectInfo.java +15 -6
index 4530bb3..089c1ac 100644
@@ -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;
+	}
 }
plugins/org.yocto.bc.ui/src/org/yocto/bc/ui/model/YoctoHostFile.java +90 -20

223 lines not on this page · raw message

plugins/org.yocto.bc.ui/src/org/yocto/bc/ui/wizards/install/OptionsPage.java +1 -1
index 97d1ad0..a103d2b 100644
@@ -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;
@@ -182,6 +181,7 @@ public class OptionsPage extends FiniteStateWizardPage {
 					setErrorMessage("A project with the name " + projName + " already exists");
 					return false;
 				}
+				//FIXME : do not throw exception when illegal characters show in URI ->show error on page
 				URI location = new URI("file:" + URI_SEPARATOR + URI_SEPARATOR + convertToRealPath(projectLoc) + URI_SEPARATOR + txtProjectName.getText());
 
 				IStatus status = ResourcesPlugin.getWorkspace().validateProjectLocationURI(proj, location);
plugins/org.yocto.bc.ui/src/org/yocto/bc/ui/wizards/newproject/CreateBBCProjectOperation.java +13 -10
index 42fa5b1..5ba661c 100644
@@ -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();
 		}
Signature · 1 line
1.7.9.5
#4 lore raw

PATCH v3 4/5 Disable "Finish" when project location is invalid

In reply to Ioana Grigoropol

- when Bitbake project location is invalid, an error should be displayed and "finish" button disabled

---
 .../yocto/bc/ui/wizards/install/OptionsPage.java   |   10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)
plugins/org.yocto.bc.ui/src/org/yocto/bc/ui/wizards/install/OptionsPage.java +7 -3
index a103d2b..7a705aa 100644
@@ -88,8 +88,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);
 			}
 		};
 
@@ -181,7 +186,6 @@ public class OptionsPage extends FiniteStateWizardPage {
 					setErrorMessage("A project with the name " + projName + " already exists");
 					return false;
 				}
-				//FIXME : do not throw exception when illegal characters show in URI ->show error on page
 				URI location = new URI("file:" + URI_SEPARATOR + URI_SEPARATOR + convertToRealPath(projectLoc) + URI_SEPARATOR + txtProjectName.getText());
 
 				IStatus status = ResourcesPlugin.getWorkspace().validateProjectLocationURI(proj, location);
Signature · 1 line
1.7.9.5
#5 lore raw

PATCH v3 5/5 Send output from bitbake environment parsing in the background

In reply to Ioana 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

---
 .../src/org/yocto/bc/bitbake/BBSession.java        |   27 +++++----
 .../src/org/yocto/bc/bitbake/ShellSession.java     |    3 +-
 .../org/yocto/bc/remote/utils/RemoteHelper.java    |    3 +-
 .../org/yocto/bc/remote/utils/RemoteMachine.java   |   23 +++----
 .../remote/utils/YoctoHostShellProcessAdapter.java |   14 ++++-
 .../org/yocto/bc/ui/filesystem/OEFileSystem.java   |   14 ++---
 .../yocto/bc/ui/wizards/FiniteStateWizardPage.java |   54 +++++++++--------
 .../bc/ui/wizards/NewBitBakeFileRecipeWizard.java  |   58 +++++++++---------
 .../ui/wizards/NewBitBakeFileRecipeWizardPage.java |    5 +-
 .../yocto/bc/ui/wizards/install/InstallWizard.java |   63 +++++++++++++-------
 .../yocto/bc/ui/wizards/install/OptionsPage.java   |    1 +
 .../BBConfigurationInitializeOperation.java        |    2 +
 12 files changed, 149 insertions(+), 118 deletions(-)
plugins/org.yocto.bc.ui/src/org/yocto/bc/bitbake/BBSession.java +14 -13
index 037d8aa..9adeb3f 100644
@@ -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;
@@ -58,6 +58,8 @@ public class BBSession implements IBBSessionListener, IModelElement, Map {
 	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 CONF_DIR = "/conf";
 	public static final String BUILDDIR_INDICATORS [] = {
 		"/local.conf",
@@ -81,7 +83,7 @@ public class BBSession implements IBBSessionListener, IModelElement, Map {
 		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 {
@@ -387,11 +389,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 {
@@ -450,10 +452,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;
@@ -520,11 +520,11 @@ public class BBSession implements IBBSessionListener, IModelElement, Map {
 		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) {
@@ -768,4 +768,5 @@ public class BBSession implements IBBSessionListener, IModelElement, Map {
 	public Map<String, String> getProperties() {
 		return (Map<String, String>) properties;
 	}
+
 }
plugins/org.yocto.bc.ui/src/org/yocto/bc/bitbake/ShellSession.java +2 -1
index 38e2557..6441029 100644
@@ -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) {
plugins/org.yocto.bc.ui/src/org/yocto/bc/remote/utils/RemoteHelper.java +1 -2
index e511e06..814e3a5 100644
@@ -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) {
plugins/org.yocto.bc.ui/src/org/yocto/bc/remote/utils/RemoteMachine.java +9 -14
index a25eea4..d4cdb23 100644
@@ -8,8 +8,6 @@ import org.eclipse.core.runtime.IProgressMonitor;
 import org.eclipse.core.runtime.NullProgressMonitor;
 import org.eclipse.core.runtime.OperationCanceledException;
 import org.eclipse.core.runtime.Status;
-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.core.subsystems.ISubSystem;
 import org.eclipse.rse.services.clientserver.messages.SystemMessageException;
@@ -23,8 +21,8 @@ import org.yocto.bc.ui.wizards.install.Messages;
 
 public class RemoteMachine {
 	public static final String PROXY = "proxy";
-	
-	private Map<String, String> environment; 	
+
+	private Map<String, String> environment;
 	private MessageConsole console;
 	private CommandResponseHandler cmdHandler;
 	private IHostShell hostShell;
@@ -39,7 +37,7 @@ public class RemoteMachine {
 	public RemoteMachine(IHost connection) {
 		setConnection(connection);
 	}
-	
+
 	public Map<String, String> getEnvironment() {
 		return environment;
 	}
@@ -70,7 +68,7 @@ public class RemoteMachine {
 		}
 		return hostShell;
 	}
-	
+
 	public YoctoHostShellProcessAdapter getHostShellProcessAdapter() {
 		try {
 			if (hostShellProcessAdapter == null)
@@ -81,11 +79,11 @@ public class RemoteMachine {
 			return null;
 		}
 	}
-	
+
 	public IShellService getShellService(IProgressMonitor monitor) throws Exception {
 		if (shellService != null)
 			return shellService;
-		
+
 		final ISubSystem subsystem = getShellSubsystem();
 
 		if (subsystem == null)
@@ -123,9 +121,6 @@ public class RemoteMachine {
 	}
 
 	public IHost getConnection() {
-//		if (connection == null) {
-//			connection = RemoteHelper.getRemoteConnectionForURI(, new NullProgressMonitor());
-//		}
 		return connection;
 	}
 	public void setConnection(IHost connection) {
@@ -134,7 +129,7 @@ public class RemoteMachine {
 
 	public IFileService getRemoteFileService(IProgressMonitor monitor) throws Exception {
 		if (fileService == null) {
-	
+
 			while(getFileSubsystem() == null)
 				Thread.sleep(2);
 			try {
@@ -144,10 +139,10 @@ public class RemoteMachine {
 			} catch (OperationCanceledException e) {
 				throw new CoreException(Status.CANCEL_STATUS);
 			}
-	
+
 			if (!getFileSubsystem().isConnected())
 				throw new Exception(Messages.ErrorConnectSubsystem);
-	
+
 			fileService = ((IFileServiceSubSystem) getFileSubsystem()).getFileService();
 		}
 		return fileService;
plugins/org.yocto.bc.ui/src/org/yocto/bc/remote/utils/YoctoHostShellProcessAdapter.java +12 -2
index bb137b1..aca6a6e 100644
@@ -140,7 +140,8 @@ public class YoctoHostShellProcessAdapter extends  HostShellProcessAdapter {
 				}
 				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;
+	}
+
 }
plugins/org.yocto.bc.ui/src/org/yocto/bc/ui/filesystem/OEFileSystem.java +4 -10
index 5efdcdc..df6b8d4 100644
@@ -42,23 +42,17 @@ public class OEFileSystem extends FileSystem {
 		return ref;
 	}
 
-	private Map fileStoreCache;
+	private Map<URI, OEFile> fileStoreCache;
 
 	public OEFileSystem() {
 		ref = this;
-		fileStoreCache = new Hashtable();
+		fileStoreCache = new Hashtable<URI, OEFile>();
 	}
 
-//	public OEFileSystem(ProjectInfo pInfo) {
-//		ref = this;
-//		projInfo = pInfo;
-//		fileStoreCache = new Hashtable();
-//	}
-
 	@Override
 	public IFileStore getStore(URI uri) {
 
-		OEFile uf = (OEFile) fileStoreCache.get(uri);
+		OEFile uf = fileStoreCache.get(uri);
 		setProjInfo(uri);
 
 		if (uf == null) {
@@ -75,7 +69,7 @@ public class OEFileSystem extends FileSystem {
 				throw new RuntimeException("Invalid local.conf: TMPDIR or DL_DIR or SSTATE_DIR undefined.");
 			}
 
-			List ignoreList = new ArrayList();
+			List<Object> ignoreList = new ArrayList<Object>();
 
 			//These directories are ignored because they contain too many files for Eclipse to handle efficiently.
 			ignoreList.add(config.get("TMPDIR"));
plugins/org.yocto.bc.ui/src/org/yocto/bc/ui/wizards/FiniteStateWizardPage.java +30 -24

138 lines not on this page · raw message

plugins/org.yocto.bc.ui/src/org/yocto/bc/ui/wizards/NewBitBakeFileRecipeWizard.java +30 -28

156 lines not on this page · raw message

plugins/org.yocto.bc.ui/src/org/yocto/bc/ui/wizards/NewBitBakeFileRecipeWizardPage.java +4 -1
index a52c2fe..c55f8d7 100644
@@ -407,7 +407,10 @@ public class NewBitBakeFileRecipeWizardPage extends WizardPage {
 
 	private String retrieveSum(String arg, String pattern) {
 		ProcessStreamBuffer buffer = RemoteHelper.getProcessBuffer(this.connection);
-		return buffer.getOutputLineContaining(arg, pattern);
+		String sum = buffer.getOutputLineContaining(arg, pattern);
+		if (sum == null)
+			return "";
+		return sum;
 	}
 
 	private URI extractPackage(URI srcURI) {
plugins/org.yocto.bc.ui/src/org/yocto/bc/ui/wizards/install/InstallWizard.java +40 -23

150 lines not on this page · raw message

plugins/org.yocto.bc.ui/src/org/yocto/bc/ui/wizards/install/OptionsPage.java +1 -0
index 7a705aa..486bd8b 100644
@@ -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;
plugins/org.yocto.bc.ui/src/org/yocto/bc/ui/wizards/newproject/BBConfigurationInitializeOperation.java +2 -0
index 7a68ed5..942f303 100644
@@ -40,12 +40,14 @@ public class BBConfigurationInitializeOperation implements IRunnableWithProgress
 	public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
 		BBSession session;
 		try {
+			System.out.println("Initialize bitbake session ...");
 			monitor.beginTask("Initialize bitbake session ...", RemoteHelper.TOTALWORKLOAD);
 			ProjectInfoHelper.store(RemoteHelper.getRemoteConnectionByName(pinfo.getConnection().getName()), pinfo.getURI(), pinfo, monitor);
 			session = Activator.getBBSession(pinfo, writer, monitor);
 			session.initialize();
 			monitor.worked(90);
 			monitor.done();
+			System.out.println("Bitbake session initialized successfully.");
 		} catch (Exception e) {
 			throw new InvocationTargetException(e);
 		}
Signature · 1 line
1.7.9.5