Date   

[PATCH v3 5/5] 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 | 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(-)

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 037d8aa..9adeb3f 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;
@@ -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;
}
+
}
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..d4cdb23 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
@@ -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;
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..aca6a6e 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
@@ -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;
+ }
+
}
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..df6b8d4 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
@@ -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"));
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/NewBitBakeFileRecipeWizardPage.java b/plugins/org.yocto.bc.ui/src/org/yocto/bc/ui/wizards/NewBitBakeFileRecipeWizardPage.java
index a52c2fe..c55f8d7 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
@@ -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) {
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 7a705aa..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;
diff --git a/plugins/org.yocto.bc.ui/src/org/yocto/bc/ui/wizards/newproject/BBConfigurationInitializeOperation.java b/plugins/org.yocto.bc.ui/src/org/yocto/bc/ui/wizards/newproject/BBConfigurationInitializeOperation.java
index 7a68ed5..942f303 100644
--- a/plugins/org.yocto.bc.ui/src/org/yocto/bc/ui/wizards/newproject/BBConfigurationInitializeOperation.java
+++ b/plugins/org.yocto.bc.ui/src/org/yocto/bc/ui/wizards/newproject/BBConfigurationInitializeOperation.java
@@ -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);
}
--
1.7.9.5


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

Ioana Grigoropol <ioanax.grigoropol@...>
 

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

Signed-off-by: Ioana Grigoropol <ioanax.grigoropol@...>
---
.../yocto/bc/ui/wizards/install/OptionsPage.java | 10 +++++++---
1 file changed, 7 insertions(+), 3 deletions(-)

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 a103d2b..7a705aa 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
@@ -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);
--
1.7.9.5


[PATCH v3 3/5] 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 +-
.../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(-)

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/BBSession.java b/plugins/org.yocto.bc.ui/src/org/yocto/bc/bitbake/BBSession.java
index 66a6083..037d8aa 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
@@ -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,10 +57,11 @@ 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 CONF_DIR = "/conf";
public static final String BUILDDIR_INDICATORS [] = {
- "/conf/local.conf",
- "/conf/bblayers.conf",
+ "/local.conf",
+ "/bblayers.conf",
};

protected final ProjectInfo pinfo;
@@ -74,7 +75,7 @@ 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();
@@ -87,7 +88,7 @@ public class BBSession implements IBBSessionListener, IModelElement, Map {
this(ssession, projectRoot);
this.silent = silent;
}
-
+
private Collection adapttoIPath(List<File> asList, IProject project) {

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

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

@@ -112,7 +113,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 +125,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 +144,7 @@ public class BBSession implements IBBSessionListener, IModelElement, Map {
}
}

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

+ @Override
public Set entrySet() {
try {
checkValidAndLock(true);
@@ -188,7 +193,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 +202,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 +215,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 +247,7 @@ public class BBSession implements IBBSessionListener, IModelElement, Map {
return recipes;
}

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

@@ -348,6 +356,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));
@@ -396,6 +405,7 @@ public class BBSession implements IBBSessionListener, IModelElement, Map {
//not release lock
}

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

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

