Multiple fixes for windows-build branch
v2 cover Multiple fixes for windows-build branch
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(-)
Signature · 1 line
1.7.9.5
PATCH v2 1/3 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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
PATCH v2 2/3 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
@@ -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
PATCH v2 3/3 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 +- .../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(-)
plugins/org.yocto.bc.ui/META-INF/MANIFEST.MF +1 -1
@@ -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
@@ -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/ProjectInfoHelper.java +11 -13
@@ -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
@@ -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 +25 -95
255 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
@@ -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
@@ -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
@@ -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 +81 -19
203 lines not on this page · raw message
plugins/org.yocto.bc.ui/src/org/yocto/bc/ui/wizards/install/OptionsPage.java +0 -1
@@ -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;
plugins/org.yocto.bc.ui/src/org/yocto/bc/ui/wizards/newproject/CreateBBCProjectOperation.java +13 -10
@@ -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