Date   

[PATCH 7/8] convert CRLF line terminators to CR only

Ioana Grigoropol <ioanax.grigoropol@...>
 

---
.../org/yocto/bc/ui/wizards/FiniteStateWizard.java | 112 +++----
.../yocto/bc/ui/wizards/FiniteStateWizardPage.java | 320 ++++++++++----------
2 files changed, 216 insertions(+), 216 deletions(-)

diff --git a/plugins/org.yocto.bc.ui/src/org/yocto/bc/ui/wizards/FiniteStateWizard.java b/plugins/org.yocto.bc.ui/src/org/yocto/bc/ui/wizards/FiniteStateWizard.java
index 6cd87be..795f7bd 100644
--- a/plugins/org.yocto.bc.ui/src/org/yocto/bc/ui/wizards/FiniteStateWizard.java
+++ b/plugins/org.yocto.bc.ui/src/org/yocto/bc/ui/wizards/FiniteStateWizard.java
@@ -1,56 +1,56 @@
-package org.yocto.bc.ui.wizards;
-import java.util.Map;
-
-import org.eclipse.jface.wizard.Wizard;
-import org.eclipse.swt.widgets.Composite;
-
-
-
-public abstract class FiniteStateWizard extends Wizard{
- private boolean finishable = false;
- private boolean canFinish = false;
-
- public FiniteStateWizard() {
- }
-
- public abstract boolean performFinish();
-
- /**
- * @return Returns if the wizard is finishable in its current state.
- */
- public boolean isFinishable() {
- return finishable;
- }
- /**
- * @param finishable Change the finish state of the wizard.
- */
- public void setFinishable(boolean finishable) {
- this.finishable = finishable;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.jface.wizard.IWizard#createPageControls(org.eclipse.swt.widgets.Composite)
- */
- public void createPageControls(Composite pageContainer) {
- super.createPageControls(pageContainer);
- }
-
- /*
- * (non-Javadoc) Method declared on IWizard.
- */
- public boolean canFinish() {
- if (canFinish)
- return true;
- return super.canFinish();
- }
-
- public void setCanFinish(boolean canFinish) {
- this.canFinish = canFinish;
- }
-
- /**
- * Retrive the model object from the wizard.
- * @return
- */
- public abstract Map<?, ?> getModel();
-}
+package org.yocto.bc.ui.wizards;
+import java.util.Map;
+
+import org.eclipse.jface.wizard.Wizard;
+import org.eclipse.swt.widgets.Composite;
+
+
+
+public abstract class FiniteStateWizard extends Wizard{
+ private boolean finishable = false;
+ private boolean canFinish = false;
+
+ public FiniteStateWizard() {
+ }
+
+ public abstract boolean performFinish();
+
+ /**
+ * @return Returns if the wizard is finishable in its current state.
+ */
+ public boolean isFinishable() {
+ return finishable;
+ }
+ /**
+ * @param finishable Change the finish state of the wizard.
+ */
+ public void setFinishable(boolean finishable) {
+ this.finishable = finishable;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.jface.wizard.IWizard#createPageControls(org.eclipse.swt.widgets.Composite)
+ */
+ public void createPageControls(Composite pageContainer) {
+ super.createPageControls(pageContainer);
+ }
+
+ /*
+ * (non-Javadoc) Method declared on IWizard.
+ */
+ public boolean canFinish() {
+ if (canFinish)
+ return true;
+ return super.canFinish();
+ }
+
+ public void setCanFinish(boolean canFinish) {
+ this.canFinish = canFinish;
+ }
+
+ /**
+ * Retrive the model object from the wizard.
+ * @return
+ */
+ public abstract Map<?, ?> getModel();
+}
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 795a9c0..40696d3 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
@@ -1,160 +1,160 @@
-package org.yocto.bc.ui.wizards;
-import java.util.Map;
-
-import org.eclipse.jface.viewers.ISelectionChangedListener;
-import org.eclipse.jface.viewers.SelectionChangedEvent;
-import org.eclipse.jface.wizard.WizardPage;
-import org.eclipse.swt.events.FocusEvent;
-import org.eclipse.swt.events.FocusListener;
-import org.eclipse.swt.events.ModifyEvent;
-import org.eclipse.swt.events.ModifyListener;
-import org.eclipse.swt.events.SelectionEvent;
-import org.eclipse.swt.events.SelectionListener;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Event;
-import org.eclipse.swt.widgets.Listener;
-
-public abstract class FiniteStateWizardPage extends WizardPage {
- protected Map<String, Object> model = null;
- protected FiniteStateWizard wizard = null;
- private static boolean previousState = false;
- /**
- * @param pageName
- */
- protected FiniteStateWizardPage(String name, Map<String, Object> model) {
- super(name);
- this.model = model;
- this.setPageComplete(false);
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.jface.dialogs.IDialogPage#createControl(org.eclipse.swt.widgets.Composite)
- */
- 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();
-
- /**
- * This method should be implemented by ModelWizardPage classes. This method
- * is called after the <code>validatePage()</code> returns successfully.
- * Update the model with the contents of the controls on the page.
- */
- protected abstract void updateModel();
-
- /**
- * Helper method to see if a field has some sort of text in it.
- * @param value
- * @return
- */
- 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)
- */
- public void setVisible(boolean arg0) {
-
- if (!arg0 && previousState) {
- pageCleanup();
- } else if (arg0 && !previousState) {
- pageDisplay();
- } 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) {
-// validate();
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.swt.events.SelectionListener#widgetDefaultSelected(org.eclipse.swt.events.SelectionEvent)
- */
- public void widgetDefaultSelected(SelectionEvent e) {
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.swt.events.ModifyListener#modifyText(org.eclipse.swt.events.ModifyEvent)
- */
- public void modifyText(ModifyEvent e) {
- 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) {
-
- validate();
- }
-
- public void selectionChanged(SelectionChangedEvent event) {
- validate();
- }
-
- @Override
- public void focusGained(FocusEvent e) {
- }
-
- @Override
- public void focusLost(FocusEvent e) {
- validate();
- }
- }
-}
+package org.yocto.bc.ui.wizards;
+import java.util.Map;
+
+import org.eclipse.jface.viewers.ISelectionChangedListener;
+import org.eclipse.jface.viewers.SelectionChangedEvent;
+import org.eclipse.jface.wizard.WizardPage;
+import org.eclipse.swt.events.FocusEvent;
+import org.eclipse.swt.events.FocusListener;
+import org.eclipse.swt.events.ModifyEvent;
+import org.eclipse.swt.events.ModifyListener;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.events.SelectionListener;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Event;
+import org.eclipse.swt.widgets.Listener;
+
+public abstract class FiniteStateWizardPage extends WizardPage {
+ protected Map<String, Object> model = null;
+ protected FiniteStateWizard wizard = null;
+ private static boolean previousState = false;
+ /**
+ * @param pageName
+ */
+ protected FiniteStateWizardPage(String name, Map<String, Object> model) {
+ super(name);
+ this.model = model;
+ this.setPageComplete(false);
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.jface.dialogs.IDialogPage#createControl(org.eclipse.swt.widgets.Composite)
+ */
+ 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();
+
+ /**
+ * This method should be implemented by ModelWizardPage classes. This method
+ * is called after the <code>validatePage()</code> returns successfully.
+ * Update the model with the contents of the controls on the page.
+ */
+ protected abstract void updateModel();
+
+ /**
+ * Helper method to see if a field has some sort of text in it.
+ * @param value
+ * @return
+ */
+ 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)
+ */
+ public void setVisible(boolean arg0) {
+
+ if (!arg0 && previousState) {
+ pageCleanup();
+ } else if (arg0 && !previousState) {
+ pageDisplay();
+ } 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) {
+// validate();
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.swt.events.SelectionListener#widgetDefaultSelected(org.eclipse.swt.events.SelectionEvent)
+ */
+ public void widgetDefaultSelected(SelectionEvent e) {
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.swt.events.ModifyListener#modifyText(org.eclipse.swt.events.ModifyEvent)
+ */
+ public void modifyText(ModifyEvent e) {
+ 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) {
+
+ validate();
+ }
+
+ public void selectionChanged(SelectionChangedEvent event) {
+ validate();
+ }
+
+ @Override
+ public void focusGained(FocusEvent e) {
+ }
+
+ @Override
+ public void focusLost(FocusEvent e) {
+ validate();
+ }
+ }
+}
--
1.7.9.5


[PATCH 6/8] Fix synchronous waiting for command prompt in Linux & connection lost when restarting

Ioana Grigoropol <ioanax.grigoropol@...>
 

- when waiting for an command to finish running, we wait to receive a command prompt using the syntax user@host....endChar. This pattern is not always encountered on local or remote connection from linux to linux. Instead echo some terminator value after each command and wait for recieve the value.

- when working on a Linux machine and creating a project using the Local connection, after a restart, the RSE registry fails to find the project's connection using its URI because there is no host set. Manually set the current connection to Localhost

Signed-off-by: Ioana Grigoropol <ioanax.grigoropol@...>
---
.../src/org/yocto/bc/bitbake/BBSession.java | 2 +
.../src/org/yocto/bc/bitbake/ShellSession.java | 24 ++----
.../yocto/bc/remote/utils/ProcessStreamBuffer.java | 14 ++--
.../org/yocto/bc/remote/utils/RemoteHelper.java | 14 ++--
.../remote/utils/YoctoHostShellProcessAdapter.java | 28 +------
.../src/org/yocto/bc/ui/Activator.java | 79 ++++++--------------
.../src/org/yocto/bc/ui/model/ProjectInfo.java | 4 +
.../bc/ui/wizards/NewBitBakeFileRecipeWizard.java | 7 +-
.../ui/wizards/NewBitBakeFileRecipeWizardPage.java | 15 ++--
9 files changed, 60 insertions(+), 127 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 c5354a4..3aa4efe 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
@@ -439,6 +439,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));
String line;
boolean inLine = false;
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 f143bed..c127c25 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
@@ -81,24 +81,13 @@ public class ShellSession {
this.projectInfo = pInfo;
this.root = root;
this.initCmd = initCmd;
-// if (out == null) {
-// this.out = new NullWriter();
-// } else {
-// this.out = out;
-// }
-// if (shellType == SHELL_TYPE_SH) {
-// shellPath = "/bin/sh";
-// }
-// shellPath = "/bin/bash";
-
initializeShell(new NullProgressMonitor());
}

private void initializeShell(IProgressMonitor monitor) throws IOException {
try {
- IHost connection = RemoteHelper.getRemoteConnectionByName(projectInfo.getConnection().getName());
- RemoteHelper.runCommandRemote(connection, new YoctoCommand("source " + initCmd, root.getAbsolutePath(), ""));
- RemoteHelper.runCommandRemote(connection, new YoctoCommand(exportCmd, root.getAbsolutePath(), ""));
+ RemoteHelper.runCommandRemote(projectInfo.getConnection(), new YoctoCommand("source " + initCmd, root.getAbsolutePath(), ""));
+ RemoteHelper.runCommandRemote(projectInfo.getConnection(), new YoctoCommand(exportCmd, root.getAbsolutePath(), ""));
} catch (Exception e) {
e.printStackTrace();
}
@@ -113,9 +102,12 @@ public class ShellSession {
public String execute(String command, boolean hasErrors) throws IOException {

try {
- IHost connection = RemoteHelper.getRemoteConnectionByName(projectInfo.getConnection().getName());
- hasErrors = RemoteHelper.runCommandRemote(connection, new YoctoCommand(command, root.getAbsolutePath() + "/build/", ""));
- return RemoteHelper.getProcessBuffer(connection).getMergedOutputLines();
+ 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();
+ }
+ return null;
} catch (Exception e) {
e.printStackTrace();
}
diff --git a/plugins/org.yocto.bc.ui/src/org/yocto/bc/remote/utils/ProcessStreamBuffer.java b/plugins/org.yocto.bc.ui/src/org/yocto/bc/remote/utils/ProcessStreamBuffer.java
index 438a5b4..2c6d122 100644
--- a/plugins/org.yocto.bc.ui/src/org/yocto/bc/remote/utils/ProcessStreamBuffer.java
+++ b/plugins/org.yocto.bc.ui/src/org/yocto/bc/remote/utils/ProcessStreamBuffer.java
@@ -2,6 +2,7 @@ package org.yocto.bc.remote.utils;

import java.util.ArrayList;
import java.util.List;
+import java.util.regex.Pattern;

public class ProcessStreamBuffer {
private static final String WHITESPACES = "\\s+";
@@ -54,17 +55,16 @@ public class ProcessStreamBuffer {
return null;
}

- public String getOutputLineContaining(String str) {
- int index = 0;
+ public String getOutputLineContaining(String arg, String pattern) {
for (int i = outputLines.size() - 1; i >= 0; i--){
String line = outputLines.get(i);
- if (line.contains(str)) {
- index = i + 1;
- break;
+ if (line.contains(arg)) {
+ String[] tokens = line.split("\\s+");
+ if (Pattern.matches(pattern, tokens[0])) {
+ return tokens[0];
+ }
}
}
- if (index >= 0 && index < outputLines.size())
- return outputLines.get(index);
return null;
}
}
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 f375de1..c230fd6 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
@@ -45,6 +45,7 @@ import org.yocto.bc.ui.Activator;
import org.yocto.bc.ui.wizards.install.Messages;

public class RemoteHelper {
+ public static final String TERMINATOR = "234o987dsfkcqiuwey18837032843259d";
public static final int TOTALWORKLOAD = 100;
private static Map<IHost, RemoteMachine> machines;

@@ -95,9 +96,11 @@ public class RemoteHelper {
return null;

String host = uri.getHost();
- if (host == null)
- return null;
-
+ if (host == null) {
+ // this is a local connection
+ ISystemRegistry sr = RSECorePlugin.getTheSystemRegistry();
+ return sr.getLocalHost();
+ }
ISystemRegistry sr = RSECorePlugin.getTheSystemRegistry();
IHost[] connections = sr.getHosts();

@@ -259,8 +262,9 @@ public class RemoteHelper {
public void run() {
try {
YoctoHostShellProcessAdapter adapter = getHostShellProcessAdapter(connection);
- adapter.setLastCommand(remoteCommand);
- getHostShell(connection).writeToShell(remoteCommand);
+ String fullRemoteCommand = remoteCommand + "; echo " + TERMINATOR + ";";
+ adapter.setLastCommand(fullRemoteCommand);
+ getHostShell(connection).writeToShell(fullRemoteCommand);
while (!adapter.isFinished())
Thread.sleep(2);
// return hostShellProcessAdapter.hasErrors();
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 2dba0a6..bb137b1 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
@@ -17,10 +17,6 @@ import org.eclipse.rse.services.shells.IHostShellOutputReader;
import org.eclipse.swt.widgets.Display;

public class YoctoHostShellProcessAdapter extends HostShellProcessAdapter {
- private String commandPrompt = null;
- private static final String ROOT = "root";
- private static final String PROMPT_USER_CH = "$";
- private static final String PROMPT_ROOT_CH = "#";
private ProcessStreamBuffer processStreamBuffer;
private CommandResponseHandler commandResponseHandler;
private boolean isFinished;
@@ -30,7 +26,6 @@ public class YoctoHostShellProcessAdapter extends HostShellProcessAdapter {

private String command;
private Map<String, IProgressMonitor> commandMonitors;
- private String endChar = null;

private Semaphore sem;

@@ -57,9 +52,7 @@ public class YoctoHostShellProcessAdapter extends HostShellProcessAdapter {
isFinished = false;
sem.acquire();
this.command = lastCommand.trim();
- System.out.println("last command " + lastCommand + getOwnMonitor());
this.commandMonitors.put(command, getOwnMonitor());
-
} catch (InterruptedException e) {
e.printStackTrace();
}
@@ -145,7 +138,6 @@ public class YoctoHostShellProcessAdapter extends HostShellProcessAdapter {
if (value.isEmpty()) {
continue;
}
- setCommandPrompt(value);
System.out.println(value);
this.processStreamBuffer.addErrorLine(value);
this.commandResponseHandler.response(value, false);
@@ -156,11 +148,7 @@ public class YoctoHostShellProcessAdapter extends HostShellProcessAdapter {
if (value.isEmpty()) {
continue;
}
- setCommandPrompt(value);
-
- if (commandPrompt != null && endChar != null && command != null && processStreamBuffer != null &&
- value.startsWith(commandPrompt) && value.endsWith(endChar) &&
- !value.endsWith(command) && processStreamBuffer.getLastOutputLineContaining(command) != null /*&& waitForOutput*/) {
+ if (value.endsWith(RemoteHelper.TERMINATOR)) {
sem.release();
isFinished = true;
}
@@ -173,20 +161,6 @@ public class YoctoHostShellProcessAdapter extends HostShellProcessAdapter {
}

}
- private void setCommandPrompt(String value) {
- if (commandPrompt == null) {
- if (value.startsWith(ROOT) && value.indexOf(PROMPT_ROOT_CH) != -1) {
- int end = value.indexOf(PROMPT_ROOT_CH);
- commandPrompt = value.substring(0, end);
- endChar = PROMPT_ROOT_CH;
- } else if (value.indexOf(PROMPT_USER_CH) != -1) {
- int end = value.indexOf(PROMPT_USER_CH);
- commandPrompt = value.substring(0, end);
- endChar = PROMPT_USER_CH;
- }
-
- }
- }
public boolean isFinished() {
return isFinished;
}
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 64ca6a7..48c59d5 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
@@ -24,10 +24,8 @@ import org.eclipse.core.resources.IResourceChangeListener;
import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.NullProgressMonitor;
import org.eclipse.jface.resource.ImageDescriptor;
import org.eclipse.jface.resource.ImageRegistry;
-import org.eclipse.rse.core.model.IHost;
import org.eclipse.rse.services.files.IHostFile;
import org.eclipse.ui.plugin.AbstractUIPlugin;
import org.osgi.framework.BundleContext;
@@ -68,7 +66,7 @@ public class Activator extends AbstractUIPlugin {

return recipe;
}
-
+
/**
* Get or create a BitBake session passing in ProjectInfo
* @param pinfo
@@ -80,40 +78,36 @@ public class Activator extends AbstractUIPlugin {
if (bbSessionMap == null) {
bbSessionMap = new Hashtable<URI, BBSession>();
}
-
- BBSession bbs = (BBSession) bbSessionMap.get(projectRoot);
-
+
+ BBSession bbs = bbSessionMap.get(projectRoot);
+
if (bbs == null) {
bbs = new BBSession(getShellSession(projectInfo, out, monitor), projectRoot);
bbSessionMap.put(projectRoot, bbs);
}
-
+
return bbs;
}
-
+
/**
* Get or create a BitBake session passing in ProjectInfo
* @param pinfo
* @return
- * @throws Exception
+ * @throws Exception
*/
public static BBSession getBBSession(ProjectInfo projectInfo, IProgressMonitor monitor) throws Exception {
URI projectRoot = projectInfo.getURI();
if (bbSessionMap == null) {
bbSessionMap = new Hashtable<URI, BBSession>();
}
-
- BBSession bbs = (BBSession) bbSessionMap.get(projectRoot);
-
+
+ BBSession bbs = bbSessionMap.get(projectRoot);
+
if (bbs == null) {
bbs = new BBSession(getShellSession(projectInfo, null, monitor), projectRoot);
bbSessionMap.put(projectRoot, bbs);
- } else {
- if (projectInfo.getConnection() == null) {
- throw new Exception("The remote connection is null!");
- }
}
-
+
return bbs;
}

@@ -141,9 +135,7 @@ public class Activator extends AbstractUIPlugin {
if (projInfoMap == null) {
projInfoMap = new Hashtable<URI, ProjectInfo>();
}
-
- ProjectInfo pi = (ProjectInfo) projInfoMap.get(location);
-
+ ProjectInfo pi = projInfoMap.get(location);
if (pi == null) {
pi = new ProjectInfo();
pi.setLocation(location);
@@ -152,13 +144,10 @@ public class Activator extends AbstractUIPlugin {
} catch (IOException e) {
throw new InvocationTargetException(e);
}
- if (pi.getConnection() == null) {
- IHost connection = RemoteHelper.getRemoteConnectionForURI(location, new NullProgressMonitor());
- pi.setConnection(connection);
- }
+
projInfoMap.put(location, pi);
}
-
+
return pi;
}

@@ -175,7 +164,7 @@ public class Activator extends AbstractUIPlugin {
if(bbSessionMap != null) {
iter= bbSessionMap.values().iterator();
while(iter.hasNext()) {
- BBSession p = (BBSession)iter.next();
+ BBSession p = iter.next();
p.changeNotified(added, removed, changed);
}
}
@@ -184,56 +173,31 @@ public class Activator extends AbstractUIPlugin {
/**
* @param absolutePath
* @return a cached shell session for a given project root.
- * @throws IOException
+ * @throws IOException
*/
private static ShellSession getShellSession(ProjectInfo projInfo, Writer out, IProgressMonitor monitor) throws IOException {
URI absolutePath = projInfo.getURI();
if (shellMap == null) {
shellMap = new Hashtable<String, ShellSession>();
}
-
- ShellSession ss = (ShellSession) shellMap.get(absolutePath);
-
+
+ ShellSession ss = shellMap.get(absolutePath);
+
if (ss == null) {
-// if (conn == null)
-// RemoteHelper.getRemoteConnectionByName();
IHostFile remoteHostFile = RemoteHelper.getRemoteHostFile(projInfo.getConnection(), absolutePath.getPath(), monitor);
ss = new ShellSession(projInfo, ShellSession.SHELL_TYPE_BASH, remoteHostFile, ProjectInfoHelper.getInitScriptPath(absolutePath), out);
}
-
+
return ss;
}

-// private static String loadInit(String absolutePath) throws CoreException {
-// IProject [] prjs = ResourcesPlugin.getWorkspace().getRoot().getProjects();
-// IProject foundPrj = null;
-//
-// for (int i = 0; i < prjs.length; ++i) {
-// IProject p = prjs[i];
-//
-// System.out
-// .println(p.getDescription().getLocationURI().getPath());
-//
-// if (p.getDescription().getLocationURI().getPath().equals(absolutePath)) {
-// foundPrj = p;
-// break;
-// }
-// }
-//
-// if (foundPrj == null) {
-// throw new RuntimeException("Unable to find project associated with path! " + absolutePath);
-// }
-//
-// return foundPrj.getPersistentProperty(CreateBBCProjectOperation.BBC_PROJECT_INIT);
-// }
-
public static void putProjInfo(URI location, ProjectInfo pinfo) {
if (projInfoMap == null) {
projInfoMap = new Hashtable<URI, ProjectInfo>();
}
projInfoMap.put(location, pinfo);
}
-
+
/**
* The constructor
*/
@@ -273,6 +237,7 @@ public class Activator extends AbstractUIPlugin {
bbSessionMap.remove(path);
}

+ @Override
protected void initializeImageRegistry(ImageRegistry reg) {
reg.put(IMAGE_VARIABLE, Activator.getImageDescriptor("icons/variable.gif"));
reg.put(IMAGE_FUNCTION, Activator.getImageDescriptor("icons/function.gif"));
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 5fc4ba2..4530bb3 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
@@ -13,6 +13,7 @@ package org.yocto.bc.ui.model;
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;
@@ -58,6 +59,9 @@ public class ProjectInfo implements IModelElement {
}

public IHost getConnection() {
+ if (connection == null) {
+ connection = RemoteHelper.getRemoteConnectionForURI(location, new NullProgressMonitor());
+ }
return connection;
}

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 57cad18..8457996 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
@@ -118,10 +118,7 @@ public class NewBitBakeFileRecipeWizard extends Wizard implements INewWizard {
IProject p = ((IResource)element).getProject();
try {
ProjectInfo projInfo = Activator.getProjInfo(p.getLocationURI());
- if (projInfo.getConnection() == null)
- this.connection = RemoteHelper.getRemoteConnectionForURI(p.getLocationURI(), new NullProgressMonitor());
- else
- this.connection = projInfo.getConnection();
+ this.connection = projInfo.getConnection();
} catch (CoreException e) {
e.printStackTrace();
} catch (InvocationTargetException e) {
@@ -205,7 +202,7 @@ public class NewBitBakeFileRecipeWizard extends Wizard implements INewWizard {
public void run(IProgressMonitor monitor) throws InvocationTargetException {
try {
doFinish(element, monitor);
- RemoteHelper.runCommandRemote(connection, new YoctoCommand("rm -rf temp", element.getMetaDir() + "/temp", ""));
+ RemoteHelper.runCommandRemote(connection, new YoctoCommand("rm -rf " + element.getMetaDir() + "/temp", "", ""));
} catch (Exception e) {
throw new InvocationTargetException(e);
} finally {
diff --git a/plugins/org.yocto.bc.ui/src/org/yocto/bc/ui/wizards/NewBitBakeFileRecipeWizardPage.java b/plugins/org.yocto.bc.ui/src/org/yocto/bc/ui/wizards/NewBitBakeFileRecipeWizardPage.java
index e9dc1f3..a52c2fe 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
@@ -397,22 +397,17 @@ public class NewBitBakeFileRecipeWizardPage extends WizardPage {
updateSrcUri(mirrorTable, srcURI);
populateInheritance(extractDir, monitor);

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

- private String retrieveSum(YoctoCommand cmd) {
+ private String retrieveSum(String arg, String pattern) {
ProcessStreamBuffer buffer = RemoteHelper.getProcessBuffer(this.connection);
- String line = buffer.getOutputLineContaining(cmd.getCommand());
- if (line != null) {
- String[] tokens = line.split(WHITESPACES);
- return tokens[0];
- }
- return "";
+ return buffer.getOutputLineContaining(arg, pattern);
}

private URI extractPackage(URI srcURI) {
--
1.7.9.5


[PATCH 5/8] Remove validation for existing git repository

Ioana Grigoropol <ioanax.grigoropol@...>
 

Signed-off-by: Ioana Grigoropol <ioanax.grigoropol@...>
---
.../yocto/bc/ui/wizards/install/OptionsPage.java | 10 +++++-----
1 file changed, 5 insertions(+), 5 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 37c12f8..9e94aea 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
@@ -170,11 +170,11 @@ public class OptionsPage extends FiniteStateWizardPage {
setErrorMessage("Directory " + projectPath + " does not exist, please select git clone.");
return false;
}
- IHostFile gitDescr = RemoteHelper.getRemoteHostFile(connection, projectPath + "/.git", new NullProgressMonitor());
- if (gitDescr == null || !gitDescr.exists()) {
- setErrorMessage("Directory " + projectPath + " does not contain a git repository, please select git clone.");
- return false;
- }
+// IHostFile gitDescr = RemoteHelper.getRemoteHostFile(connection, projectPath + "/.git", new NullProgressMonitor());
+// if (gitDescr == null || !gitDescr.exists()) {
+// setErrorMessage("Directory " + projectPath + " does not contain a git repository, please select git clone.");
+// return false;
+// }

IHostFile validationFile = RemoteHelper.getRemoteHostFile(connection, projectPath + URI_SEPARATOR + InstallWizard.VALIDATION_FILE, new NullProgressMonitor());
if (validationFile == null || !validationFile.exists()) {
--
1.7.9.5


[PATCH 4/8] Fix incompatibility with jre1.6 support for typed HashMap

Ioana Grigoropol <ioanax.grigoropol@...>
 

Signed-off-by: Ioana Grigoropol <ioanax.grigoropol@...>
---
.../remote/utils/YoctoHostShellProcessAdapter.java | 18 ++++++++++++------
1 file changed, 12 insertions(+), 6 deletions(-)

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 9ab43cf..2dba0a6 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
@@ -34,6 +34,7 @@ public class YoctoHostShellProcessAdapter extends HostShellProcessAdapter {

private Semaphore sem;

+
public YoctoHostShellProcessAdapter(IHostShell hostShell, ProcessStreamBuffer processStreamBuffer, CommandResponseHandler commandResponseHandler) throws IOException {
super(hostShell);
this.processStreamBuffer = processStreamBuffer;
@@ -41,7 +42,7 @@ public class YoctoHostShellProcessAdapter extends HostShellProcessAdapter {
this.calculator = new GitCalculatePercentage();
this.sem = new Semaphore(1);
this.command = "";
- this.commandMonitors = new HashMap<>();
+ this.commandMonitors = new HashMap<String, IProgressMonitor>();
}

public String getLastCommand() {
@@ -50,7 +51,7 @@ public class YoctoHostShellProcessAdapter extends HostShellProcessAdapter {

public synchronized void setLastCommand(String lastCommand) {
try {
- // there are still some processes that might take a long time and if we do not wait for them,
+ // there are still some processes that might take a long time and if we do not wait for them,
// then the semaphore will not be released, because an interrupted exception will occur
Thread.sleep(2000);
isFinished = false;
@@ -70,6 +71,7 @@ public class YoctoHostShellProcessAdapter extends HostShellProcessAdapter {

private class GitCalculatePercentage implements ICalculatePercentage {
final Pattern pattern = Pattern.compile("^Receiving objects:\\s*(\\d+)%.*");
+ @Override
public float calWorkloadDone(String info) throws IllegalArgumentException {
Matcher m = pattern.matcher(info.trim());
if(m.matches()) {
@@ -88,13 +90,16 @@ public class YoctoHostShellProcessAdapter extends HostShellProcessAdapter {
}

private void updateMonitor(final int work){
+
Display.getDefault().asyncExec(new Runnable() {
+
@Override
public void run() {
if (getMonitor() != null) {
getMonitor().worked(work);
}
}
+
});
}

@@ -124,7 +129,7 @@ public class YoctoHostShellProcessAdapter extends HostShellProcessAdapter {
updateMonitor(delta);
reportedWorkload += delta;
}
-
+
if (reportedWorkload == RemoteHelper.TOTALWORKLOAD)
doneMonitor();
}
@@ -152,8 +157,9 @@ public class YoctoHostShellProcessAdapter extends HostShellProcessAdapter {
continue;
}
setCommandPrompt(value);
+
if (commandPrompt != null && endChar != null && command != null && processStreamBuffer != null &&
- value.startsWith(commandPrompt) && value.endsWith(endChar) &&
+ value.startsWith(commandPrompt) && value.endsWith(endChar) &&
!value.endsWith(command) && processStreamBuffer.getLastOutputLineContaining(command) != null /*&& waitForOutput*/) {
sem.release();
isFinished = true;
@@ -165,7 +171,7 @@ public class YoctoHostShellProcessAdapter extends HostShellProcessAdapter {
this.commandResponseHandler.response(value, false);
}
}
-
+
}
private void setCommandPrompt(String value) {
if (commandPrompt == null) {
@@ -178,7 +184,7 @@ public class YoctoHostShellProcessAdapter extends HostShellProcessAdapter {
commandPrompt = value.substring(0, end);
endChar = PROMPT_USER_CH;
}
-
+
}
}
public boolean isFinished() {
--
1.7.9.5


[PATCH 3/8] Validate project name and location for Bitbake command project

Ioana Grigoropol <ioanax.grigoropol@...>
 

- if the project location is empty default value will be used (e.g. /home/user/)
- project name must not contain whitespaces and/or invalid characters
- if we choose to clone a new repo but the destination directory already contains a .git directory, do not allow moving forward
- if we choose to validate an existing repository, make sure that the directory exists, and contains a .git directory as well as a oe-init-build-env script

Signed-off-by: Ioana Grigoropol <ioanax.grigoropol@...>
---
.../src/org/yocto/bc/bitbake/ShellSession.java | 94 +++--------
.../org/yocto/bc/remote/utils/RemoteHelper.java | 69 ++++----
.../remote/utils/YoctoHostShellProcessAdapter.java | 15 +-
.../yocto/bc/ui/wizards/install/OptionsPage.java | 178 ++++++++++----------
.../BBConfigurationInitializeOperation.java | 6 +-
.../newproject/CreateBBCProjectOperation.java | 24 ++-
6 files changed, 173 insertions(+), 213 deletions(-)

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 961472f..f143bed 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
@@ -48,23 +48,23 @@ public class ShellSession {
public static final String LT = System.getProperty("line.separator");
public static final String exportCmd = "export BB_ENV_EXTRAWHITE=\"DISABLE_SANITY_CHECKS $BB_ENV_EXTRAWHITE\"";
public static final String exportColumnsCmd = "export COLUMNS=1000";
-
+
public static String getFilePath(String file) throws IOException {
File f = new File(file);
-
+
if (!f.exists() || f.isDirectory()) {
throw new IOException("Path passed is not a file: " + file);
}
-
+
StringBuffer sb = new StringBuffer();
-
+
String elems[] = file.split("//");
-
+
for (int i = 0; i < elems.length - 1; ++i) {
sb.append(elems[i]);
sb.append("//");
}
-
+
return sb.toString();
}
private Process process;
@@ -90,7 +90,7 @@ public class ShellSession {
// shellPath = "/bin/sh";
// }
// shellPath = "/bin/bash";
-
+
initializeShell(new NullProgressMonitor());
}

@@ -104,13 +104,14 @@ public class ShellSession {
}
}

- synchronized
+ synchronized
public String execute(String command) throws IOException {
return execute(command, false);
}

- synchronized
+ synchronized
public String execute(String command, boolean hasErrors) throws IOException {
+
try {
IHost connection = RemoteHelper.getRemoteConnectionByName(projectInfo.getConnection().getName());
hasErrors = RemoteHelper.runCommandRemote(connection, new YoctoCommand(command, root.getAbsolutePath() + "/build/", ""));
@@ -119,57 +120,15 @@ public class ShellSession {
e.printStackTrace();
}
return null;
-// sendToProcessAndTerminate(command);
-//
-// if (process.getErrorStream().available() > 0) {
-// byte[] msg = new byte[process.getErrorStream().available()];
-//
-// process.getErrorStream().read(msg, 0, msg.length);
-// out.write(new String(msg));
-// out.write(LT);
-// errorMessage = "Error while executing: " + command + LT + new String(msg);
-// }
-//
-// BufferedReader br = new BufferedReader(new InputStreamReader(process
-// .getInputStream()));
-//
-// StringBuffer sb = new StringBuffer();
-// String line = null;
-
-// while (((line = br.readLine()) != null) && !line.endsWith(TERMINATOR) && !interrupt) {
-// sb.append(line);
-// sb.append(LT);
-// out.write(line);
-// out.write(LT);
-// }
-//
-// if (interrupt) {
-// process.destroy();
-// initializeShell(null);
-// interrupt = false;
-// }
-// else if (line != null && retCode != null) {
-// try {
-// retCode[0]=Integer.parseInt(line.substring(0,line.lastIndexOf(TERMINATOR)));
-// }catch (NumberFormatException e) {
-// throw new IOException("Can NOT get return code" + command + LT + line);
-// }
-// }
-//
-// if (errorMessage != null) {
-// throw new IOException(errorMessage);
-// }
-//
-// return sb.toString();
}

-synchronized
+synchronized
public void execute(String command, ICommandResponseHandler handler) throws IOException {
System.out.println(command);
execute(command, TERMINATOR, handler);
}
-
- synchronized
+
+ synchronized
public void execute(String command, String terminator, ICommandResponseHandler handler) throws IOException {
interrupt = false;
InputStream errIs = process.getErrorStream();
@@ -177,40 +136,40 @@ synchronized
clearErrorStream(errIs);
}
sendToProcessAndTerminate(command);
-
+
BufferedReader br = new BufferedReader(new InputStreamReader(process.getInputStream()));
String std = null;

- do {
+ do {
if (errIs.available() > 0) {
byte[] msg = new byte[errIs.available()];

errIs.read(msg, 0, msg.length);
// out.write(new String(msg));
handler.response(new String(msg), true);
- }
-
+ }
+
std = br.readLine();
-
+
if (std != null && !std.endsWith(terminator)) {
// out.write(std);
handler.response(std, false);
- }
-
+ }
+
} while (std != null && !std.endsWith(terminator) && !interrupt);
-
+
if (interrupt) {
process.destroy();
initializeShell(null);
interrupt = false;
}
}
-
+
private void clearErrorStream(InputStream is) {
-
+
try {
byte b[] = new byte[is.available()];
- is.read(b);
+ is.read(b);
System.out.println("clearing: " + new String(b));
} catch (IOException e) {
e.printStackTrace();
@@ -221,7 +180,7 @@ synchronized
/**
* Send command string to shell process and add special terminator string so
* reader knows when output is complete.
- *
+ *
* @param command
* @throws IOException
*/
@@ -241,6 +200,5 @@ synchronized
public void interrupt() {
interrupt = true;
}
-
-}

+}
\ No newline at end of file
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 929ad63..f375de1 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
@@ -47,13 +47,13 @@ import org.yocto.bc.ui.wizards.install.Messages;
public class RemoteHelper {
public static final int TOTALWORKLOAD = 100;
private static Map<IHost, RemoteMachine> machines;
-
+
public static RemoteMachine getRemoteMachine(IHost connection){
if (!getMachines().containsKey(connection))
getMachines().put(connection, new RemoteMachine(connection));
return getMachines().get(connection);
}
-
+
private static Map<IHost, RemoteMachine> getMachines() {
if (machines == null)
machines = new HashMap<IHost, RemoteMachine>();
@@ -71,7 +71,7 @@ public class RemoteHelper {
public static YoctoHostShellProcessAdapter getHostShellProcessAdapter(IHost connection) {
return getRemoteMachine(connection).getHostShellProcessAdapter();
}
-
+
public static ProcessStreamBuffer getProcessBuffer(IHost connection) {
return getRemoteMachine(connection).getProcessBuffer();
}
@@ -87,20 +87,20 @@ public class RemoteHelper {
for (int i = 0; i < connections.length; i++)
if (connections[i].getAliasName().equals(remoteConnection))
return connections[i];
- return null;
+ return null;
}
-
+
public static IHost getRemoteConnectionForURI(URI uri, IProgressMonitor monitor) {
if (uri == null)
return null;
-
+
String host = uri.getHost();
- if (host == null)
+ if (host == null)
return null;
-
+
ISystemRegistry sr = RSECorePlugin.getTheSystemRegistry();
IHost[] connections = sr.getHosts();
-
+
IHost unconnected = null;
for (IHost conn : connections) {
if (host.equalsIgnoreCase(conn.getHostName())) {
@@ -110,26 +110,26 @@ public class RemoteHelper {
unconnected = conn;
}
}
-
+
return unconnected;
}
-
+
public static IRemoteFileSubSystem getRemoteFileSubSystem(IHost host) {
IRemoteFileSubSystem candidate = null;
IRemoteFileSubSystem otherServiceCandidate = null;
IRemoteFileSubSystem[] subSystems = RemoteFileUtility.getFileSubSystems(host);
-
+
for (IRemoteFileSubSystem subSystem : subSystems) {
if (subSystem instanceof FileServiceSubSystem) {
if (subSystem.isConnected())
return subSystem;
-
+
if (otherServiceCandidate == null)
otherServiceCandidate = subSystem;
-
+
} else if (candidate == null || (subSystem.isConnected() && !candidate.isConnected()))
candidate = subSystem;
-
+
}
if (candidate != null && candidate.isConnected())
return candidate;
@@ -137,7 +137,7 @@ public class RemoteHelper {
return otherServiceCandidate;
return null;
}
-
+
public static String getRemoteHostName(String remoteConnection){
final IHost host = getRemoteConnectionByName(remoteConnection);
if(host == null)
@@ -149,9 +149,9 @@ public class RemoteHelper {
public static IFileService getConnectedRemoteFileService(IHost connection, IProgressMonitor monitor) throws Exception {
return getRemoteMachine(connection).getRemoteFileService(monitor);
}
-
+
public static IHostFile[] getRemoteDirContent(IHost connection, String remoteParent, String fileFilter, int fileType, IProgressMonitor monitor){
-
+
try {
IFileService fileServ = getConnectedRemoteFileService(connection, monitor);
return fileServ.list(remoteParent, fileFilter, fileType, monitor);
@@ -182,11 +182,11 @@ public class RemoteHelper {

return ((IFileServiceSubSystem) subsystem).getFileService();
}
-
+
public static ISubSystem getFileSubsystem(IHost connection) {
return getRemoteMachine(connection).getFileSubsystem();
}
-
+
public static IService getConnectedShellService(IHost connection, IProgressMonitor monitor) throws Exception {
return getRemoteMachine(connection).getShellService(monitor);
}
@@ -201,21 +201,21 @@ public class RemoteHelper {
}
return null;
}
-
+
public static void getRemoteFile(IHost connection, String localExePath, String remoteExePath,
IProgressMonitor monitor) throws Exception {
-
+
assert(connection!=null);
monitor.beginTask(Messages.InfoDownload, 100);
-
+
IFileService fileService;
try {
- fileService = (IFileService) getConnectedRemoteFileService(connection, new SubProgressMonitor(monitor, 10));
+ fileService = getConnectedRemoteFileService(connection, new SubProgressMonitor(monitor, 10));
File file = new File(localExePath);
file.deleteOnExit();
monitor.worked(5);
Path remotePath = new Path(remoteExePath);
- fileService.download(remotePath.removeLastSegments(1).toString(),
+ fileService.download(remotePath.removeLastSegments(1).toString(),
remotePath.lastSegment(),file,true, null,
new SubProgressMonitor(monitor, 85));
} finally {
@@ -223,13 +223,13 @@ public class RemoteHelper {
}
return;
}
-
+
public static IHostFile getRemoteHostFile(IHost connection, String remoteFilePath, IProgressMonitor monitor){
assert(connection != null);
monitor.beginTask(Messages.InfoDownload, 100);
-
+
try {
- IFileService fileService = (IFileService) getConnectedRemoteFileService(connection, new SubProgressMonitor(monitor, 10));
+ IFileService fileService = getConnectedRemoteFileService(connection, new SubProgressMonitor(monitor, 10));
Path remotePath = new Path(remoteFilePath);
IHostFile remoteFile = fileService.getFile(remotePath.removeLastSegments(1).toString(), remotePath.lastSegment(), new SubProgressMonitor(monitor, 5));
return remoteFile;
@@ -239,20 +239,20 @@ public class RemoteHelper {
}
return null;
}
-
+
public static boolean runCommandRemote(final IHost connection, final YoctoCommand cmd) throws Exception {
final String remoteCommand = cmd.getCommand() + " " + cmd.getArguments();
final boolean hasErrors = false;
-
+
if (!cmd.getInitialDirectory().isEmpty()) {
writeToShell(connection, "cd " + cmd.getInitialDirectory());
}
if (!hasErrors)
writeToShell(connection, remoteCommand);
-
+
return hasErrors;
}
-
+
public static boolean writeToShell(final IHost connection, final String remoteCommand){
new Thread(new Runnable() {
@Override
@@ -282,7 +282,7 @@ public class RemoteHelper {
}
writeToShell(connection, remoteCommand);
}
-
+
} catch (Exception e1) {
e1.printStackTrace();
}
@@ -291,7 +291,7 @@ public class RemoteHelper {
/**
* Throws a core exception with an error status object built from the given
* message, lower level exception, and error code.
- *
+ *
* @param message
* the status message
* @param exception
@@ -329,6 +329,7 @@ public class RemoteHelper {
String parentPath = path.substring(0, nameStart);
String name = path.substring(nameStart + 1);
IHostFile hostFile = fs.getFile(parentPath, name, monitor);
+
return hostFile.exists();
} catch (Exception e) {
e.printStackTrace();
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 baedc3b..9ab43cf 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
@@ -33,7 +33,7 @@ public class YoctoHostShellProcessAdapter extends HostShellProcessAdapter {
private String endChar = null;

private Semaphore sem;
-
+
public YoctoHostShellProcessAdapter(IHostShell hostShell, ProcessStreamBuffer processStreamBuffer, CommandResponseHandler commandResponseHandler) throws IOException {
super(hostShell);
this.processStreamBuffer = processStreamBuffer;
@@ -67,11 +67,11 @@ public class YoctoHostShellProcessAdapter extends HostShellProcessAdapter {
private interface ICalculatePercentage {
public float calWorkloadDone(String info) throws IllegalArgumentException;
}
-
+
private class GitCalculatePercentage implements ICalculatePercentage {
final Pattern pattern = Pattern.compile("^Receiving objects:\\s*(\\d+)%.*");
public float calWorkloadDone(String info) throws IllegalArgumentException {
- Matcher m = pattern.matcher(info.trim());
+ Matcher m = pattern.matcher(info.trim());
if(m.matches()) {
return new Float(m.group(1)) / 100;
}else {
@@ -79,7 +79,7 @@ public class YoctoHostShellProcessAdapter extends HostShellProcessAdapter {
}
}
}
-
+
private IProgressMonitor getMonitor() {
if (command == null) {
return null;
@@ -88,16 +88,13 @@ public class YoctoHostShellProcessAdapter extends HostShellProcessAdapter {
}

private void updateMonitor(final int work){
-
Display.getDefault().asyncExec(new Runnable() {
-
@Override
public void run() {
if (getMonitor() != null) {
getMonitor().worked(work);
}
}
-
});
}

@@ -155,10 +152,9 @@ public class YoctoHostShellProcessAdapter extends HostShellProcessAdapter {
continue;
}
setCommandPrompt(value);
-
if (commandPrompt != null && endChar != null && command != null && processStreamBuffer != null &&
value.startsWith(commandPrompt) && value.endsWith(endChar) &&
- !value.endsWith(command) && processStreamBuffer.getLastOutputLineContaining(command) != null) {
+ !value.endsWith(command) && processStreamBuffer.getLastOutputLineContaining(command) != null /*&& waitForOutput*/) {
sem.release();
isFinished = true;
}
@@ -210,4 +206,3 @@ public class YoctoHostShellProcessAdapter extends HostShellProcessAdapter {
}

}
-
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 7c1a655..37c12f8 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
@@ -1,7 +1,6 @@
package org.yocto.bc.ui.wizards.install;

import java.io.File;
-import java.io.FilenameFilter;
import java.net.URI;
import java.net.URISyntaxException;
import java.util.Map;
@@ -13,6 +12,7 @@ import org.eclipse.core.resources.IResource;
import org.eclipse.core.resources.IWorkspaceRoot;
import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.NullProgressMonitor;
import org.eclipse.core.runtime.Path;
import org.eclipse.core.runtime.Platform;
import org.eclipse.ptp.rdt.ui.wizards.RemoteProjectContentsLocationArea;
@@ -22,9 +22,9 @@ import org.eclipse.ptp.remote.core.IRemoteFileManager;
import org.eclipse.ptp.remote.core.IRemoteServices;
import org.eclipse.ptp.remote.core.exception.RemoteConnectionException;
import org.eclipse.ptp.remote.rse.core.RSEConnection;
+import org.eclipse.rse.core.model.IHost;
+import org.eclipse.rse.services.files.IHostFile;
import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.SelectionEvent;
-import org.eclipse.swt.events.SelectionListener;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Button;
@@ -32,31 +32,32 @@ 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;
import org.yocto.bc.ui.wizards.FiniteStateWizardPage;

/**
* Select which flavor of OE is to be installed.
- *
+ *
* @author kgilmer
- *
+ *
* Setting up the parameters for creating the new Yocto Bitbake project
- *
+ *
* @modified jzhang
*/
public class OptionsPage extends FiniteStateWizardPage {

public static final String URI_SEPARATOR = "/";
public static final String LOCALHOST = "LOCALHOST";
-
+
private Composite top;
-
+
private ValidationListener validationListener;
private Text txtProjectName;
private Button btnGit;
private Button btnValidate;
-
+
private RemoteProjectContentsLocationArea locationArea;
-
+
protected OptionsPage(Map<String, Object> model) {
super("Options", model);
setMessage("Enter these parameters to create new Yocto Project BitBake commander project");
@@ -69,7 +70,7 @@ public class OptionsPage extends FiniteStateWizardPage {
top.setLayoutData(new GridData(GridData.FILL_BOTH));

GridData gdFillH = new GridData(GridData.FILL_HORIZONTAL);
-
+
Composite projectNameComp = new Composite(top, SWT.NONE);
GridData gdProjName = new GridData(GridData.FILL_HORIZONTAL);
projectNameComp.setLayoutData(gdProjName);
@@ -81,11 +82,11 @@ public class OptionsPage extends FiniteStateWizardPage {
txtProjectName.setLayoutData(gdFillH);
txtProjectName.setFocus();
validationListener = new ValidationListener();
-
+
txtProjectName.addModifyListener(validationListener);

IErrorMessageReporter errorReporter = new IErrorMessageReporter() {
-
+
@Override
public void reportError(String errorMessage, boolean infoOnly) {
setMessage(errorMessage);
@@ -93,47 +94,32 @@ public class OptionsPage extends FiniteStateWizardPage {
updateModel();
}
};
-
+
locationArea = new RemoteProjectContentsLocationArea(errorReporter, top, null);
-
+
Group locationValidationGroup = new Group(top, SWT.NONE);
locationValidationGroup.setText("Git repository");
GridData gd = new GridData(GridData.VERTICAL_ALIGN_END | GridData.FILL_HORIZONTAL);
locationValidationGroup.setLayoutData(gd);
GridLayout gl = new GridLayout(1, false);
locationValidationGroup.setLayout(gl);
-
- SelectionListener lst = new SelectionListener() {
-
- @Override
- public void widgetSelected(SelectionEvent e) {
- if (validateProjectName() && validateProjectLocation())
- setPageComplete(true);
-
- }
-
- @Override
- public void widgetDefaultSelected(SelectionEvent e) {
- }
- };
-
-
+
btnGit = new Button(locationValidationGroup, SWT.RADIO);
btnGit.setText("Clone from Yocto Project &Git Repository into new location");
btnGit.setEnabled(true);
btnGit.setSelection(true);
- btnGit.addSelectionListener(lst);
-
-
+ btnGit.addSelectionListener(validationListener);
+
+
btnValidate = new Button(locationValidationGroup, SWT.RADIO);
btnValidate.setText("&Validate existing Git project location");
btnValidate.setEnabled(true);
btnValidate.setSelection(false);
- btnValidate.addSelectionListener(lst);
-
+ btnValidate.addSelectionListener(validationListener);
+
setControl(top);
}
-
+
private boolean validateProjectName() {
IWorkspaceRoot wsroot = ResourcesPlugin.getWorkspace().getRoot();

@@ -143,7 +129,7 @@ public class OptionsPage extends FiniteStateWizardPage {
setErrorMessage("Project name cannot be empty!");
return false;
}
-
+
if (!validate.isOK() || !isValidProjectName(txtProjectName.getText())) {
setErrorMessage("Invalid project name: " + txtProjectName.getText());
return false;
@@ -156,67 +142,78 @@ public class OptionsPage extends FiniteStateWizardPage {
}
return true;
}
-
+
public String getProjectName(){
return txtProjectName.getText().trim();
}
-
+
protected boolean validateProjectLocation() {
-
+
String projectLoc = locationArea.getProjectLocation().trim();
-
- File checkProject_dir = new File(projectLoc);
- if (!checkProject_dir.isDirectory()) {
- setErrorMessage("The project location directory " + projectLoc + " is not valid");
+
+ IRemoteConnection remoteConnection = locationArea.getRemoteConnection();
+ if (remoteConnection == null)
return false;
- }
+
+ if (projectLoc.isEmpty())
+ return true;
+
+ IHost connection = RemoteHelper.getRemoteConnectionByName(remoteConnection.getName());
+
projectLoc = convertToRealPath(projectLoc);
String separator = projectLoc.endsWith(URI_SEPARATOR) ? "" : URI_SEPARATOR;
String projectPath = projectLoc + separator + getProjectName();
- File gitDir = new File(projectPath);
+ IHostFile repoDest = RemoteHelper.getRemoteHostFile(connection, projectPath, new NullProgressMonitor());
+
if(btnValidate.getSelection()) {
- if(!gitDir.isDirectory() || !gitDir.exists()) {
+ if (repoDest == null || !repoDest.exists()) {
setErrorMessage("Directory " + projectPath + " does not exist, please select git clone.");
return false;
}
- File[] filesMatched = gitDir.listFiles(new FilenameFilter() {
-
- @Override
- public boolean accept(File file, String pattern) {
- return file.getName().equals(".git");
- }
- });
-
- if (filesMatched.length != 1) {
+ IHostFile gitDescr = RemoteHelper.getRemoteHostFile(connection, projectPath + "/.git", new NullProgressMonitor());
+ if (gitDescr == null || !gitDescr.exists()) {
setErrorMessage("Directory " + projectPath + " does not contain a git repository, please select git clone.");
return false;
}
-
- if(!new File(projectLoc + separator + InstallWizard.VALIDATION_FILE).exists()) {
+
+ IHostFile validationFile = RemoteHelper.getRemoteHostFile(connection, projectPath + URI_SEPARATOR + InstallWizard.VALIDATION_FILE, new NullProgressMonitor());
+ if (validationFile == null || !validationFile.exists()) {
setErrorMessage("Directory " + projectPath + " seems invalid, please use other directory or project name.");
return false;
}
+ } else { //git clone
+ if (repoDest.exists() && repoDest.isDirectory()) {
+ IHostFile gitDescr = RemoteHelper.getRemoteHostFile(connection, projectPath + "/.git", new NullProgressMonitor());
+ if (gitDescr != null && gitDescr.exists()) {
+ setErrorMessage("Directory " + projectPath + " contains a repository, please select validate repository.");
+ return false;
+ }
+ }
}
-
+
try {
- IWorkspaceRoot wsroot = ResourcesPlugin.getWorkspace().getRoot();
- IProject proj = wsroot.getProject(txtProjectName.getText());
- if (proj.exists()) {
- setErrorMessage("A project with the name " + txtProjectName.getText() + " already exists");
- return false;
- }
- URI location = new URI("file:" + URI_SEPARATOR + URI_SEPARATOR + convertToRealPath(projectLoc) + URI_SEPARATOR + txtProjectName.getText());
-
- IStatus status = ResourcesPlugin.getWorkspace().validateProjectLocationURI(proj, location);
- if (!status.isOK()) {
- setErrorMessage(status.getMessage());
- return false;
+ String projName = txtProjectName.getText();
+ if (!projName.trim().isEmpty() && validateProjectName()) {
+ IWorkspaceRoot wsroot = ResourcesPlugin.getWorkspace().getRoot();
+ IProject proj = wsroot.getProject();
+ if (proj != null && proj.exists()) {
+ setErrorMessage("A project with the name " + projName + " already exists");
+ return false;
+ }
+ URI location = new URI("file:" + URI_SEPARATOR + URI_SEPARATOR + convertToRealPath(projectLoc) + URI_SEPARATOR + txtProjectName.getText());
+
+ IStatus status = ResourcesPlugin.getWorkspace().validateProjectLocationURI(proj, location);
+ if (!status.isOK()) {
+ setErrorMessage(status.getMessage());
+ return false;
+ }
}
} catch (Exception e) {
+ e.printStackTrace();
setErrorMessage("Run into error while trying to validate entries!");
return false;
}
-
+
setErrorMessage(null);
return true;
}
@@ -238,7 +235,7 @@ public class OptionsPage extends FiniteStateWizardPage {
return convertedpath;
}

-
+
@Override
public void pageCleanup() {

@@ -249,7 +246,7 @@ public class OptionsPage extends FiniteStateWizardPage {
}

@Override
-
+
protected void updateModel() {
try {
URI uri = getProjectLocationURI();
@@ -266,12 +263,12 @@ public class OptionsPage extends FiniteStateWizardPage {

public URI getProjectLocationURI() throws URISyntaxException {
URI uri = locationArea.getProjectLocationURI();
-
+
if (uri != null) {
String location = locationArea.getProjectLocation();
if (!uri.getPath().isEmpty()) {
String separator = uri.getPath().endsWith(URI_SEPARATOR) ? "" : URI_SEPARATOR;
-
+
return new URI( uri.getScheme(),
uri.getHost(),
uri.getPath() + separator + txtProjectName.getText(),
@@ -284,7 +281,7 @@ public class OptionsPage extends FiniteStateWizardPage {
} else {
String location = locationArea.getProjectLocation();
String separator = location.endsWith(URI_SEPARATOR) ? "" : URI_SEPARATOR;
-
+
IRemoteConnection conn = locationArea.getConnection();
if (conn instanceof RSEConnection) {
RSEConnection rseConn = (RSEConnection)conn;
@@ -294,7 +291,7 @@ public class OptionsPage extends FiniteStateWizardPage {
}
}
}
-
+
private String getDefaultPathDisplayString(IRemoteConnection connection, IRemoteServices remoteServices) {
String projectName = getProjectName();
if (projectName.isEmpty())
@@ -306,7 +303,7 @@ public class OptionsPage extends FiniteStateWizardPage {
} catch (RemoteConnectionException e) {
e.printStackTrace();
}
-
+
IRemoteFileManager fileMgr = remoteServices.getFileManager(connection);
URI defaultURI = fileMgr.toURI(connection.getWorkingDirectory());

@@ -322,19 +319,30 @@ public class OptionsPage extends FiniteStateWizardPage {
}
return ""; //$NON-NLS-1$
}
-
+
private boolean isValidProjectName(String projectName) {
- if (projectName.indexOf('$') > -1) {
+ if (projectName.contains("\\s+"))
+ return false;
+
+ if (projectName.indexOf('$') != -1)
return false;
- }

+ char[] chars = projectName.toCharArray();
+ if (!Character.isJavaIdentifierStart(chars[0]))
+ return false;
+ for (int i = 1; i < chars.length; i++)
+ if (!Character.isJavaIdentifierPart(chars[i]))
+ return false;
return true;
- }
+ }
@Override
protected boolean validatePage() {
if (!validateProjectName())
return false;
-
+
+ if (!validateProjectLocation())
+ return false;
+
setErrorMessage(null);
setMessage("All the entries are valid, press \"Finish\" to start the process, "+
"this will take a while. Please don't interrupt till there's output in the Yocto Console window...");
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 a2af6e4..7a68ed5 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
@@ -15,7 +15,6 @@ import java.lang.reflect.InvocationTargetException;

import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.jface.operation.IRunnableWithProgress;
-
import org.yocto.bc.bitbake.BBSession;
import org.yocto.bc.bitbake.ProjectInfoHelper;
import org.yocto.bc.remote.utils.RemoteHelper;
@@ -37,13 +36,16 @@ public class BBConfigurationInitializeOperation implements IRunnableWithProgress
this.writer = writer;
}

+ @Override
public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
BBSession session;
try {
+ 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();
} catch (Exception e) {
throw new InvocationTargetException(e);
}
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 fcc939c..1a19479 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
@@ -42,40 +42,40 @@ public class CreateBBCProjectOperation extends WorkspaceModifyOperation {
public static void addNatureToProject(IProject proj, String nature_id, IProgressMonitor monitor) throws CoreException {
IProjectDescription desc = proj.getDescription();
Vector<String> natureIds = new Vector<String>();
-
+
natureIds.add(nature_id);
natureIds.addAll(Arrays.asList(desc.getNatureIds()));
- desc.setNatureIds((String[]) natureIds.toArray(new String[natureIds.size()]));
-
+ desc.setNatureIds(natureIds.toArray(new String[natureIds.size()]));
+
proj.setDescription(desc, monitor);
}
-
+
private ProjectInfo projInfo;

public CreateBBCProjectOperation(ProjectInfo projInfo) {
this.projInfo = projInfo;
}
-
+
protected void addNatures(IProject proj, IProgressMonitor monitor) throws CoreException {
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());
-
+
return desc;
}

@Override
protected void execute(IProgressMonitor monitor) throws CoreException, InvocationTargetException, InterruptedException {
IProjectDescription desc = createProjectDescription(ResourcesPlugin.getWorkspace(), projInfo);
-
+
IWorkspaceRoot wsroot = ResourcesPlugin.getWorkspace().getRoot();

IProject proj = wsroot.getProject(projInfo.getProjectName());
-
+
try {
proj.create(desc, monitor);
ProjectInfoHelper.store(RemoteHelper.getRemoteConnectionByName(projInfo.getConnection().getName()), proj.getLocationURI(), projInfo, monitor);
@@ -85,13 +85,9 @@ public class CreateBBCProjectOperation extends WorkspaceModifyOperation {
} catch (Exception e) {
e.printStackTrace();
}
-
-
-
-
addNatures(proj, monitor);
}
-
+
public ProjectInfo getProjectInfo() {
return projInfo;
}
--
1.7.9.5


[PATCH 2/8] Show progress bar for building new Recipe in Bitbake commander perspective

Ioana Grigoropol <ioanax.grigoropol@...>
 

Signed-off-by: Ioana Grigoropol <ioanax.grigoropol@...>
---
.../ui/wizards/NewBitBakeFileRecipeWizardPage.java | 119 +++++++++++++-------
1 file changed, 78 insertions(+), 41 deletions(-)

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 e27619e..e9dc1f3 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
@@ -11,6 +11,7 @@
*******************************************************************************/
package org.yocto.bc.ui.wizards;

+import java.lang.reflect.InvocationTargetException;
import java.net.URI;
import java.net.URISyntaxException;
import java.util.ArrayList;
@@ -27,6 +28,7 @@ import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.NullProgressMonitor;
import org.eclipse.core.runtime.Path;
+import org.eclipse.jface.operation.IRunnableWithProgress;
import org.eclipse.jface.viewers.ISelection;
import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.jface.window.Window;
@@ -74,6 +76,8 @@ public class NewBitBakeFileRecipeWizardPage extends WizardPage {
private IHost connection;

private String tempFolderPath;
+ private String srcFileNameExt;
+ private String srcFileName;

public static final String TEMP_FOLDER_NAME = "temp";
public static final String TAR_BZ2_EXT = ".tar.bz2";
@@ -98,6 +102,12 @@ public class NewBitBakeFileRecipeWizardPage extends WizardPage {
private static final String md5Pattern = "^[0-9a-f]{32}$";
protected static final String sha256Pattern = "^[0-9a-f]{64}$";

+ private HashMap<String, String> mirrorTable;
+ private URI extractDir;
+ private YoctoCommand licenseChecksumCmd;
+ protected YoctoCommand md5YCmd;
+ protected YoctoCommand sha256YCmd;
+
public NewBitBakeFileRecipeWizardPage(ISelection selection, IHost connection) {
super("wizardPage");
setTitle("BitBake Recipe");
@@ -300,16 +310,17 @@ public class NewBitBakeFileRecipeWizardPage extends WizardPage {
IProgressMonitor monitor = new NullProgressMonitor();
URI srcURI = new URI(txtSrcURI.getText().trim());
String scheme = srcURI.getScheme();
- String srcFileName = getSrcFileName(true);
+ this.srcFileNameExt = getSrcFileName(true);
+ this.srcFileName = getSrcFileName(false);
if ((scheme.equals(HTTP) || scheme.equals(FTP))
- && (srcFileName.endsWith(TAR_GZ_EXT) || srcFileName.endsWith(TAR_BZ2_EXT))) {
+ && (srcFileNameExt.endsWith(TAR_GZ_EXT) || srcFileNameExt.endsWith(TAR_BZ2_EXT))) {
try {
handleRemotePopulate(srcURI, monitor);
} catch (Exception e) {
e.printStackTrace();
}
} else {
- String packageName = getSrcFileName(false).replace("-", "_");
+ String packageName = srcFileName.replace("-", "_");
fileText.setText(packageName + BB_RECIPE_EXT);

handleLocalPopulate(srcURI, monitor);
@@ -320,52 +331,78 @@ public class NewBitBakeFileRecipeWizardPage extends WizardPage {
}

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

- private void handleRemotePopulate(URI srcURI, IProgressMonitor monitor) throws Exception {
+ private void handleRemotePopulate(final URI srcURI, IProgressMonitor monitor) throws Exception {
RemoteHelper.clearProcessBuffer(connection);
-
populateRecipeName(srcURI);
- List<YoctoCommand> commands = new ArrayList<YoctoCommand>();

- String metaDirLocPath = metaDirLoc.getPath();
- commands.add(new YoctoCommand("rm -rf " + TEMP_FOLDER_NAME, metaDirLocPath, ""));
- commands.add(new YoctoCommand( "mkdir " + TEMP_FOLDER_NAME, metaDirLocPath, ""));
- updateTempFolderPath();
+ this.getContainer().run(true, true, new IRunnableWithProgress() {

+ @Override
+ public void run(IProgressMonitor monitor) throws InvocationTargetException,
+ InterruptedException {
+ monitor.beginTask("Populating recipe fields ... ", 100);
+ List<YoctoCommand> commands = new ArrayList<YoctoCommand>();

- try {
- commands.add(new YoctoCommand("wget " + srcURI.toURL(), tempFolderPath, ""));
+ try {
+ String metaDirLocPath = metaDirLoc.getPath();

- updateTempFolderPath();
- RemoteHelper.runBatchRemote(connection, commands, true);
+ monitor.subTask("Cleaning environment");
+ commands.add(new YoctoCommand("rm -rf " + TEMP_FOLDER_NAME, metaDirLocPath, ""));
+ commands.add(new YoctoCommand( "mkdir " + TEMP_FOLDER_NAME, metaDirLocPath, ""));
+ updateTempFolderPath();
+ monitor.worked(10);

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

- String md5Cmd = "md5sum " + getSrcFileName(true);
- YoctoCommand md5YCmd = new YoctoCommand(md5Cmd, tempFolderPath, "");
- RemoteHelper.runCommandRemote(connection, md5YCmd);
+ updateTempFolderPath();
+ RemoteHelper.runBatchRemote(connection, commands, true);

- String sha256Cmd = "sha256sum " + getSrcFileName(true);
- YoctoCommand sha256YCmd = new YoctoCommand(sha256Cmd, tempFolderPath, "");
- RemoteHelper.runCommandRemote(connection, sha256YCmd);
+ commands.clear();
+ monitor.worked(50);

- URI extractDir = extractPackage(srcURI, monitor);
- YoctoCommand licenseChecksumCmd = populateLicenseFileChecksum(extractDir, monitor);
- updateSrcUri(createMirrorLookupTable(monitor), srcURI);
- populateInheritance(extractDir, monitor);
+ monitor.subTask("Compute package checksums");
+ String md5Cmd = "md5sum " + srcFileNameExt;
+ md5YCmd = new YoctoCommand(md5Cmd, tempFolderPath, "");
+ RemoteHelper.runCommandRemote(connection, md5YCmd);

- String md5Val = retrieveSum(md5YCmd);
- md5sumText.setText(Pattern.matches(md5Pattern, md5Val) ? md5Val : "");
- String sha256Val = retrieveSum(sha256YCmd);
- sha256sumText.setText(Pattern.matches(sha256Pattern, sha256Val) ? sha256Val : "");
- String checkSumVal = retrieveSum(licenseChecksumCmd);
- checksumText.setText(RemoteHelper.createNewURI(extractDir, COPYING_FILE).toString() + ";md5=" + (Pattern.matches(md5Pattern, checkSumVal) ? checkSumVal : ""));
- } catch (Exception e) {
- e.printStackTrace();
- }
+ monitor.worked(60);
+
+ String sha256Cmd = "sha256sum " + srcFileNameExt;
+ sha256YCmd = new YoctoCommand(sha256Cmd, tempFolderPath, "");
+ RemoteHelper.runCommandRemote(connection, sha256YCmd);
+
+ monitor.worked(70);
+
+ monitor.subTask("Extracting package");
+ extractDir = extractPackage(srcURI);
+ monitor.worked(80);
+
+ licenseChecksumCmd = populateLicenseFileChecksum(extractDir);
+
+ monitor.subTask("Creating mirror lookup table");
+ mirrorTable = createMirrorLookupTable();
+
+ monitor.worked(90);
+ monitor.done();
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ }
+ });
+ updateSrcUri(mirrorTable, srcURI);
+ populateInheritance(extractDir, monitor);
+
+ String md5Val = retrieveSum(md5YCmd);
+ md5sumText.setText(Pattern.matches(md5Pattern, md5Val) ? md5Val : "");
+ String sha256Val = retrieveSum(sha256YCmd);
+ sha256sumText.setText(Pattern.matches(sha256Pattern, sha256Val) ? sha256Val : "");
+ String checkSumVal = retrieveSum(licenseChecksumCmd);
+ checksumText.setText(RemoteHelper.createNewURI(extractDir, COPYING_FILE).toString() + ";md5=" + (Pattern.matches(md5Pattern, checkSumVal) ? checkSumVal : ""));
}

private String retrieveSum(YoctoCommand cmd) {
@@ -378,9 +415,9 @@ public class NewBitBakeFileRecipeWizardPage extends WizardPage {
return "";
}

- private URI extractPackage(URI srcURI, IProgressMonitor monitor) {
+ private URI extractPackage(URI srcURI) {
try {
- String path = getSrcFileName(true);
+ String path = srcFileNameExt;
String tarCmd = "tar ";
if (path.endsWith(TAR_BZ2_EXT)) {
tarCmd += "-zxvf ";
@@ -390,7 +427,7 @@ public class NewBitBakeFileRecipeWizardPage extends WizardPage {

RemoteHelper.runCommandRemote(connection, new YoctoCommand(tarCmd + path, tempFolderPath, ""));

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

} catch (Exception e) {
e.printStackTrace();
@@ -424,7 +461,7 @@ public class NewBitBakeFileRecipeWizardPage extends WizardPage {
}
}

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

@@ -459,7 +496,7 @@ public class NewBitBakeFileRecipeWizardPage extends WizardPage {
return "";
}

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

YoctoCommand cmd = new YoctoCommand("cat " + MIRRORS_FILE, getMetaFolderPath() + CLASSES_FOLDER, "");
@@ -486,7 +523,7 @@ public class NewBitBakeFileRecipeWizardPage extends WizardPage {
if (!fileName.isEmpty())
return;

- String recipeFile = getSrcFileName(false).replace("-", "_");
+ String recipeFile = srcFileName.replace("-", "_");
recipeFile += BB_RECIPE_EXT;
if (recipeFile != null)
fileText.setText(recipeFile);
--
1.7.9.5


[PATCH 1/8] Show progress bar for New Bitbake Commander project

Ioana Grigoropol <ioanax.grigoropol@...>
 

- run new Bitbake project creation in a new thread, being cancelable and update the monitor from the event handler in a asynchronous way by invoking Display.asyncExec
- use a blocking way to wait(mutex) for the event handler to finish reading command outputs - not only the event handler must be blocked, the one invoking the remote commands must block waiting for output, otherwise the new Project Wizard will not wait for the commands to finish running
- When searching for the desired output through the existing lines, we should not search for the prompt + previous command exactly, because the terminal shell used will use a wrapping value for the lines received and insert a whitespace character at each multiple of wrapping value
- usually, the wrapping value is controlled by $COLUMNS shell variable - a quick fix setting this variable to a bigger value does not prove useful
- instead, wait for the line containing the prompt & the previous command having all existing whitespaces removed
- the possibility that this line will be issued more than once is small.
- use YoctoHostShellAdapter to run long task showing progress in a Wizard page & parse task output using specialized Calculators

Signed-off-by: Ioana Grigoropol <ioanax.grigoropol@...>
---
.../src/org/yocto/bc/bitbake/ShellSession.java | 24 +--
.../yocto/bc/remote/utils/ProcessStreamBuffer.java | 3 +-
.../org/yocto/bc/remote/utils/RemoteHelper.java | 92 +++-----
.../org/yocto/bc/remote/utils/RemoteMachine.java | 4 +-
.../remote/utils/YoctoHostShellProcessAdapter.java | 137 ++++++------
.../bc/remote/utils/YoctoRunnableWithProgress.java | 106 ++++++++++
.../bc/ui/wizards/NewBitBakeFileRecipeWizard.java | 2 +-
.../ui/wizards/NewBitBakeFileRecipeWizardPage.java | 222 +++++++++-----------
.../yocto/bc/ui/wizards/install/InstallWizard.java | 113 +++-------
.../newproject/CreateBBCProjectOperation.java | 7 +-
10 files changed, 340 insertions(+), 370 deletions(-)
create mode 100644 plugins/org.yocto.bc.ui/src/org/yocto/bc/remote/utils/YoctoRunnableWithProgress.java

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 edff746..961472f 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
@@ -47,6 +47,7 @@ public class ShellSession {
public static final String TERMINATOR = "#234o987dsfkcqiuwey18837032843259d";
public static final String LT = System.getProperty("line.separator");
public static final String exportCmd = "export BB_ENV_EXTRAWHITE=\"DISABLE_SANITY_CHECKS $BB_ENV_EXTRAWHITE\"";
+ public static final String exportColumnsCmd = "export COLUMNS=1000";

public static String getFilePath(String file) throws IOException {
File f = new File(file);
@@ -96,8 +97,8 @@ public class ShellSession {
private void initializeShell(IProgressMonitor monitor) throws IOException {
try {
IHost connection = RemoteHelper.getRemoteConnectionByName(projectInfo.getConnection().getName());
- RemoteHelper.runCommandRemote(connection, new YoctoCommand("source " + initCmd, root.getAbsolutePath(), ""), monitor);
- RemoteHelper.runCommandRemote(connection, new YoctoCommand(exportCmd, root.getAbsolutePath(), ""), monitor);
+ RemoteHelper.runCommandRemote(connection, new YoctoCommand("source " + initCmd, root.getAbsolutePath(), ""));
+ RemoteHelper.runCommandRemote(connection, new YoctoCommand(exportCmd, root.getAbsolutePath(), ""));
} catch (Exception e) {
e.printStackTrace();
}
@@ -112,7 +113,7 @@ public class ShellSession {
public String execute(String command, boolean hasErrors) throws IOException {
try {
IHost connection = RemoteHelper.getRemoteConnectionByName(projectInfo.getConnection().getName());
- hasErrors = RemoteHelper.runCommandRemote(connection, new YoctoCommand(command, root.getAbsolutePath() + "/build/", ""), new NullProgressMonitor());
+ hasErrors = RemoteHelper.runCommandRemote(connection, new YoctoCommand(command, root.getAbsolutePath() + "/build/", ""));
return RemoteHelper.getProcessBuffer(connection).getMergedOutputLines();
} catch (Exception e) {
e.printStackTrace();
@@ -241,20 +242,5 @@ synchronized
interrupt = true;
}

- private class NullWriter extends Writer {
-
- @Override
- public void close() throws IOException {
- }
-
- @Override
- public void flush() throws IOException {
- }
-
- @Override
- public void write(char[] cbuf, int off, int len) throws IOException {
- }
-
- }
-
}
+
diff --git a/plugins/org.yocto.bc.ui/src/org/yocto/bc/remote/utils/ProcessStreamBuffer.java b/plugins/org.yocto.bc.ui/src/org/yocto/bc/remote/utils/ProcessStreamBuffer.java
index 6756fe3..438a5b4 100644
--- a/plugins/org.yocto.bc.ui/src/org/yocto/bc/remote/utils/ProcessStreamBuffer.java
+++ b/plugins/org.yocto.bc.ui/src/org/yocto/bc/remote/utils/ProcessStreamBuffer.java
@@ -4,6 +4,7 @@ import java.util.ArrayList;
import java.util.List;

public class ProcessStreamBuffer {
+ private static final String WHITESPACES = "\\s+";
List<String> errorLines;
List<String> outputLines;

@@ -47,7 +48,7 @@ public class ProcessStreamBuffer {
return null;
for (int i = outputLines.size() - 1; i >= 0; i--){
String line = outputLines.get(i);
- if (line.contains(str))
+ if (line.replaceAll(WHITESPACES, "").contains(str.replaceAll(WHITESPACES, "")))
return line;
}
return null;
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 432969c..929ad63 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
@@ -138,36 +138,6 @@ public class RemoteHelper {
return null;
}

-// private static int displayDialogBox(String name, String[] choices) {
-// Display display = Display.getDefault();;
-// final Shell shell = new Shell(display);
-// shell.setText(name);
-//
-// shell.setLayout(new GridLayout(2, false));
-//
-// new Label(shell, SWT.NONE).setText("Connections for host:");
-// final Combo comboChoices = new Combo(shell, SWT.DROP_DOWN | SWT.READ_ONLY);
-// for (int i = 0, n = choices.length; i < n; i++)
-// comboChoices.add(choices[i]);
-// comboChoices.select(0);
-//
-// Button btnOK = new Button(shell, SWT.PUSH);
-// btnOK.setText("OK");
-//
-// DialogSelectionListener dsl = new DialogSelectionListener(shell, comboChoices);
-//
-// btnOK.addSelectionListener(dsl);
-//
-// shell.pack();
-// shell.open();
-// while (!shell.isDisposed()) {
-// if (!display.readAndDispatch()) {
-// display.sleep();
-// }
-// }
-// return dsl.getReturnValue();
-// }
-
public static String getRemoteHostName(String remoteConnection){
final IHost host = getRemoteConnectionByName(remoteConnection);
if(host == null)
@@ -270,49 +240,49 @@ public class RemoteHelper {
return null;
}

- public static boolean runCommandRemote(IHost connection, YoctoCommand cmd, IProgressMonitor monitor) throws Exception {
- String remoteCommand = cmd.getCommand() + " " + cmd.getArguments();
- boolean hasErrors = false;
- try {
- if (!cmd.getInitialDirectory().isEmpty()) {
- hasErrors = writeToShell(connection, "cd " + cmd.getInitialDirectory(), monitor);
- }
- if (!hasErrors)
- return writeToShell(connection, remoteCommand, monitor);
- } catch (Exception e) {
- e.printStackTrace();
+ public static boolean runCommandRemote(final IHost connection, final YoctoCommand cmd) throws Exception {
+ final String remoteCommand = cmd.getCommand() + " " + cmd.getArguments();
+ final boolean hasErrors = false;
+
+ if (!cmd.getInitialDirectory().isEmpty()) {
+ writeToShell(connection, "cd " + cmd.getInitialDirectory());
}
+ if (!hasErrors)
+ writeToShell(connection, remoteCommand);
+
return hasErrors;
}

- public static boolean writeToShell(IHost connection, String remoteCommand, IProgressMonitor monitor){
- YoctoHostShellProcessAdapter hostShellProcessAdapter = getHostShellProcessAdapter(connection);
- hostShellProcessAdapter.setMonitor(monitor);
- hostShellProcessAdapter.setLastCommand(remoteCommand);
- getHostShell(connection).writeToShell(remoteCommand);
-
-// try {
-// while (!hostShellProcessAdapter.isFinished() && hostShellProcessAdapter.isAlive()) {
-// Thread.sleep(2);
-// }
-//// System.out.println(">>>>>>>>>>>>>>>>>>>>finished command " + remoteCommand);
-// } catch (Exception e) {
-// e.printStackTrace();
-// }
-//
- return hostShellProcessAdapter.hasErrors();
+ public static boolean writeToShell(final IHost connection, final String remoteCommand){
+ new Thread(new Runnable() {
+ @Override
+ public void run() {
+ try {
+ YoctoHostShellProcessAdapter adapter = getHostShellProcessAdapter(connection);
+ adapter.setLastCommand(remoteCommand);
+ getHostShell(connection).writeToShell(remoteCommand);
+ while (!adapter.isFinished())
+ Thread.sleep(2);
+// return hostShellProcessAdapter.hasErrors();
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ }
+ }).run();
+ return true;
}
-
- public static void runBatchRemote(IHost connection, List<YoctoCommand> cmds, IProgressMonitor monitor, boolean waitForOutput) throws CoreException {
+
+ public static void runBatchRemote(IHost connection, List<YoctoCommand> cmds, boolean waitForOutput) throws CoreException {
try {
String remoteCommand = "";
for (YoctoCommand cmd : cmds) {
remoteCommand = cmd.getCommand() + " " + cmd.getArguments();
if (!cmd.getInitialDirectory().isEmpty()) {
- writeToShell(connection, "cd " + cmd.getInitialDirectory(), monitor);
+ writeToShell(connection, "cd " + cmd.getInitialDirectory());
}
- writeToShell(connection, remoteCommand, monitor);
+ writeToShell(connection, remoteCommand);
}
+
} catch (Exception e1) {
e1.printStackTrace();
}
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 a953ef7..6eb2945 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,6 +8,8 @@ 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;
@@ -72,7 +74,7 @@ public class RemoteMachine {
public YoctoHostShellProcessAdapter getHostShellProcessAdapter() {
try {
if (hostShellProcessAdapter == null)
- hostShellProcessAdapter = new YoctoHostShellProcessAdapter(getHostShell(), getProcessBuffer(), getCmdHandler());
+ hostShellProcessAdapter = new YoctoRunnableWithProgress(getHostShell(), getProcessBuffer(), getCmdHandler());
return hostShellProcessAdapter;
} catch (IOException e) {
e.printStackTrace();
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 79a62e0..baedc3b 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
@@ -1,19 +1,22 @@
package org.yocto.bc.remote.utils;

import java.io.IOException;
+import java.util.HashMap;
+import java.util.Map;
import java.util.concurrent.Semaphore;
import java.util.regex.Matcher;
import java.util.regex.Pattern;

import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.rse.services.shells.AbstractHostShellOutputReader;
+import org.eclipse.core.runtime.NullProgressMonitor;
import org.eclipse.rse.services.shells.HostShellProcessAdapter;
import org.eclipse.rse.services.shells.IHostOutput;
import org.eclipse.rse.services.shells.IHostShell;
import org.eclipse.rse.services.shells.IHostShellChangeEvent;
import org.eclipse.rse.services.shells.IHostShellOutputReader;
+import org.eclipse.swt.widgets.Display;

-public class YoctoHostShellProcessAdapter extends HostShellProcessAdapter{
+public class YoctoHostShellProcessAdapter extends HostShellProcessAdapter {
private String commandPrompt = null;
private static final String ROOT = "root";
private static final String PROMPT_USER_CH = "$";
@@ -23,42 +26,42 @@ public class YoctoHostShellProcessAdapter extends HostShellProcessAdapter{
private boolean isFinished;
private ICalculatePercentage calculator;
private int reportedWorkload;
- private IProgressMonitor monitor;
private boolean isAlive;

- private String lastCommand;
- private boolean waitForOutput;
+ private String command;
+ private Map<String, IProgressMonitor> commandMonitors;
private String endChar = null;

private Semaphore sem;

- public String getLastCommand() {
- return lastCommand;
- }
-
- public synchronized void setLastCommand(String lastCommand) {
-// if (waitForOutput) {
- try {
- // there are still some processes that might take a long time and if we do not wait for them,
- // then the semaphore will not be released, because an interrupted exception will occur
- Thread.sleep(2000);
- System.out.println(">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>semaphore aquire");
- sem.acquire();
- this.lastCommand = lastCommand.trim();
- System.out.println(">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>last command set " + lastCommand);
- } catch (InterruptedException e) {
- e.printStackTrace();
- }
-// }
+ public YoctoHostShellProcessAdapter(IHostShell hostShell, ProcessStreamBuffer processStreamBuffer, CommandResponseHandler commandResponseHandler) throws IOException {
+ super(hostShell);
+ this.processStreamBuffer = processStreamBuffer;
+ this.commandResponseHandler = commandResponseHandler;
+ this.calculator = new GitCalculatePercentage();
+ this.sem = new Semaphore(1);
+ this.command = "";
+ this.commandMonitors = new HashMap<>();
}

-
- public IProgressMonitor getMonitor() {
- return monitor;
+ public String getLastCommand() {
+ return command;
}

- public void setMonitor(IProgressMonitor monitor) {
- this.monitor = monitor;
+ public synchronized void setLastCommand(String lastCommand) {
+ try {
+ // there are still some processes that might take a long time and if we do not wait for them,
+ // then the semaphore will not be released, because an interrupted exception will occur
+ Thread.sleep(2000);
+ isFinished = false;
+ sem.acquire();
+ this.command = lastCommand.trim();
+ System.out.println("last command " + lastCommand + getOwnMonitor());
+ this.commandMonitors.put(command, getOwnMonitor());
+
+ } catch (InterruptedException e) {
+ e.printStackTrace();
+ }
}

private interface ICalculatePercentage {
@@ -68,7 +71,7 @@ public class YoctoHostShellProcessAdapter extends HostShellProcessAdapter{
private class GitCalculatePercentage implements ICalculatePercentage {
final Pattern pattern = Pattern.compile("^Receiving objects:\\s*(\\d+)%.*");
public float calWorkloadDone(String info) throws IllegalArgumentException {
- Matcher m = pattern.matcher(info.trim());
+ Matcher m = pattern.matcher(info.trim());
if(m.matches()) {
return new Float(m.group(1)) / 100;
}else {
@@ -77,38 +80,37 @@ public class YoctoHostShellProcessAdapter extends HostShellProcessAdapter{
}
}

- public YoctoHostShellProcessAdapter(IHostShell hostShell, ProcessStreamBuffer processStreamBuffer, CommandResponseHandler commandResponseHandler) throws IOException {
- super(hostShell);
- this.processStreamBuffer = processStreamBuffer;
- this.commandResponseHandler = commandResponseHandler;
- this.calculator = new GitCalculatePercentage();
- this.sem = new Semaphore(1);
- this.lastCommand = "";
-
+ private IProgressMonitor getMonitor() {
+ if (command == null) {
+ return null;
+ }
+ return commandMonitors.get(command);
}

private void updateMonitor(final int work){
-// Display.getDefault().syncExec(new Runnable() {
-//
-// @Override
-// public void run() {
-// monitor.worked(work);
-// }
-// });
- }

+ Display.getDefault().asyncExec(new Runnable() {
+
+ @Override
+ public void run() {
+ if (getMonitor() != null) {
+ getMonitor().worked(work);
+ }
+ }
+
+ });
+ }
+
private void doneMonitor(){
-// Display.getCurrent().syncExec(new Runnable() {
-//
-// @Override
-// public void run() {
-// monitor.done();
-// }
-// });
+ Display.getDefault().asyncExec(new Runnable() {
+ @Override
+ public void run() {
+ getMonitor().done();
+ }
+ });
}
-
+
private void reportProgress(String info) {
-
if(calculator == null) {
updateMonitor(1);
} else {
@@ -130,7 +132,7 @@ public class YoctoHostShellProcessAdapter extends HostShellProcessAdapter{
doneMonitor();
}
}
-
+
@Override
public void shellOutputChanged(IHostShellChangeEvent event) {
IHostShellOutputReader reader = event.getReader();
@@ -153,10 +155,12 @@ public class YoctoHostShellProcessAdapter extends HostShellProcessAdapter{
continue;
}
setCommandPrompt(value);
- if (value.startsWith(commandPrompt) && value.endsWith(endChar) &&
- !value.endsWith(lastCommand) && processStreamBuffer.getLastOutputLineContaining(lastCommand) != null /*&& waitForOutput*/) {
- System.out.println(">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>Sem release");
+
+ if (commandPrompt != null && endChar != null && command != null && processStreamBuffer != null &&
+ value.startsWith(commandPrompt) && value.endsWith(endChar) &&
+ !value.endsWith(command) && processStreamBuffer.getLastOutputLineContaining(command) != null) {
sem.release();
+ isFinished = true;
}

reportProgress(value);
@@ -166,9 +170,6 @@ public class YoctoHostShellProcessAdapter extends HostShellProcessAdapter{
}
}

- AbstractHostShellOutputReader absReader = (AbstractHostShellOutputReader)reader;
- isAlive = absReader.isAlive();
- isFinished = absReader.isFinished();
}
private void setCommandPrompt(String value) {
if (commandPrompt == null) {
@@ -199,16 +200,14 @@ public class YoctoHostShellProcessAdapter extends HostShellProcessAdapter{
this.isAlive = isAlive;
}

- public boolean isWaitForOutput() {
- return waitForOutput;
- }
-
- public void setWaitForOutput(boolean waitForOutput) {
- this.waitForOutput = waitForOutput;
- }
-
public void clearProcessBuffer() {
this.processStreamBuffer.outputLines.clear();
this.processStreamBuffer.errorLines.clear();
}
+
+ public IProgressMonitor getOwnMonitor() {
+ return new NullProgressMonitor();
+ }
+
}
+
diff --git a/plugins/org.yocto.bc.ui/src/org/yocto/bc/remote/utils/YoctoRunnableWithProgress.java b/plugins/org.yocto.bc.ui/src/org/yocto/bc/remote/utils/YoctoRunnableWithProgress.java
new file mode 100644
index 0000000..b6ed2b8
--- /dev/null
+++ b/plugins/org.yocto.bc.ui/src/org/yocto/bc/remote/utils/YoctoRunnableWithProgress.java
@@ -0,0 +1,106 @@
+package org.yocto.bc.remote.utils;
+
+import java.io.IOException;
+import java.lang.reflect.InvocationTargetException;
+
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.jface.operation.IRunnableWithProgress;
+import org.eclipse.ptp.remote.core.IRemoteConnection;
+import org.eclipse.ptp.remote.core.IRemoteServices;
+import org.eclipse.ptp.remote.core.exception.RemoteConnectionException;
+import org.eclipse.rse.core.model.IHost;
+import org.eclipse.rse.services.shells.IHostShell;
+
+public class YoctoRunnableWithProgress extends YoctoHostShellProcessAdapter
+ implements IRunnableWithProgress {
+
+ private String taskName;
+ private IRemoteConnection remoteConnection;
+ private IRemoteServices remoteServices;
+ private String cmd;
+ private String args;
+ private IProgressMonitor monitor;
+
+ public YoctoRunnableWithProgress(IHostShell hostShell,
+ ProcessStreamBuffer processStreamBuffer,
+ CommandResponseHandler commandResponseHandler) throws IOException {
+ super(hostShell, processStreamBuffer, commandResponseHandler);
+ }
+
+ @Override
+ public void run(IProgressMonitor monitor) throws InvocationTargetException,
+ InterruptedException {
+ try {
+ this.monitor = monitor;
+ this.monitor.beginTask(taskName, RemoteHelper.TOTALWORKLOAD);
+
+ if (!remoteConnection.isOpen()) {
+ try {
+ remoteConnection.open(monitor);
+ } catch (RemoteConnectionException e1) {
+ e1.printStackTrace();
+ }
+ }
+
+ if (!remoteServices.isInitialized()) {
+ remoteServices.initialize();
+ }
+
+ try {
+ IHost connection = RemoteHelper.getRemoteConnectionByName(remoteConnection.getName());
+ RemoteHelper.runCommandRemote(connection, new YoctoCommand(cmd, "", args));
+ } catch (Exception e) {
+ e.printStackTrace();
+ } finally {
+ monitor.done();
+ }
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ }
+
+ @Override
+ public IProgressMonitor getOwnMonitor() {
+ return monitor;
+ }
+
+ public IRemoteConnection getRemoteConnection() {
+ return remoteConnection;
+ }
+
+ public void setRemoteConnection(IRemoteConnection remoteConnection) {
+ this.remoteConnection = remoteConnection;
+ }
+
+ public String getTaskName() {
+ return taskName;
+ }
+
+ public void setTaskName(String taskName) {
+ this.taskName = taskName;
+ }
+
+ public IRemoteServices getRemoteServices() {
+ return remoteServices;
+ }
+
+ public void setRemoteServices(IRemoteServices remoteServices) {
+ this.remoteServices = remoteServices;
+ }
+
+ public String getCmd() {
+ return cmd;
+ }
+
+ public void setCmd(String cmd) {
+ this.cmd = cmd;
+ }
+
+ public String getArgs() {
+ return args;
+ }
+
+ public void setArgs(String args) {
+ this.args = args;
+ }
+}
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 73b21f5..57cad18 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
@@ -205,7 +205,7 @@ public class NewBitBakeFileRecipeWizard extends Wizard implements INewWizard {
public void run(IProgressMonitor monitor) throws InvocationTargetException {
try {
doFinish(element, monitor);
- RemoteHelper.runCommandRemote(connection, new YoctoCommand("rm -rf temp", element.getMetaDir() + "/temp", ""), monitor);
+ RemoteHelper.runCommandRemote(connection, new YoctoCommand("rm -rf temp", element.getMetaDir() + "/temp", ""));
} catch (Exception e) {
throw new InvocationTargetException(e);
} finally {
diff --git a/plugins/org.yocto.bc.ui/src/org/yocto/bc/ui/wizards/NewBitBakeFileRecipeWizardPage.java b/plugins/org.yocto.bc.ui/src/org/yocto/bc/ui/wizards/NewBitBakeFileRecipeWizardPage.java
index f1d90c9..e27619e 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
@@ -24,7 +24,6 @@ import org.eclipse.core.resources.IContainer;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.IResource;
import org.eclipse.core.resources.ResourcesPlugin;
-import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.NullProgressMonitor;
import org.eclipse.core.runtime.Path;
@@ -54,7 +53,7 @@ import org.yocto.bc.remote.utils.YoctoCommand;
public class NewBitBakeFileRecipeWizardPage extends WizardPage {
private Text containerText;
private Text fileText;
-
+
private Text descriptionText;
private Text licenseText;
private Text checksumText;
@@ -65,17 +64,17 @@ public class NewBitBakeFileRecipeWizardPage extends WizardPage {
private Text md5sumText;
private Text sha256sumText;
private Button btnPopulate;
-
+
private BitbakeRecipeUIElement element;
-
+
private ISelection selection;
private URI metaDirLoc;
private ArrayList<String> inheritance;

private IHost connection;
-
+
private String tempFolderPath;
-
+
public static final String TEMP_FOLDER_NAME = "temp";
public static final String TAR_BZ2_EXT = ".tar.bz2";
public static final String TAR_GZ_EXT = ".tar.gz";
@@ -98,7 +97,7 @@ public class NewBitBakeFileRecipeWizardPage extends WizardPage {
private static final String AUTOTOOLS = "autotools";
private static final String md5Pattern = "^[0-9a-f]{32}$";
protected static final String sha256Pattern = "^[0-9a-f]{64}$";
-
+
public NewBitBakeFileRecipeWizardPage(ISelection selection, IHost connection) {
super("wizardPage");
setTitle("BitBake Recipe");
@@ -107,9 +106,10 @@ public class NewBitBakeFileRecipeWizardPage extends WizardPage {
this.connection = connection;
this.element = new BitbakeRecipeUIElement();
this.inheritance = new ArrayList<String>();
-
+
}

+ @Override
public void createControl(Composite parent) {
final Composite container = new Composite(parent, SWT.NULL);
GridLayout layout = new GridLayout();
@@ -129,6 +129,7 @@ public class NewBitBakeFileRecipeWizardPage extends WizardPage {
gd = new GridData(GridData.FILL_HORIZONTAL);
containerText.setLayoutData(gd);
containerText.addModifyListener(new ModifyListener() {
+ @Override
public void modifyText(ModifyEvent e) {
dialogChanged();
}
@@ -142,12 +143,12 @@ public class NewBitBakeFileRecipeWizardPage extends WizardPage {
handleBrowse(container, containerText);
}
});
-
+
label = new Label(container, SWT.NULL);
gd = new GridData();
gd.horizontalSpan = 3;
label.setLayoutData(gd);
-
+
label = new Label(container, SWT.NULL);
label.setText("SRC_&URI:");

@@ -155,12 +156,13 @@ public class NewBitBakeFileRecipeWizardPage extends WizardPage {
gd = new GridData(GridData.FILL_HORIZONTAL);
txtSrcURI.setLayoutData(gd);
txtSrcURI.addModifyListener(new ModifyListener() {
+ @Override
public void modifyText(ModifyEvent e) {
if (txtSrcURI.getText().trim().isEmpty()) {
if (btnPopulate != null)
btnPopulate.setEnabled(false);
} else if (btnPopulate != null){
- btnPopulate.setEnabled(true);
+ btnPopulate.setEnabled(true);
}
dialogChanged();
}
@@ -182,7 +184,7 @@ public class NewBitBakeFileRecipeWizardPage extends WizardPage {
createField(container, "License File &Checksum:", (checksumText = new Text(container, SWT.BORDER | SWT.SINGLE)));
createField(container, "&Package Description:", (descriptionText = new Text(container, SWT.BORDER | SWT.SINGLE)));
createField(container, "&License:", (licenseText = new Text(container, SWT.BORDER | SWT.SINGLE)));
-
+
createField(container, "&Homepage:", (homepageText = new Text(container, SWT.BORDER | SWT.SINGLE)));
createField(container, "Package &Author:", (authorText = new Text(container, SWT.BORDER | SWT.SINGLE)));
createField(container, "&Section:", (sectionText = new Text(container, SWT.BORDER | SWT.SINGLE)));
@@ -190,7 +192,7 @@ public class NewBitBakeFileRecipeWizardPage extends WizardPage {
// ProxySettingsComposite proxySettings = new ProxySettingsComposite(container, SWT.NONE);
// proxySettings.setEnabled(true);
// proxySettings.setVisible(true);
-
+
initialize();
dialogChanged();
setControl(container);
@@ -200,12 +202,13 @@ public class NewBitBakeFileRecipeWizardPage extends WizardPage {
Label label = new Label(container, SWT.NONE);
label.setText(title);
label.moveAbove(control);
-
+
GridData gd = new GridData(GridData.FILL_HORIZONTAL);
gd.horizontalSpan = 2;
control.setLayoutData(gd);
control.addModifyListener(new ModifyListener() {

+ @Override
public void modifyText(ModifyEvent e) {
dialogChanged();
}
@@ -222,7 +225,7 @@ public class NewBitBakeFileRecipeWizardPage extends WizardPage {
updateStatus("Directory must be specified");
return;
}
-
+
if (container == null || (container.getType() & (IResource.PROJECT | IResource.FOLDER)) == 0) {
updateStatus("File container must exist");
return;
@@ -231,10 +234,10 @@ public class NewBitBakeFileRecipeWizardPage extends WizardPage {
updateStatus("Project must be writable");
return;
}
-
+
IProject project = container.getProject();
metaDirLoc = RemoteHelper.createNewURI(project.getLocationURI(), "meta");
-
+
if (fileName.length() == 0) {
updateStatus("File name must be specified");
return;
@@ -252,7 +255,7 @@ public class NewBitBakeFileRecipeWizardPage extends WizardPage {
updateStatus("Recipe must have a description");
return;
}
-
+
if (licenseText.getText().length() == 0) {
updateStatus("Recipe must have a license");
return;
@@ -261,7 +264,7 @@ public class NewBitBakeFileRecipeWizardPage extends WizardPage {
if (txtSrcURI.getText().length() == 0) {
updateStatus("SRC_URI can't be empty");
}
-
+
updateStatus(null);
}

@@ -281,7 +284,7 @@ public class NewBitBakeFileRecipeWizardPage extends WizardPage {
element.setMetaDir(metaDirLoc);
return element;
}
-
+
private void handleBrowse(final Composite parent, final Text text) {
ContainerSelectionDialog dialog = new ContainerSelectionDialog(getShell(), ResourcesPlugin.getWorkspace().getRoot(), false, "Select project directory");
if (dialog.open() == Window.OK) {
@@ -291,14 +294,14 @@ public class NewBitBakeFileRecipeWizardPage extends WizardPage {
}
}
}
-
+
private void handlePopulate() {
try {
IProgressMonitor monitor = new NullProgressMonitor();
URI srcURI = new URI(txtSrcURI.getText().trim());
String scheme = srcURI.getScheme();
String srcFileName = getSrcFileName(true);
- if ((scheme.equals(HTTP) || scheme.equals(FTP))
+ if ((scheme.equals(HTTP) || scheme.equals(FTP))
&& (srcFileName.endsWith(TAR_GZ_EXT) || srcFileName.endsWith(TAR_BZ2_EXT))) {
try {
handleRemotePopulate(srcURI, monitor);
@@ -315,7 +318,7 @@ public class NewBitBakeFileRecipeWizardPage extends WizardPage {
e.printStackTrace();
}
}
-
+
private void handleLocalPopulate(URI srcURI, IProgressMonitor monitor) {
populateLicenseFileChecksum(srcURI, monitor);
populateInheritance(srcURI, monitor);
@@ -326,43 +329,43 @@ public class NewBitBakeFileRecipeWizardPage extends WizardPage {

populateRecipeName(srcURI);
List<YoctoCommand> commands = new ArrayList<YoctoCommand>();
-
+
String metaDirLocPath = metaDirLoc.getPath();
commands.add(new YoctoCommand("rm -rf " + TEMP_FOLDER_NAME, metaDirLocPath, ""));
commands.add(new YoctoCommand( "mkdir " + TEMP_FOLDER_NAME, metaDirLocPath, ""));
updateTempFolderPath();
- commands.add(new YoctoCommand("wget " + srcURI.toURL(), tempFolderPath, ""));
-
- updateTempFolderPath();
-
+
+
try {
- RemoteHelper.runBatchRemote(connection, commands, monitor, true);
- } catch (CoreException e) {
+ commands.add(new YoctoCommand("wget " + srcURI.toURL(), tempFolderPath, ""));
+
+ updateTempFolderPath();
+ RemoteHelper.runBatchRemote(connection, commands, true);
+
+ commands.clear();
+
+ String md5Cmd = "md5sum " + getSrcFileName(true);
+ YoctoCommand md5YCmd = new YoctoCommand(md5Cmd, tempFolderPath, "");
+ RemoteHelper.runCommandRemote(connection, md5YCmd);
+
+ String sha256Cmd = "sha256sum " + getSrcFileName(true);
+ YoctoCommand sha256YCmd = new YoctoCommand(sha256Cmd, tempFolderPath, "");
+ RemoteHelper.runCommandRemote(connection, sha256YCmd);
+
+ URI extractDir = extractPackage(srcURI, monitor);
+ YoctoCommand licenseChecksumCmd = populateLicenseFileChecksum(extractDir, monitor);
+ updateSrcUri(createMirrorLookupTable(monitor), srcURI);
+ populateInheritance(extractDir, monitor);
+
+ String md5Val = retrieveSum(md5YCmd);
+ md5sumText.setText(Pattern.matches(md5Pattern, md5Val) ? md5Val : "");
+ String sha256Val = retrieveSum(sha256YCmd);
+ sha256sumText.setText(Pattern.matches(sha256Pattern, sha256Val) ? sha256Val : "");
+ String checkSumVal = retrieveSum(licenseChecksumCmd);
+ checksumText.setText(RemoteHelper.createNewURI(extractDir, COPYING_FILE).toString() + ";md5=" + (Pattern.matches(md5Pattern, checkSumVal) ? checkSumVal : ""));
+ } catch (Exception e) {
e.printStackTrace();
}
-
- commands.clear();
-
-
- String md5Cmd = "md5sum " + getSrcFileName(true);
- YoctoCommand md5YCmd = new YoctoCommand(md5Cmd, tempFolderPath, "");
- RemoteHelper.runCommandRemote(connection, md5YCmd, monitor);
-
- String sha256Cmd = "sha256sum " + getSrcFileName(true);
- YoctoCommand sha256YCmd = new YoctoCommand(sha256Cmd, tempFolderPath, "");
- RemoteHelper.runCommandRemote(connection, sha256YCmd, monitor);
-
- URI extractDir = extractPackage(srcURI, monitor);
- YoctoCommand licenseChecksumCmd = populateLicenseFileChecksum(extractDir, monitor);
- updateSrcUri(createMirrorLookupTable(monitor), srcURI);
- populateInheritance(extractDir, monitor);
-
- String md5Val = retrieveSum(md5YCmd);
- md5sumText.setText(Pattern.matches(md5Pattern, md5Val) ? md5Val : "");
- String sha256Val = retrieveSum(sha256YCmd);
- sha256sumText.setText(Pattern.matches(sha256Pattern, sha256Val) ? sha256Val : "");
- String checkSumVal = retrieveSum(licenseChecksumCmd);
- checksumText.setText(RemoteHelper.createNewURI(extractDir, COPYING_FILE).toString() + ";md5=" + (Pattern.matches(md5Pattern, checkSumVal) ? checkSumVal : ""));
}

private String retrieveSum(YoctoCommand cmd) {
@@ -384,31 +387,31 @@ public class NewBitBakeFileRecipeWizardPage extends WizardPage {
} else if(path.endsWith(TAR_GZ_EXT)){
tarCmd += "-xvf ";
}
-
- RemoteHelper.runCommandRemote(connection, new YoctoCommand(tarCmd + path, tempFolderPath, ""), monitor);
-
+
+ RemoteHelper.runCommandRemote(connection, new YoctoCommand(tarCmd + path, tempFolderPath, ""));
+
return RemoteHelper.createNewURI(metaDirLoc, TEMP_FOLDER_NAME + "/" + getSrcFileName(false));
-
+
} catch (Exception e) {
e.printStackTrace();
}
return null;
}
-
+
private void updateTempFolderPath(){
this.tempFolderPath = getMetaFolderPath() + TEMP_FOLDER_NAME + "/";
}
-
+
private String getMetaFolderPath(){
String sep = metaDirLoc.getPath().endsWith("/")? "" : "/";
return metaDirLoc.getPath() + sep;
}
-
+
private void populateInheritance(URI extractDir, IProgressMonitor monitor) {
IHostFile[] hostFiles = RemoteHelper.getRemoteDirContent(connection, metaDirLoc.getPath(), "", IFileService.FILE_TYPE_FILES, monitor);
if (hostFiles == null)
return;
-
+
for (IHostFile file: hostFiles) {
String fileName = file.getName();
if (fileName.equalsIgnoreCase(CMAKE_LIST)){
@@ -420,21 +423,21 @@ public class NewBitBakeFileRecipeWizardPage extends WizardPage {
}
}
}
-
+
private YoctoCommand populateLicenseFileChecksum(URI extractDir, IProgressMonitor monitor) {
if (extractDir == null)
throw new RuntimeException("Something went wrong during source extraction!");
-
+
try {
YoctoCommand catCmd = new YoctoCommand("md5sum " + COPYING_FILE, extractDir.getPath(), "");
- RemoteHelper.runCommandRemote(connection, catCmd, monitor);
+ RemoteHelper.runCommandRemote(connection, catCmd);
return catCmd;
} catch (Exception e) {
throw new RuntimeException("Unable to process file for MD5 calculation", e);
}
-
+
}
-
+
private String getSrcFileName(boolean withExt){
URI srcURI;
try {
@@ -455,48 +458,13 @@ public class NewBitBakeFileRecipeWizardPage extends WizardPage {
}
return "";
}
-
-
-
-// private void populateSrcUriChecksum(URI srcUri, IProgressMonitor monitor) {
-// try {
-// String rmCmd = "rm -rf " + TEMP_FOLDER_NAME;
-// RemoteHelper.handleRunCommandRemote(connection, metaDirLoc.getPath(), rmCmd, "", monitor, cmdHandler);
-
-// String mkdirCmd = "mkdir " + TEMP_FOLDER_NAME;
-// updateTempFolderPath();
-// RemoteHelper.handleRunCommandRemote(connection, metaDirLoc.getPath(), mkdirCmd, "", monitor, cmdHandler);
-
-
-// String wgetCmd = "wget " + srcUri.toURL();
-// RemoteHelper.handleRunCommandRemote(connection, tempFolderPath, rmCmd + APPEND_CH + mkdirCmd + APPEND_CH + wgetCmd, "", monitor, cmdHandler);
-//
-// String md5Cmd = "md5sum " + getSrcFileName(true);
-// ProcessStreamBuffer md5SumBuffer = RemoteHelper.handleRunCommandRemote(connection, tempFolderPath, md5Cmd, "", monitor, cmdHandler);
-// String line = md5SumBuffer.getLastOutputLineContaining(getSrcFileName(true));
-// if (line != null) {
-// String[] md5SumTokens = line.split(WHITESPACES);
-// md5sumText.setText(md5SumTokens[0]);
-// }
-//
-// String sha256Cmd = "sha256sum " + getSrcFileName(true);
-// ProcessStreamBuffer sha256SumBuffer = RemoteHelper.handleRunCommandRemote(connection, tempFolderPath, sha256Cmd, "", monitor, cmdHandler);
-// line = sha256SumBuffer.getLastOutputLineContaining(getSrcFileName(true));
-// if (line != null) {
-// String[] sha256SumTokens = line.split(WHITESPACES);
-// sha256sumText.setText(sha256SumTokens[0]);
-// }
-// } catch (Exception e) {
-// e.printStackTrace();
-// }
-// }
-
+
private HashMap<String, String> createMirrorLookupTable(IProgressMonitor monitor) throws Exception {
HashMap<String, String> mirrorMap = new HashMap<String, String>();
-
+
YoctoCommand cmd = new YoctoCommand("cat " + MIRRORS_FILE, getMetaFolderPath() + CLASSES_FOLDER, "");
- RemoteHelper.runCommandRemote(connection, cmd, monitor);
-
+ RemoteHelper.runCommandRemote(connection, cmd);
+
if (!cmd.getProcessBuffer().hasErrors()){
String delims = "[\\t]+";
List<String> outputLines = cmd.getProcessBuffer().getOutputLines();
@@ -512,42 +480,42 @@ public class NewBitBakeFileRecipeWizardPage extends WizardPage {
}
return mirrorMap;
}
-
+
private void populateRecipeName(URI srcUri) {
String fileName = fileText.getText();
- if (!fileName.isEmpty())
+ if (!fileName.isEmpty())
return;
-
+
String recipeFile = getSrcFileName(false).replace("-", "_");
recipeFile += BB_RECIPE_EXT;
if (recipeFile != null)
fileText.setText(recipeFile);
}
-
+
private void updateSrcUri(HashMap<String, String> mirrorsMap, URI srcUri) {
Set<String> mirrors = mirrorsMap.keySet();
Iterator<String> iter = mirrors.iterator();
String mirror_key = null;
String srcURL = srcUri.toString();
-
- while (iter.hasNext()) {
- String value = (String)iter.next();
- if (srcURL.startsWith(value)) {
- mirror_key = value;
- break;
- }
- }
-
- if (mirror_key != null) {
- String replace_string = (String)mirrorsMap.get(mirror_key);
- if (replace_string != null)
- srcURL = replace_string + srcURL.substring(mirror_key.length());
- }
- int idx = srcURL.lastIndexOf("-");
- String new_src_uri = srcURL.substring(0, idx)+"-${PV}" + TAR_GZ_EXT;
- txtSrcURI.setText(new_src_uri);
+
+ while (iter.hasNext()) {
+ String value = iter.next();
+ if (srcURL.startsWith(value)) {
+ mirror_key = value;
+ break;
+ }
+ }
+
+ if (mirror_key != null) {
+ String replace_string = mirrorsMap.get(mirror_key);
+ if (replace_string != null)
+ srcURL = replace_string + srcURL.substring(mirror_key.length());
+ }
+ int idx = srcURL.lastIndexOf("-");
+ String new_src_uri = srcURL.substring(0, idx)+"-${PV}" + TAR_GZ_EXT;
+ txtSrcURI.setText(new_src_uri);
}
-
+
private void initialize() {
if (selection != null && selection.isEmpty() == false && selection instanceof IStructuredSelection) {
IStructuredSelection ssel = (IStructuredSelection) selection;
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 d780cbf..77f4d2c 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
@@ -5,16 +5,13 @@ import java.net.URI;
import java.util.Hashtable;
import java.util.Map;

-import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Status;
-import org.eclipse.jface.operation.IRunnableWithProgress;
-import org.eclipse.jface.operation.ModalContext;
import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.jface.wizard.IWizardContainer;
import org.eclipse.jface.wizard.WizardPage;
import org.eclipse.ptp.remote.core.IRemoteConnection;
import org.eclipse.ptp.remote.core.IRemoteServices;
-import org.eclipse.ptp.remote.core.exception.RemoteConnectionException;
import org.eclipse.rse.core.model.IHost;
import org.eclipse.ui.IWorkbench;
import org.eclipse.ui.IWorkbenchWizard;
@@ -22,7 +19,7 @@ import org.eclipse.ui.console.MessageConsole;
import org.yocto.bc.remote.utils.CommandResponseHandler;
import org.yocto.bc.remote.utils.ConsoleWriter;
import org.yocto.bc.remote.utils.RemoteHelper;
-import org.yocto.bc.remote.utils.YoctoCommand;
+import org.yocto.bc.remote.utils.YoctoRunnableWithProgress;
import org.yocto.bc.ui.Activator;
import org.yocto.bc.ui.model.ProjectInfo;
import org.yocto.bc.ui.wizards.FiniteStateWizard;
@@ -106,24 +103,35 @@ public class InstallWizard extends FiniteStateWizard implements IWorkbenchWizard
page.setPageComplete(true);
Map<String, Object> options = model;

-
try {
URI uri = new URI("");
if (options.containsKey(INSTALL_DIRECTORY)) {
uri = (URI) options.get(INSTALL_DIRECTORY);
}
+ 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);

if (((Boolean)options.get(GIT_CLONE)).booleanValue()) {
- String[] cmd = {"/usr/bin/git clone --progress", "git://git.yoctoproject.org/poky.git", uri.getPath()};
-// String[] cmd = {"md5sum /home/builder/socks-gw"};
- LongtimeRunningTask runningTask = new LongtimeRunningTask("Checking out Yocto git repository", cmd,
- ((IRemoteConnection)model.get(InstallWizard.SELECTED_CONNECTION)),
- ((IRemoteServices)model.get(InstallWizard.SELECTED_REMOTE_SERVICE)));
- ModalContext.setAllowReadAndDispatch(false);
- this.getContainer().run(false, false, runningTask);
+ 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) {
+ e.printStackTrace();
+ } catch (InterruptedException e) {
+ e.printStackTrace();
+ }
}
-
- CommandResponseHandler cmdHandler = RemoteHelper.getCommandHandler(RemoteHelper.getRemoteConnectionByName(((IRemoteConnection)model.get(InstallWizard.SELECTED_CONNECTION)).getName()));
if (!cmdHandler.hasError()) {
String initPath = "";
if (uri.getPath() != null) {
@@ -136,28 +144,25 @@ public class InstallWizard extends FiniteStateWizard implements IWorkbenchWizard
pinfo.setInitScriptPath(initPath);
pinfo.setLocation(uri);
pinfo.setName(prjName);
- IRemoteConnection remConn = (IRemoteConnection) model.get(InstallWizard.SELECTED_CONNECTION);
- IHost connection = RemoteHelper.getRemoteConnectionByName(remConn.getName());
pinfo.setConnection(connection);
- pinfo.setRemoteServices((IRemoteServices) model.get(InstallWizard.SELECTED_REMOTE_SERVICE));
+ pinfo.setRemoteServices(remoteServices);

ConsoleWriter cw = new ConsoleWriter();
- this.getContainer().run(false, false, new BBConfigurationInitializeOperation(pinfo, cw));
+ this.getContainer().run(true, true, new BBConfigurationInitializeOperation(pinfo, cw));
console = RemoteHelper.getConsole(connection);
console.newMessageStream().println(cw.getContents());

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

- this.getContainer().run(false, false, new CreateBBCProjectOperation(pinfo));
+ this.getContainer().run(true, true, new CreateBBCProjectOperation(pinfo));
return true;
-
}
+ return true;
} catch (Exception e) {
Activator.getDefault().getLog().log(new Status(IStatus.ERROR, Activator.PLUGIN_ID,
IStatus.ERROR, e.getMessage(), e));
- this.getContainer().getCurrentPage().setDescription(
- "Failed to create project: " + e.getMessage());
+ this.getContainer().getCurrentPage().setDescription("Failed to create project: " + e.getMessage());
}
return false;
}
@@ -165,66 +170,4 @@ public class InstallWizard extends FiniteStateWizard implements IWorkbenchWizard
public void init(IWorkbench workbench, IStructuredSelection selection) {
}

- private class LongtimeRunningTask implements IRunnableWithProgress {
- static public final int TOTALWORKLOAD = 100;
-
- private String []cmdArray;
- private String taskName;
- private IRemoteConnection connection;
- private IRemoteServices remoteServices;
-
- public LongtimeRunningTask(String taskName,
- String []cmdArray,
- IRemoteConnection connection, IRemoteServices remoteServices) {
- this.taskName = taskName;
- this.cmdArray = cmdArray;
- this.connection = connection;
- this.remoteServices = remoteServices;
- }
-
- synchronized public void run(IProgressMonitor monitor)
- throws InvocationTargetException, InterruptedException {
-// boolean cancel = false;
- try {
- monitor.beginTask(taskName, TOTALWORKLOAD);
-
- if (!connection.isOpen()) {
- try {
- connection.open(monitor);
- } catch (RemoteConnectionException e1) {
- e1.printStackTrace();
- }
- }
-
- if (!remoteServices.isInitialized()) {
- remoteServices.initialize();
- }
-
- String args = "";
- for (int i = 1; i < cmdArray.length; i++)
- args += cmdArray[i] + " ";
- try {
-// while (!cancel) {
-// if(monitor.isCanceled()) {
-// cancel=true;
-// throw new InterruptedException("User Cancelled");
-// }
- RemoteHelper.runCommandRemote(RemoteHelper.getRemoteConnectionByName(connection.getName()), new YoctoCommand(cmdArray[0], "", args), monitor);
-// if (hasErrors)
-// break;
-
-// Thread.sleep(5000);
-// }
- } catch (Exception e) {
- e.printStackTrace();
- } finally {
- monitor.done();
- }
- } catch (Exception e) {
- e.printStackTrace();
- }
- }
- }
-
-
}
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 e5ebd1b..fcc939c 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
@@ -63,12 +63,7 @@ public class CreateBBCProjectOperation extends WorkspaceModifyOperation {
private IProjectDescription createProjectDescription(IWorkspace workspace, ProjectInfo projInformation) throws CoreException {
IProjectDescription desc = workspace.newProjectDescription(projInformation.getProjectName());

-// try {
-// desc.setLocationURI(new URI(OEFS_SCHEME + projInfo2.getRootPath()));
- desc.setLocationURI(projInformation.getURI());
-// } catch (URISyntaxException e) {
-// throw new CoreException(new Status(IStatus.ERROR, Activator.PLUGIN_ID, "Unable to load filesystem.", e));
-// }
+ desc.setLocationURI(projInformation.getURI());

return desc;
}
--
1.7.9.5


[PATCH 0/8] [eclipse-poky-windows] Resending patches targeting fixes for Windows plugin

Ioana Grigoropol <ioanax.grigoropol@...>
 

- files modified under Windows are CRLF ended -> convert them to CR only and apply patch 0007 with --keep-cr

Ioana Grigoropol (8):
Show progress bar for New Bitbake Commander project
Show progress bar for building new Recipe in Bitbake commander
perspective
Validate project name and location for Bitbake command project
Fix incompatibility with jre1.6 support for typed HashMap
Remove validation for existing git repository
Fix synchronous waiting for command prompt in Linux & connection lost
when restarting
convert CRLF line terminators to CR only
Validate Bitbake Commander project when switching between new repo
and existing one

.../src/org/yocto/bc/bitbake/BBSession.java | 2 +
.../src/org/yocto/bc/bitbake/ShellSession.java | 132 +++-----
.../yocto/bc/remote/utils/ProcessStreamBuffer.java | 17 +-
.../org/yocto/bc/remote/utils/RemoteHelper.java | 161 +++++-----
.../org/yocto/bc/remote/utils/RemoteMachine.java | 4 +-
.../remote/utils/YoctoHostShellProcessAdapter.java | 162 +++++-----
.../bc/remote/utils/YoctoRunnableWithProgress.java | 106 +++++++
.../src/org/yocto/bc/ui/Activator.java | 79 ++---
.../src/org/yocto/bc/ui/model/ProjectInfo.java | 4 +
.../org/yocto/bc/ui/wizards/FiniteStateWizard.java | 112 +++----
.../yocto/bc/ui/wizards/FiniteStateWizardPage.java | 320 ++++++++++----------
.../bc/ui/wizards/NewBitBakeFileRecipeWizard.java | 7 +-
.../ui/wizards/NewBitBakeFileRecipeWizardPage.java | 300 +++++++++---------
.../yocto/bc/ui/wizards/install/InstallWizard.java | 113 ++-----
.../yocto/bc/ui/wizards/install/OptionsPage.java | 184 +++++------
.../BBConfigurationInitializeOperation.java | 6 +-
.../newproject/CreateBBCProjectOperation.java | 31 +-
17 files changed, 823 insertions(+), 917 deletions(-)
create mode 100644 plugins/org.yocto.bc.ui/src/org/yocto/bc/remote/utils/YoctoRunnableWithProgress.java

--
1.7.9.5


Re: mail list for Xilinx Zynq platform?

Andreas Schweigstill <andreas@...>
 

Hello!

Am Mi, 12/05/2012 19:17, hat Philip Balister <philip@...> geschrieben:
On 12/05/2012 05:21 AM, Andreas Schweigstill wrote:
meta-zynq/recipes-kernel-linux-zynq contains the following lines:
LINUX_VERSION ?= "3.5"
LINUX_VERSION_EXTENSION ?= "-xilinx"

How can I force Yocto to build kernel 3.5-xilinx?
Urg, I'll have to take a look at that.
After changing the order of BBLAYERS in build/conf/local.conf to meta, meta-zynq,
meta-yocto, meta-yocto-bsp and using Hob to select MACHINE=zynq-zc702,
base image=zc702-proto-image everything works fine. Now I get a proper toolchain
for Cortex A9 and a kernel named zynq-zc702 3.5.0-14.3-build1-yocto-standard
which is properly running on my ZC702 board.

Also, you'll need an updated fsbl in the BOOT.BIN file to work with the
later kernels. We should probably post one somewhere, although I wish
the fsbl license was a little less restrictive.
I haven't built a BOOT.BIN file with Yocto based U-Boot yet. Instead I'm using
U-Boot from Petalinux 12.9 which is configured to use the QSPI Flash to store its
environment.

Currently I boot from QSPI Flash, load kernel und DTB files via TFTP and use a
root filesystem stored on a SD card. ;-)

Regards,
Andreas Schweigstill

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


[PATCH][meta-ivi] pango: Remove bbappend as upstream removed its dependency to gnome-common

Andrei Gherzan
 

Signed-off-by: Andrei Gherzan <andrei.gherzan@...>
---
recipes-graphics/pango/pango_1.30.0.bbappend | 8 --------
1 files changed, 0 insertions(+), 8 deletions(-)
delete mode 100644 recipes-graphics/pango/pango_1.30.0.bbappend

diff --git a/recipes-graphics/pango/pango_1.30.0.bbappend b/recipes-graphics/pango/pango_1.30.0.bbappend
deleted file mode 100644
index b2323e6..0000000
--- a/recipes-graphics/pango/pango_1.30.0.bbappend
+++ /dev/null
@@ -1,8 +0,0 @@
-PRINC = "1"
-
-# gnome-common is GPLv3 so we drop this dependency
-# if INCOMPATIBLE_LICENSE contains GPLv3
-python () {
- if (d.getVar("INCOMPATIBLE_LICENSE", True) or "").find("GPLv3") != -1:
- d.setVar("DEPENDS", " ".join(i for i in d.getVar("DEPENDS").split() if i != "gnome-common"))
-}
--
1.7.5.4


uboot i.MX6

Tim Verstraete <Tim.Verstraete@...>
 

Hi everybody,

 

I have build the i.MX6 with danny release of yocto and latest freescale meta using the core-image-minimal image for imx6qsabresd target machine è result is build has done everything BUT I when I upload my uboot to my sd card I get nothing. When I change uboot to the image from the freescale website everything runs …

 

So this means the kernel and root file system are just fine, only uboot is not ok. My uboot is about half the size of the freescale uboot.

 

Do I need to do anything special for uboot to run on my device?

 

Thanks in advance,

 

Kind regards,

 

Tim

 


Issue of external toolchain usage in Yocto

Luo Zhenhua-B19537 <B19537@...>
 

I tried to use CS external toolchain to build images in Yocto, I met following issue when doing configure for package.

configure:2728: checking for powerpc-linux-gnu-gcc -m32 -mcpu=8548 -mabi=spe -mspe -mfloat-gprs=double --sysroot=/home/yocto/poky/build_bsc9131rdb_release/tmp/sysroots/bsc9131rdb-tcbootstrap option to accept ISO C89
configure:2802: powerpc-linux-gnu-gcc -m32 -mcpu=8548 -mabi=spe -mspe -mfloat-gprs=double --sysroot=/home/yocto/poky/build_bsc9131rdb_release/tmp/sysroots/bsc9131rdb-tcbootstrap -c -isystem/opt/freescale/usr/local/gcc-4.5.55-eglibc-2.11.55/powerpc-linux-gnu/powerpc-fsl-linux-gnuspe/include -I/home/yocto/poky/build_bsc9131rdb_release/tmp/sysroots/bsc9131rdb -O2 -pipe -g -feliminate-unused-debug-types conftest.c >&5
conftest.c:9:19: fatal error: stdio.h: No such file or directory

Firstly I run above compile command manually, it failed as following:
$ /opt/freescale/usr/local/gcc-4.5.55-eglibc-2.11.55/powerpc-linux-gnu/bin/powerpc-linux-gnu-gcc -m32 -mcpu=8548 -mabi=spe -mspe -mfloat-gprs=double --sysroot=/home/yocto/poky/build_bsc9131rdb_release/tmp/sysroots/bsc9131rdb-tcbootstrap -c -isystem/opt/freescale/usr/local/gcc-4.5.55-eglibc-2.11.55/powerpc-linux-gnu/powerpc-fsl-linux-gnuspe/include -I/home/yocto/poky/build_bsc9131rdb_release/tmp/sysroots/bsc9131rdb -O2 -pipe -g -feliminate-unused-debug-types conftest.c
conftest.c:10:19: fatal error: stdio.h: No such file or directory
compilation terminated.

Secondly I removed --sysroot flag, the build process passed.
$ /opt/freescale/usr/local/gcc-4.5.55-eglibc-2.11.55/powerpc-linux-gnu/bin/powerpc-linux-gnu-gcc -m32 -mcpu=8548 -mabi=spe -mspe -mfloat-gprs=double -c -isystem/opt/freescale/usr/local/gcc-4.5.55-eglibc-2.11.55/powerpc-linux-gnu/powerpc-fsl-linux-gnuspe/include -I/home/yocto/poky/build_bsc9131rdb_release/tmp/sysroots/bsc9131rdb -O2 -pipe -g -feliminate-unused-debug-types conftest.c

I also used the toolchain built by Yocto, the same issue happened.

I did following change in meta/conf/distro/include/tcmode-external-csl.inc, is there anything missing to use external toolchain in Yocto?
-EXTERNAL_TOOLCHAIN ?= "/usr/local/csl/${TARGET_ARCH}"
+EXTERNAL_TOOLCHAIN ?= "/opt/freescale/usr/local/gcc-4.5.55-eglibc-2.11.55/powerpc-linux-gnu"

Content of my contest.c:
#define PACKAGE_NAME "module-init-tools"
#define PACKAGE_TARNAME "module-init-tools"
#define PACKAGE_VERSION "3.16"
#define PACKAGE_STRING "module-init-tools 3.16"
#define PACKAGE_BUGREPORT ""
#define PACKAGE_URL ""
#define PACKAGE "module-init-tools"
#define VERSION "3.16"

#include <stdio.h>

int main ()
{
;
return 0;
}


Best Regards,

Zhenhua


Re: Difference of toolchain recipes

Luo Zhenhua-B19537 <B19537@...>
 

Can anybody shed some light, please?


Best Regards,

Zhenhua

-----Original Message-----
From: Luo Zhenhua-B19537
Sent: Tuesday, December 04, 2012 11:53 AM
To: openembedded-core@...; 'yocto@...'
Subject: Difference of toolchain recipes

It is a bit confused for the different recipes of toolchian, can somebody
help to explain what's the difference for those recipes? E.g. gcc-cross,
gcc-cross-canadian, gcc-cross-initial, gcc-cross-intermediate, gcc-
crosssdk, gcc-crosssdk-initial, gcc-crosssdk-intermediate, gcc-runtime,
etc.

Is there any document for those description?


Best Regards,

Zhenhua


[PATCH 3/3] documentation: Add chunk.quietly option to eclipse processing

mail@...
 

From: Timo Mueller <timo.mueller@...>

The chunk.quietly option disables the output of the docbook
chunker. Creation of a new html file is now longer printed to the
console. This provides a much cleaner output of the eclipse makefile
target.
---
.../adt-manual-eclipse-customization.xsl | 1 +
.../bsp-guide/bsp-guide-eclipse-customization.xsl | 1 +
.../dev-manual-eclipse-customization.xsl | 1 +
.../kernel-manual-eclipse-customization.xsl | 1 +
.../poky-ref-manual-eclipse-customization.xsl | 1 +
.../yocto-project-qs-eclipse-customization.xsl | 1 +
6 files changed, 6 insertions(+), 0 deletions(-)

diff --git a/documentation/adt-manual/adt-manual-eclipse-customization.xsl b/documentation/adt-manual/adt-manual-eclipse-customization.xsl
index ff1464e..d16ffbb 100644
--- a/documentation/adt-manual/adt-manual-eclipse-customization.xsl
+++ b/documentation/adt-manual/adt-manual-eclipse-customization.xsl
@@ -9,6 +9,7 @@
href="http://docbook.sourceforge.net/release/xsl/current/eclipse/eclipse3.xsl" />

<xsl:param name="chunker.output.indent" select="'yes'"/>
+ <xsl:param name="chunk.quietly" select="1"/>
<xsl:param name="chunk.first.sections" select="1"/>
<xsl:param name="chunk.section.depth" select="10"/>
<xsl:param name="use.id.as.filename" select="1"/>
diff --git a/documentation/bsp-guide/bsp-guide-eclipse-customization.xsl b/documentation/bsp-guide/bsp-guide-eclipse-customization.xsl
index b9aceb2..1c80bee 100644
--- a/documentation/bsp-guide/bsp-guide-eclipse-customization.xsl
+++ b/documentation/bsp-guide/bsp-guide-eclipse-customization.xsl
@@ -9,6 +9,7 @@
href="http://docbook.sourceforge.net/release/xsl/current/eclipse/eclipse3.xsl" />

<xsl:param name="chunker.output.indent" select="'yes'"/>
+ <xsl:param name="chunk.quietly" select="1"/>
<xsl:param name="chunk.first.sections" select="1"/>
<xsl:param name="chunk.section.depth" select="10"/>
<xsl:param name="use.id.as.filename" select="1"/>
diff --git a/documentation/dev-manual/dev-manual-eclipse-customization.xsl b/documentation/dev-manual/dev-manual-eclipse-customization.xsl
index ff1de89..8ac4c18 100644
--- a/documentation/dev-manual/dev-manual-eclipse-customization.xsl
+++ b/documentation/dev-manual/dev-manual-eclipse-customization.xsl
@@ -9,6 +9,7 @@
href="http://docbook.sourceforge.net/release/xsl/current/eclipse/eclipse3.xsl" />

<xsl:param name="chunker.output.indent" select="'yes'"/>
+ <xsl:param name="chunk.quietly" select="1"/>
<xsl:param name="chunk.first.sections" select="1"/>
<xsl:param name="chunk.section.depth" select="10"/>
<xsl:param name="use.id.as.filename" select="1"/>
diff --git a/documentation/kernel-manual/kernel-manual-eclipse-customization.xsl b/documentation/kernel-manual/kernel-manual-eclipse-customization.xsl
index 70a1e19..7992173 100644
--- a/documentation/kernel-manual/kernel-manual-eclipse-customization.xsl
+++ b/documentation/kernel-manual/kernel-manual-eclipse-customization.xsl
@@ -9,6 +9,7 @@
href="http://docbook.sourceforge.net/release/xsl/current/eclipse/eclipse3.xsl" />

<xsl:param name="chunker.output.indent" select="'yes'"/>
+ <xsl:param name="chunk.quietly" select="1"/>
<xsl:param name="chunk.first.sections" select="1"/>
<xsl:param name="chunk.section.depth" select="10"/>
<xsl:param name="use.id.as.filename" select="1"/>
diff --git a/documentation/poky-ref-manual/poky-ref-manual-eclipse-customization.xsl b/documentation/poky-ref-manual/poky-ref-manual-eclipse-customization.xsl
index 4e31193..3412208 100644
--- a/documentation/poky-ref-manual/poky-ref-manual-eclipse-customization.xsl
+++ b/documentation/poky-ref-manual/poky-ref-manual-eclipse-customization.xsl
@@ -9,6 +9,7 @@
href="http://docbook.sourceforge.net/release/xsl/current/eclipse/eclipse3.xsl" />

<xsl:param name="chunker.output.indent" select="'yes'"/>
+ <xsl:param name="chunk.quietly" select="1"/>
<xsl:param name="chunk.first.sections" select="1"/>
<xsl:param name="chunk.section.depth" select="10"/>
<xsl:param name="use.id.as.filename" select="1"/>
diff --git a/documentation/yocto-project-qs/yocto-project-qs-eclipse-customization.xsl b/documentation/yocto-project-qs/yocto-project-qs-eclipse-customization.xsl
index 468508b..f8f8930 100644
--- a/documentation/yocto-project-qs/yocto-project-qs-eclipse-customization.xsl
+++ b/documentation/yocto-project-qs/yocto-project-qs-eclipse-customization.xsl
@@ -10,6 +10,7 @@
<xsl:import href="yocto-project-qs-titlepage.xsl"/>

<xsl:param name="chunker.output.indent" select="'yes'"/>
+ <xsl:param name="chunk.quietly" select="1"/>
<xsl:param name="use.id.as.filename" select="1"/>
<xsl:param name="ulink.target" select="'_self'" />
<xsl:param name="base.dir" select="'html/yocto-project-qs/'"/>
--
1.7.7.6


[PATCH 2/3] documentation/tools/eclipse-help.sed: Fix whitespace

mail@...
 

From: Timo Mueller <timo.mueller@...>

---
documentation/tools/eclipse-help.sed | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/documentation/tools/eclipse-help.sed b/documentation/tools/eclipse-help.sed
index 71d3395..38690bc 100644
--- a/documentation/tools/eclipse-help.sed
+++ b/documentation/tools/eclipse-help.sed
@@ -1,12 +1,12 @@
# Processes poky-ref-manual and yocto-project-qs manual (<word>-<word>-<word> style)
# For example:
-# "ulink" href="http://www.yoctoproject.org/docs/1.3/poky-ref-manual/poky-ref-manual.html#faq"
+# "ulink" href="http://www.yoctoproject.org/docs/1.3/poky-ref-manual/poky-ref-manual.html#faq"
# -> "link" href="../poky-ref-manual/faq.html"
s/\"ulink\" href=\"http:\/\/www.yoctoproject.org\/docs\/[^\/]*\/\([a-z]*-[a-z]*-[a-z]*\)\/[a-z]*-[a-z]*-[a-z]*.html#\([^\"]*\)\"/\"link\" href=\"\.\.\/\1\/\2.html\"/g

# Processes all other manuals (<word>-<word> style)
# For example:
-# "ulink" href="http://www.yoctoproject.org/docs/1.3/kernel-manual/kernel-manual.html#faq"
+# "ulink" href="http://www.yoctoproject.org/docs/1.3/kernel-manual/kernel-manual.html#faq"
# -> "link" href="../kernel-manual/faq.html"
s/\"ulink\" href=\"http:\/\/www.yoctoproject.org\/docs\/[^\/]*\/\([a-z]*-[a-z]*\)\/[a-z]*-[a-z]*.html#\([^\"]*\)\"/\"link\" href=\"\.\.\/\1\/\2.html\"/g

--
1.7.7.6


[PATCH 1/3] documentation/Makefile: Fix copying of figures folder

mail@...
 

From: Timo Mueller <timo.mueller@...>

When calling the eclipse target twice without calling clean in between
the figures folder was copied as a subfolder of the existing figures
folder. This patch fixes the copy command to correctly copy the
figures folder.
---
documentation/Makefile | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/documentation/Makefile b/documentation/Makefile
index 7da14a4..ddef079 100644
--- a/documentation/Makefile
+++ b/documentation/Makefile
@@ -291,7 +291,7 @@ else
-o eclipse/$(DOC).html \
$(DOC)-eclipse-customization.xsl $(DOC).xml && \
mv eclipse/toc.xml eclipse/$(DOC)-toc.xml && \
- cp -rf $(FIGURES) eclipse/$(BASE_DIR)/$(FIGURES) && \
+ cp -rf $(FIGURES) eclipse/$(BASE_DIR) && \
cd ..;

$(call modify-eclipse)
--
1.7.7.6


[PATCH 0/3][yocto-docs] Collected fixes to the eclipe help generation

mail@...
 

From: Timo Mueller <timo.mueller@...>

Hi,

these are some minor fixes for the eclipse help generation currently located
in the timo branch of the yocto-docs repository.

1: Fixes an issue with the figures folder when eclipse target was called
consecutively without cleaning in between
2: Whitespace fix
3: Enable chunk.quietly to provide cleaner console logs

Best regards,
Timo

Timo Mueller (3):
documentation/Makefile: Fix copying of figures folder
documentation/tools/eclipse-help.sed: Fix whitespace
documentation: Add chunk.quietly option to eclipse processing

documentation/Makefile | 2 +-
.../adt-manual-eclipse-customization.xsl | 1 +
.../bsp-guide/bsp-guide-eclipse-customization.xsl | 1 +
.../dev-manual-eclipse-customization.xsl | 1 +
.../kernel-manual-eclipse-customization.xsl | 1 +
.../poky-ref-manual-eclipse-customization.xsl | 1 +
documentation/tools/eclipse-help.sed | 4 ++--
.../yocto-project-qs-eclipse-customization.xsl | 1 +
8 files changed, 9 insertions(+), 3 deletions(-)

--
1.7.7.6


Re: [PATCH] Fix incompatibility with jre1.6 support for typed HashMap

Grigoropol, IoanaX <ioanax.grigoropol@...>
 

Hi Jessica,

Have you applied the three patches I have sent before these ones ? There are related to updating the progress bars in the Bitbake project & recipe as well as regarding the validation of new project location and name ([PATCH 0/3] [eclipse-poky] Eclipse plugin on Windows - fixes for progress update on wizards & input validation).

Thanks,
Ioana

-----Original Message-----
From: Zhang, Jessica
Sent: Thursday, December 06, 2012 1:12 AM
To: Grigoropol, IoanaX; yocto@...
Subject: RE: [yocto] [PATCH] Fix incompatibility with jre1.6 support for typed HashMap

Hi Ioana,

None of your patches of today apply so there seems to be some rebase issue. Also, I've added headless build support changes for windows BC plugin, so can you rebase against jzhang/windows-build and resubmit the patch series?

Thanks,
Jessica

-----Original Message-----
From: yocto-bounces@... [mailto:yocto-bounces@...] On Behalf Of Ioana Grigoropol
Sent: Wednesday, December 05, 2012 2:41 AM
To: yocto@...
Subject: [yocto] [PATCH] Fix incompatibility with jre1.6 support for typed HashMap

Signed-off-by: Ioana Grigoropol <ioanax.grigoropol@...>
---
.../remote/utils/YoctoHostShellProcessAdapter.java | 18 ++++++++++++------
1 file changed, 12 insertions(+), 6 deletions(-)

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 9ab43cf..2dba0a6 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/YoctoHostShe
+++ llProcessAdapter.java
@@ -34,6 +34,7 @@ public class YoctoHostShellProcessAdapter extends HostShellProcessAdapter {

private Semaphore sem;

+
public YoctoHostShellProcessAdapter(IHostShell hostShell, ProcessStreamBuffer processStreamBuffer, CommandResponseHandler commandResponseHandler) throws IOException {
super(hostShell);
this.processStreamBuffer = processStreamBuffer; @@ -41,7 +42,7 @@ public class YoctoHostShellProcessAdapter extends HostShellProcessAdapter {
this.calculator = new GitCalculatePercentage();
this.sem = new Semaphore(1);
this.command = "";
- this.commandMonitors = new HashMap<>();
+ this.commandMonitors = new HashMap<String, IProgressMonitor>();
}

public String getLastCommand() {
@@ -50,7 +51,7 @@ public class YoctoHostShellProcessAdapter extends HostShellProcessAdapter {

public synchronized void setLastCommand(String lastCommand) {
try {
- // there are still some processes that might take a long time and if we do not wait for them,
+ // there are still some processes that might take a long time and if
+we do not wait for them,
// then the semaphore will not be released, because an interrupted exception will occur
Thread.sleep(2000);
isFinished = false;
@@ -70,6 +71,7 @@ public class YoctoHostShellProcessAdapter extends HostShellProcessAdapter {

private class GitCalculatePercentage implements ICalculatePercentage {
final Pattern pattern = Pattern.compile("^Receiving objects:\\s*(\\d+)%.*");
+ @Override
public float calWorkloadDone(String info) throws IllegalArgumentException {
Matcher m = pattern.matcher(info.trim());
if(m.matches()) {
@@ -88,13 +90,16 @@ public class YoctoHostShellProcessAdapter extends HostShellProcessAdapter {
}

private void updateMonitor(final int work){
+
Display.getDefault().asyncExec(new Runnable() {
+
@Override
public void run() {
if (getMonitor() != null) {
getMonitor().worked(work);
}
}
+
});
}

@@ -124,7 +129,7 @@ public class YoctoHostShellProcessAdapter extends HostShellProcessAdapter {
updateMonitor(delta);
reportedWorkload += delta;
}
-
+
if (reportedWorkload == RemoteHelper.TOTALWORKLOAD)
doneMonitor();
}
@@ -152,8 +157,9 @@ public class YoctoHostShellProcessAdapter extends HostShellProcessAdapter {
continue;
}
setCommandPrompt(value);
+
if (commandPrompt != null && endChar != null && command != null && processStreamBuffer != null &&
- value.startsWith(commandPrompt) && value.endsWith(endChar) &&
+ value.startsWith(commandPrompt) && value.endsWith(endChar) &&
!value.endsWith(command) && processStreamBuffer.getLastOutputLineContaining(command) != null /*&& waitForOutput*/) {
sem.release();
isFinished = true;
@@ -165,7 +171,7 @@ public class YoctoHostShellProcessAdapter extends HostShellProcessAdapter {
this.commandResponseHandler.response(value, false);
}
}
-
+
}
private void setCommandPrompt(String value) {
if (commandPrompt == null) {
@@ -178,7 +184,7 @@ public class YoctoHostShellProcessAdapter extends HostShellProcessAdapter {
commandPrompt = value.substring(0, end);
endChar = PROMPT_USER_CH;
}
-
+
}
}
public boolean isFinished() {
--
1.7.9.5

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


Re: [PATCH 0/1] Misc: detect trailing space in the patches

Daniel Stone <daniel@...>
 

Hi,

On 6 December 2012 15:23, Martin Jansa <martin.jansa@...> wrote:

Can you add also detection of mixed whitespace? E.g. tab followed by space in multilinear indentation? Only as warning. Thanks


These checks can generate infuriating false positives when your patch modifies upstream code which has trailing or mixed whitespace in either context or removal lines; in this case, removing a line with trailing whitespace and replacing it with one which doesn't would generate a warning.  Mixed whitespace is also part of some coding styles, notably the kernel's.

Cheers,
Daniel 


Re: [PATCH 0/1] Misc: detect trailing space in the patches

Martin Jansa
 

Can you add also detection of mixed whitespace? E.g. tab followed by space in multilinear indentation? Only as warning. Thanks

On Dec 6, 2012 12:38 AM, <nitin.a.kamble@...> wrote:

From: Nitin A Kamble <nitin.a.kamble@...>

This commit is for detecting trailing white space in the create-pull-request script.

Thanks,
Nitin

The following changes since commit 381c4b69c7e8b452f4d3de2f8214e6e5f6a9abe7:

  sstate.bbclass: fix detection of owners matching sstate files (2012-12-05 15:34:07 +0000)

are available in the git repository at:
  git://git.pokylinux.org/poky-contrib nitin/misc
  http://git.pokylinux.org/cgit.cgi/poky-contrib/log/?h=nitin/misc

Nitin A Kamble (1):
  create-pull-request: detect trailing white space

 scripts/create-pull-request |   13 ++++++++++++-
 1 files changed, 12 insertions(+), 1 deletions(-)

--
1.7.3.4

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