protected void parse(String content, Map outMap) throws Exception {
if (content == null)
- return;
+ return;
BufferedReader reader = new BufferedReader(new StringReader(content));
String line;
boolean inLine = false;
@@ -484,7 +496,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,7 +519,7 @@ public class BBSession implements IBBSessionListener, IModelElement, Map {
protected URI getDefaultDepends() {
return null;
}
-
+
protected Map parseBBEnvironment(String bbOut) throws Exception {
Map env = new Hashtable();
this.depends = new ArrayList<URI>();
@@ -517,8 +529,8 @@ public class BBSession implements IBBSessionListener, IModelElement, Map {
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 +543,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 +623,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 +652,7 @@ public class BBSession implements IBBSessionListener, IModelElement, Map {
return line;
}

+ @Override
public int size() {
try {
checkValidAndLock(true);
@@ -686,7 +702,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 +726,7 @@ public class BBSession implements IBBSessionListener, IModelElement, Map {
return expression;
}

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

+ @Override
public void changeNotified(IResource[] added, IResource[] removed, IResource[] changed) {
wlock.lock();
try {
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..f12d6f3 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,10 +27,8 @@ 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;
@@ -52,18 +45,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 +62,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);
@@ -112,12 +83,26 @@ public class OEFile extends FileStore {
* detect if the path is potential builddir
*/
private boolean isPotentialBuildDir(String path) {
+ String parentPath = path.substring(0, path.lastIndexOf("/"));
boolean ret = true;
- for (int i=0; i < BBSession.BUILDDIR_INDICATORS.length && ret == true; i++) {
- if((new File(path + BBSession.BUILDDIR_INDICATORS[i])).exists() == false) {
- ret=false;
- break;
+ try {
+ IFileService fs = file.getFileService();
+ IHostFile hostFile = fs.getFile(parentPath, path, new NullProgressMonitor());
+ if (!hostFile.isDirectory())
+ return false;
+ IHostFile confDir = fs.getFile(path, path + BBSession.CONF_DIR, new NullProgressMonitor());
+ if (!confDir.exists() || !confDir.isDirectory())
+ return false;
+ for (int i = 0; i < BBSession.BUILDDIR_INDICATORS.length && ret == true; i++) {
+ IHostFile child = fs.getFile(path, path + BBSession.CONF_DIR + BBSession.BUILDDIR_INDICATORS[i], new NullProgressMonitor());
+ if(!child.exists() || !child.isFile()) {
+ ret = false;
+ break;
+ }
}
+
+ } catch (SystemMessageException e) {
+ e.printStackTrace();
}
return ret;
}
@@ -125,11 +110,12 @@ 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(), new NullProgressMonitor()),
ProjectInfoHelper.getInitScriptPath(root) + " " + path, null);
config = new BBSession(shell, root, true);
config.initialize();
@@ -158,18 +144,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];
-
+ String fullPath = file.getAbsolutePath() + 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 +163,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 +180,7 @@ public class OEFile extends FileStore {
// }
}
//fall through to super implementation
-// super.copy(destFile, options, monitor);
+// super.copy(destFileStore, options, monitor);
}

@Override
@@ -207,13 +193,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 +235,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 +248,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 +298,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 +383,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 +452,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..ca5a960 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());
@@ -181,7 +241,7 @@ public class YoctoHostFile implements IHostFile{
}
public YoctoHostFile getChildHostFile(String name) {
try {
- return new YoctoHostFile(projectInfo, getChildURI(name), null);
+ return new YoctoHostFile(projectInfo, getChildURI(name), new NullProgressMonitor());
} catch (SystemMessageException e) {
e.printStackTrace();
return null;
@@ -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;
}
}

@@ -232,4 +294,12 @@ public class YoctoHostFile implements IHostFile{
e.printStackTrace();
}
}
+
+ public IFileService getFileService() {
+ return fileService;
+ }
+
+ public void setFileService(IFileService fileService) {
+ this.fileService = fileService;
+ }
}
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..a103d2b 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;
@@ -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);
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 v3 2/5] 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 v3 1/5] 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 v3 0/5][eclipse-poky][branch:windows-build]Multiple fixes

Ioana Grigoropol <ioanax.grigoropol@...>
 

- 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(-)

--
1.7.9.5


[PATCH v2 5/5] 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 | 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(-)

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 037d8aa..9adeb3f 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;
@@ -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;
}
+
}
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..d4cdb23 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
@@ -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;
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..aca6a6e 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
@@ -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;
+ }
+
}
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..df6b8d4 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
@@ -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"));
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/NewBitBakeFileRecipeWizardPage.java b/plugins/org.yocto.bc.ui/src/org/yocto/bc/ui/wizards/NewBitBakeFileRecipeWizardPage.java
index a52c2fe..c55f8d7 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
@@ -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) {
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 7a705aa..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;
diff --git a/plugins/org.yocto.bc.ui/src/org/yocto/bc/ui/wizards/newproject/BBConfigurationInitializeOperation.java b/plugins/org.yocto.bc.ui/src/org/yocto/bc/ui/wizards/newproject/BBConfigurationInitializeOperation.java
index 7a68ed5..942f303 100644
--- a/plugins/org.yocto.bc.ui/src/org/yocto/bc/ui/wizards/newproject/BBConfigurationInitializeOperation.java
+++ b/plugins/org.yocto.bc.ui/src/org/yocto/bc/ui/wizards/newproject/BBConfigurationInitializeOperation.java
@@ -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);
}
--
1.7.9.5


[PATCH v2 4/5] Disable "Finish" when project location is invalid

Ioana Grigoropol <ioanax.grigoropol@...>
 

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

Signed-off-by: Ioana Grigoropol <ioanax.grigoropol@...>
---
.../yocto/bc/ui/wizards/install/OptionsPage.java | 10 +++++++---
1 file changed, 7 insertions(+), 3 deletions(-)

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 a103d2b..7a705aa 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
@@ -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);
--
1.7.9.5


[PATCH v2 3/3] 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 | 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(-)

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 037d8aa..9adeb3f 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;
@@ -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;
}
+
}
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..d4cdb23 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
@@ -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;
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..aca6a6e 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
@@ -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;
+ }
+
}
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..df6b8d4 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
@@ -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"));
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/NewBitBakeFileRecipeWizardPage.java b/plugins/org.yocto.bc.ui/src/org/yocto/bc/ui/wizards/NewBitBakeFileRecipeWizardPage.java
index a52c2fe..c55f8d7 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
@@ -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) {
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 7a705aa..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;
diff --git a/plugins/org.yocto.bc.ui/src/org/yocto/bc/ui/wizards/newproject/BBConfigurationInitializeOperation.java b/plugins/org.yocto.bc.ui/src/org/yocto/bc/ui/wizards/newproject/BBConfigurationInitializeOperation.java
index 7a68ed5..942f303 100644
--- a/plugins/org.yocto.bc.ui/src/org/yocto/bc/ui/wizards/newproject/BBConfigurationInitializeOperation.java
+++ b/plugins/org.yocto.bc.ui/src/org/yocto/bc/ui/wizards/newproject/BBConfigurationInitializeOperation.java
@@ -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);
}
--
1.7.9.5


[PATCH v2 3/5] 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 +-
.../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(-)

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/BBSession.java b/plugins/org.yocto.bc.ui/src/org/yocto/bc/bitbake/BBSession.java
index 66a6083..037d8aa 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
@@ -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,10 +57,11 @@ 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 CONF_DIR = "/conf";
public static final String BUILDDIR_INDICATORS [] = {
- "/conf/local.conf",
- "/conf/bblayers.conf",
+ "/local.conf",
+ "/bblayers.conf",
};

protected final ProjectInfo pinfo;
@@ -74,7 +75,7 @@ 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();
@@ -87,7 +88,7 @@ public class BBSession implements IBBSessionListener, IModelElement, Map {
this(ssession, projectRoot);
this.silent = silent;
}
-
+
private Collection adapttoIPath(List<File> asList, IProject project) {

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

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

@@ -112,7 +113,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 +125,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 +144,7 @@ public class BBSession implements IBBSessionListener, IModelElement, Map {
}
}

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

+ @Override
public Set entrySet() {
try {
checkValidAndLock(true);
@@ -188,7 +193,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 +202,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 +215,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 +247,7 @@ public class BBSession implements IBBSessionListener, IModelElement, Map {
return recipes;
}

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

@@ -348,6 +356,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));
@@ -396,6 +405,7 @@ public class BBSession implements IBBSessionListener, IModelElement, Map {
//not release lock
}

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

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

protected void parse(String content, Map outMap) throws Exception {
if (content == null)
- return;
+ return;
BufferedReader reader = new BufferedReader(new StringReader(content));
String line;
boolean inLine = false;
@@ -484,7 +496,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,7 +519,7 @@ public class BBSession implements IBBSessionListener, IModelElement, Map {
protected URI getDefaultDepends() {
return null;
}
-
+
protected Map parseBBEnvironment(String bbOut) throws Exception {
Map env = new Hashtable();
this.depends = new ArrayList<URI>();
@@ -517,8 +529,8 @@ public class BBSession implements IBBSessionListener, IModelElement, Map {
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 +543,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 +623,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 +652,7 @@ public class BBSession implements IBBSessionListener, IModelElement, Map {
return line;
}

+ @Override
public int size() {
try {
checkValidAndLock(true);
@@ -686,7 +702,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 +726,7 @@ public class BBSession implements IBBSessionListener, IModelElement, Map {
return expression;
}

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

+ @Override
public void changeNotified(IResource[] added, IResource[] removed, IResource[] changed) {
wlock.lock();
try {
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..f12d6f3 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,10 +27,8 @@ 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;
@@ -52,18 +45,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 +62,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);
@@ -112,12 +83,26 @@ public class OEFile extends FileStore {
* detect if the path is potential builddir
*/
private boolean isPotentialBuildDir(String path) {
+ String parentPath = path.substring(0, path.lastIndexOf("/"));
boolean ret = true;
- for (int i=0; i < BBSession.BUILDDIR_INDICATORS.length && ret == true; i++) {
- if((new File(path + BBSession.BUILDDIR_INDICATORS[i])).exists() == false) {
- ret=false;
- break;
+ try {
+ IFileService fs = file.getFileService();
+ IHostFile hostFile = fs.getFile(parentPath, path, new NullProgressMonitor());
+ if (!hostFile.isDirectory())
+ return false;
+ IHostFile confDir = fs.getFile(path, path + BBSession.CONF_DIR, new NullProgressMonitor());
+ if (!confDir.exists() || !confDir.isDirectory())
+ return false;
+ for (int i = 0; i < BBSession.BUILDDIR_INDICATORS.length && ret == true; i++) {
+ IHostFile child = fs.getFile(path, path + BBSession.CONF_DIR + BBSession.BUILDDIR_INDICATORS[i], new NullProgressMonitor());
+ if(!child.exists() || !child.isFile()) {
+ ret = false;
+ break;
+ }
}
+
+ } catch (SystemMessageException e) {
+ e.printStackTrace();
}
return ret;
}
@@ -125,11 +110,12 @@ 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(), new NullProgressMonitor()),
ProjectInfoHelper.getInitScriptPath(root) + " " + path, null);
config = new BBSession(shell, root, true);
config.initialize();
@@ -158,18 +144,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];
-
+ String fullPath = file.getAbsolutePath() + 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 +163,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 +180,7 @@ public class OEFile extends FileStore {
// }
}
//fall through to super implementation
-// super.copy(destFile, options, monitor);
+// super.copy(destFileStore, options, monitor);
}

@Override
@@ -207,13 +193,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 +235,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 +248,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 +298,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 +383,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 +452,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..ca5a960 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());
@@ -181,7 +241,7 @@ public class YoctoHostFile implements IHostFile{
}
public YoctoHostFile getChildHostFile(String name) {
try {
- return new YoctoHostFile(projectInfo, getChildURI(name), null);
+ return new YoctoHostFile(projectInfo, getChildURI(name), new NullProgressMonitor());
} catch (SystemMessageException e) {
e.printStackTrace();
return null;
@@ -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;
}
}

@@ -232,4 +294,12 @@ public class YoctoHostFile implements IHostFile{
e.printStackTrace();
}
}
+
+ public IFileService getFileService() {
+ return fileService;
+ }
+
+ public void setFileService(IFileService fileService) {
+ this.fileService = fileService;
+ }
}
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..a103d2b 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;
@@ -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);
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] Disable "Finish" when project location is invalid

Ioana Grigoropol <ioanax.grigoropol@...>
 

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

Signed-off-by: Ioana Grigoropol <ioanax.grigoropol@...>
---
.../yocto/bc/ui/wizards/install/OptionsPage.java | 10 +++++++---
1 file changed, 7 insertions(+), 3 deletions(-)

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 a103d2b..7a705aa 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
@@ -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);
--
1.7.9.5


[PATCH v2 2/5] 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] 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 +-
.../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(-)

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/BBSession.java b/plugins/org.yocto.bc.ui/src/org/yocto/bc/bitbake/BBSession.java
index 66a6083..037d8aa 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
@@ -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,10 +57,11 @@ 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 CONF_DIR = "/conf";
public static final String BUILDDIR_INDICATORS [] = {
- "/conf/local.conf",
- "/conf/bblayers.conf",
+ "/local.conf",
+ "/bblayers.conf",
};

protected final ProjectInfo pinfo;
@@ -74,7 +75,7 @@ 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();
@@ -87,7 +88,7 @@ public class BBSession implements IBBSessionListener, IModelElement, Map {
this(ssession, projectRoot);
this.silent = silent;
}
-
+
private Collection adapttoIPath(List<File> asList, IProject project) {

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

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

@@ -112,7 +113,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 +125,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 +144,7 @@ public class BBSession implements IBBSessionListener, IModelElement, Map {
}
}

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

+ @Override
public Set entrySet() {
try {
checkValidAndLock(true);
@@ -188,7 +193,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 +202,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 +215,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 +247,7 @@ public class BBSession implements IBBSessionListener, IModelElement, Map {
return recipes;
}

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

@@ -348,6 +356,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));
@@ -396,6 +405,7 @@ public class BBSession implements IBBSessionListener, IModelElement, Map {
//not release lock
}

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

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

protected void parse(String content, Map outMap) throws Exception {
if (content == null)
- return;
+ return;
BufferedReader reader = new BufferedReader(new StringReader(content));
String line;
boolean inLine = false;
@@ -484,7 +496,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,7 +519,7 @@ public class BBSession implements IBBSessionListener, IModelElement, Map {
protected URI getDefaultDepends() {
return null;
}
-
+
protected Map parseBBEnvironment(String bbOut) throws Exception {
Map env = new Hashtable();
this.depends = new ArrayList<URI>();
@@ -517,8 +529,8 @@ public class BBSession implements IBBSessionListener, IModelElement, Map {
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 +543,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 +623,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 +652,7 @@ public class BBSession implements IBBSessionListener, IModelElement, Map {
return line;
}

+ @Override
public int size() {
try {
checkValidAndLock(true);
@@ -686,7 +702,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 +726,7 @@ public class BBSession implements IBBSessionListener, IModelElement, Map {
return expression;
}

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

+ @Override
public void changeNotified(IResource[] added, IResource[] removed, IResource[] changed) {
wlock.lock();
try {
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..f12d6f3 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,10 +27,8 @@ 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;
@@ -52,18 +45,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 +62,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);
@@ -112,12 +83,26 @@ public class OEFile extends FileStore {
* detect if the path is potential builddir
*/
private boolean isPotentialBuildDir(String path) {
+ String parentPath = path.substring(0, path.lastIndexOf("/"));
boolean ret = true;
- for (int i=0; i < BBSession.BUILDDIR_INDICATORS.length && ret == true; i++) {
- if((new File(path + BBSession.BUILDDIR_INDICATORS[i])).exists() == false) {
- ret=false;
- break;
+ try {
+ IFileService fs = file.getFileService();
+ IHostFile hostFile = fs.getFile(parentPath, path, new NullProgressMonitor());
+ if (!hostFile.isDirectory())
+ return false;
+ IHostFile confDir = fs.getFile(path, path + BBSession.CONF_DIR, new NullProgressMonitor());
+ if (!confDir.exists() || !confDir.isDirectory())
+ return false;
+ for (int i = 0; i < BBSession.BUILDDIR_INDICATORS.length && ret == true; i++) {
+ IHostFile child = fs.getFile(path, path + BBSession.CONF_DIR + BBSession.BUILDDIR_INDICATORS[i], new NullProgressMonitor());
+ if(!child.exists() || !child.isFile()) {
+ ret = false;
+ break;
+ }
}
+
+ } catch (SystemMessageException e) {
+ e.printStackTrace();
}
return ret;
}
@@ -125,11 +110,12 @@ 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(), new NullProgressMonitor()),
ProjectInfoHelper.getInitScriptPath(root) + " " + path, null);
config = new BBSession(shell, root, true);
config.initialize();
@@ -158,18 +144,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];
-
+ String fullPath = file.getAbsolutePath() + 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 +163,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 +180,7 @@ public class OEFile extends FileStore {
// }
}
//fall through to super implementation
-// super.copy(destFile, options, monitor);
+// super.copy(destFileStore, options, monitor);
}

@Override
@@ -207,13 +193,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 +235,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 +248,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 +298,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 +383,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 +452,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..ca5a960 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());
@@ -181,7 +241,7 @@ public class YoctoHostFile implements IHostFile{
}
public YoctoHostFile getChildHostFile(String name) {
try {
- return new YoctoHostFile(projectInfo, getChildURI(name), null);
+ return new YoctoHostFile(projectInfo, getChildURI(name), new NullProgressMonitor());
} catch (SystemMessageException e) {
e.printStackTrace();
return null;
@@ -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;
}
}

@@ -232,4 +294,12 @@ public class YoctoHostFile implements IHostFile{
e.printStackTrace();
}
}
+
+ public IFileService getFileService() {
+ return fileService;
+ }
+
+ public void setFileService(IFileService fileService) {
+ this.fileService = fileService;
+ }
}
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..a103d2b 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;
@@ -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);
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 1/5] 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/5][eclipse-poky][branch:windows-build]Multiple fixes

Ioana Grigoropol <ioanax.grigoropol@...>
 

- applies onto commit 27bb1f9e45f0a9408453f9e7e70cc333b97afe

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(-)

--
1.7.9.5


librt within Yocto Recipe (beagle)

Thomas Besemer
 

I'm working with Beagleboard right now, stock top of tree from Yocto
pull. GCC 4.7.2 builds fine.

I am able to use tools built during this process to link with librt
(-lrt) (as librt is in), but can't figure out how to do it from within
a Yocto/OE recipe. I created a recipe to build my application, but it
complains that I don't have dependencies for librt (wants something).
My recipe:

DESCRIPTION = "GCPY Server application"
SECTION = "gcsim"
LICENSE = "MIT"
LIC_FILES_CHKSUM =
"file://${COMMON_LICENSE_DIR}/MIT;md5=0835ade698e0bcf8506ecda2f7b4f302"
PV = "1_0"

SRC_URI = "file://gcpy.tar"

S = "${WORKDIR}"

do_install() {
install -d ${D}${base_libdir}
install -m 0755 libgcpy_gc6016.so ${D}${base_libdir}
install -d ${D}${bindir}
install -m 0755 gcpy_gc6016_server ${D}${bindir}
}

There is a Makefile within tarball, and when I use the Yocto generated
tools outside of Yocto, builds fine. Thus, I know librt is present
(and I see it).

What do I need in recipe to make this work?


Build external module against Yocto kernel

Patrick Turley <PatrickTurley@...>
 

I have to build a module from a third-party that has nothing to do with Yocto.

I want to build this module against the kernel Yocto is giving me.

The Make file for this module has a build command like this:

make -C $(LINUX_DIR) M=`pwd` $(ENV) \
EXTRA_CFLAGS="$(EXTRA_CFLAGS)" modules

Obviously, this command needs to connect with either the Linux source tree or something like a "kernel-headers" package.

I used the meta-toolchain-sdk recipe to produce an SDK, and I installed it. Unfortunately, I don't see a "kernel-header" equivalent in there.

This leads me to imagine I must point this command at some sub-tree within the Yocto output (probably under tmp/sysroots). And, if I want that tree available elsewhere, I have to package it up into a tarball and transport it.

Usually, Yocto is way ahead of me on these sorts of things, and there's already a graceful way to deal with this -- I just haven't figure it out yet.

What am I missing?


YP Linux Kernel Development Manual

Rifenbark, Scott M <scott.m.rifenbark@...>
 

All,

There is a new YP manual under development. It is a development manual for Linux kernels in the YP. Darren Hart is the original author of the manual as you probably know. It is still being worked on but it is in HTML form and now part of the yocto-docs/master branch. It is published at http://www.yoctoproject.org/docs/1.4/kernel-dev/kernel-dev.html. Feel free to access it and comment.

Thanks,
Scott

Scott Rifenbark
Intel Corporation
Yocto Project Documentation
503.712.2702
503.341.0418 (cell)


Agenda: Yocto Project Technical Team Meeting - Tuesday, January 15, 2013 8:00 AM-9:00 AM (UTC-08:00) Pacific Time (US & Canada).

Liu, Song <song.liu@...>
 

Agenda:
 
* Opens collection - 5 min (Song)
* Yocto Project 1.2.2 status - 10 min (Scott/AlexG)
* Yocto Project 1.3.1 status - 10 min (Ross)
* Yocto 1.4 status - 10 min (Song/team)
https://wiki.yoctoproject.org/wiki/Yocto_Project_v1.4_Status#Overview
* SWAT team rotation: Radu Moisan -> Constantin Musca
* Opens - 10 min
* Team Sharing - 20 min


-----Original Appointment-----


We encourage people attending the meeting to logon the Yocto IRC chancel during the meeting (optional):

Yocto IRC: http://webchat.freenode.net/?channels=#yocto
IRC Tutorial: http://www.irchelp.org/irchelp/irctutorial.html

Conference details
Conference name:
Yocto Technical Team
Conference date/start time:
Tue Jun 26, 2012 at 10:00 AM Central Daylight Time
Participants:
30
Duration:
60 minutes
Participant passcode:
76994298
Dial-in number:
1.972.995.7777
US Toll Free number:
1.877.561.6828
BlackBerry users, click this link to join your conference as a participant:
1.972.995.7777x76994298#
 
Depending on where you are dialing from, either your BlackBerry will pause and enter the passcode automatically or you will be prompted to click again to dial the passcode.

Local and Global Access Numbers


Country
Dial-in number
Australia:
1800 636 843
Czech Republic:
242 430 350
China (Beijing):
From office dial 8-9957777 or 8784277
Beijing Out of Office dial 5878 4277
China (Shanghai):
From office dial 8-9957777 or 3073322
Shanghai Out of Office dial 2307 3322
China (Shenzen):
From office dial 8-9957777 or 6007877
Shenzen Out of Office dial 2600 7877
China (Other Cities):
From IP phone dial 8-9957777
Other cities - Non IP phone dial 021-23073322
Denmark:
8060 1400
Finland:
09 41333477
France:
0497 275888
Germany:
08161 803232
Holland:
030 2417490
India:
BSNL subscribers use 1800 425 9996 (Toll Free) Airtel subscribers use 0008 009 861 212 (Toll Free) From TI Campus use 89957777 Others use 2509 9555 (Landline within Bangalore) or
80 2509 9555 (Outside Bangalore)
Israel:
09 790 6715
Italy:
039 69061234 (039 is local city code not country code)
Japan:
From TI Campus use 8 995 7777
Outside TI use 03 4331 3777
Malaysia:
From IP phone dial 2643799
From Kuala Lumpur dial 4264 3799
Outside Kuala Lumpur dial (03)4264 3799
Norway:
2 295 8744
Philippines:
From Baguio City use 4471177
From Metro Manila area use 8702477
Singapore:
From IP phone dial 3894777
Outside TI use 6389 4777
South Korea:
From IP phone dial 5606998
From Seoul dial 5606998
Outside Seoul dial (02)5606998
Sweden:
08 58755577
Taiwan:
From IP phone dial 1363
From Taipei dial 2241 1363
Outside Taipei dial (02)2241 1363
Turkey:
Landline Only dial 0811 288 0001
then enter 877 633 1123
UK:
01604 663003
US:
972 995 7777 or 1877 561 6828

Recurring conferences
First scheduled conference:
Tue Jun 26, 2012
Recurrence frequency:
Weekly - Every 1 week(s) on Tuesday
Recurrence ends:
End on Fri Jun 21, 2013, 10:40 AM CDT


Agenda: Yocto Project Technical Team Meeting - Tuesday, January 15, 2013 8:00 AM-9:00 AM (UTC-08:00) Pacific Time (US & Canada).

Liu, Song <song.liu@...>
 

Agenda:
 
* Opens collection - 5 min (Song)
* Yocto Project 1.2.2 status - 10 min (Scott/AlexG)
* Yocto Project 1.3.1 status - 10 min (Ross)
* Yocto 1.4 status - 10 min (Song/team)
https://wiki.yoctoproject.org/wiki/Yocto_Project_v1.4_Status#Overview
* SWAT team rotation: Radu Moisan -> Constantin Musca
* Opens - 10 min
* Team Sharing - 20 min


-----Original Appointment-----


We encourage people attending the meeting to logon the Yocto IRC chancel during the meeting (optional):

Yocto IRC: http://webchat.freenode.net/?channels=#yocto
IRC Tutorial: http://www.irchelp.org/irchelp/irctutorial.html

Conference details
Conference name:
Yocto Technical Team
Conference date/start time:
Tue Jun 26, 2012 at 10:00 AM Central Daylight Time
Participants:
30
Duration:
60 minutes
Participant passcode:
76994298
Dial-in number:
1.972.995.7777
US Toll Free number:
1.877.561.6828
BlackBerry users, click this link to join your conference as a participant:
1.972.995.7777x76994298#
 
Depending on where you are dialing from, either your BlackBerry will pause and enter the passcode automatically or you will be prompted to click again to dial the passcode.

Local and Global Access Numbers


Country
Dial-in number
Australia:
1800 636 843
Czech Republic:
242 430 350
China (Beijing):
From office dial 8-9957777 or 8784277
Beijing Out of Office dial 5878 4277
China (Shanghai):
From office dial 8-9957777 or 3073322
Shanghai Out of Office dial 2307 3322
China (Shenzen):
From office dial 8-9957777 or 6007877
Shenzen Out of Office dial 2600 7877
China (Other Cities):
From IP phone dial 8-9957777
Other cities - Non IP phone dial 021-23073322
Denmark:
8060 1400
Finland:
09 41333477
France:
0497 275888
Germany:
08161 803232
Holland:
030 2417490
India:
BSNL subscribers use 1800 425 9996 (Toll Free)
Airtel subscribers use 0008 009 861 212 (Toll Free)
From TI Campus use 89957777
Others use 2509 9555 (Landline within Bangalore) or
80 2509 9555 (Outside Bangalore)
Israel:
09 790 6715
Italy:
039 69061234 (039 is local city code not country code)
Japan:
From TI Campus use 8 995 7777
Outside TI use 03 4331 3777
Malaysia:
From IP phone dial 2643799
From Kuala Lumpur dial 4264 3799
Outside Kuala Lumpur dial (03)4264 3799
Norway:
2 295 8744
Philippines:
From Baguio City use 4471177
From Metro Manila area use 8702477
Singapore:
From IP phone dial 3894777
Outside TI use 6389 4777
South Korea:
From IP phone dial 5606998
From Seoul dial 5606998
Outside Seoul dial (02)5606998
Sweden:
08 58755577
Taiwan:
From IP phone dial 1363
From Taipei dial 2241 1363
Outside Taipei dial (02)2241 1363
Turkey:
Landline Only dial 0811 288 0001
then enter 877 633 1123
UK:
01604 663003
US:
972 995 7777 or 1877 561 6828

Recurring conferences
First scheduled conference:
Tue Jun 26, 2012
Recurrence frequency:
Weekly - Every 1 week(s) on Tuesday
Recurrence ends:
End on Fri Jun 21, 2013, 10:40 AM CDT