Resending patches targeting fixes for Windows plugin
cover Resending patches targeting fixes for Windows plugin
- 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
Signature · 1 line
1.7.9.5
PATCH 1/8 Show progress bar for New Bitbake Commander project
- 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
--- .../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
plugins/org.yocto.bc.ui/src/org/yocto/bc/bitbake/ShellSession.java +5 -19
@@ -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 { - } - - } - } +
plugins/org.yocto.bc.ui/src/org/yocto/bc/remote/utils/ProcessStreamBuffer.java +2 -1
@@ -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;
plugins/org.yocto.bc.ui/src/org/yocto/bc/remote/utils/RemoteHelper.java +31 -61
116 lines not on this page · raw message
plugins/org.yocto.bc.ui/src/org/yocto/bc/remote/utils/RemoteMachine.java +3 -1
@@ -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();
plugins/org.yocto.bc.ui/src/org/yocto/bc/remote/utils/YoctoHostShellProcessAdapter.java +68 -69
216 lines not on this page · raw message
plugins/org.yocto.bc.ui/src/org/yocto/bc/remote/utils/YoctoRunnableWithProgress.java new file +106 -0
106 lines not on this page · raw message
plugins/org.yocto.bc.ui/src/org/yocto/bc/ui/wizards/NewBitBakeFileRecipeWizard.java +1 -1
@@ -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 {
plugins/org.yocto.bc.ui/src/org/yocto/bc/ui/wizards/NewBitBakeFileRecipeWizardPage.java +95 -127
442 lines not on this page · raw message
plugins/org.yocto.bc.ui/src/org/yocto/bc/ui/wizards/install/InstallWizard.java +28 -85
169 lines not on this page · raw message
plugins/org.yocto.bc.ui/src/org/yocto/bc/ui/wizards/newproject/CreateBBCProjectOperation.java +1 -6
@@ -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; }
Signature · 1 line
1.7.9.5
PATCH 2/8 Show progress bar for building new Recipe in Bitbake commander perspective
In reply to Ioana Grigoropol--- .../ui/wizards/NewBitBakeFileRecipeWizardPage.java | 119 +++++++++++++------- 1 file changed, 78 insertions(+), 41 deletions(-)
plugins/org.yocto.bc.ui/src/org/yocto/bc/ui/wizards/NewBitBakeFileRecipeWizardPage.java +78 -41
@@ -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);
Signature · 1 line
1.7.9.5
PATCH 3/8 Validate project name and location for Bitbake command project
In reply to Ioana 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
--- .../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(-)
plugins/org.yocto.bc.ui/src/org/yocto/bc/bitbake/ShellSession.java +26 -68
@@ -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; } - -} +}
plugins/org.yocto.bc.ui/src/org/yocto/bc/remote/utils/RemoteHelper.java +35 -34
202 lines not on this page · raw message
plugins/org.yocto.bc.ui/src/org/yocto/bc/remote/utils/YoctoHostShellProcessAdapter.java +5 -10
@@ -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 { } } -
plugins/org.yocto.bc.ui/src/org/yocto/bc/ui/wizards/install/OptionsPage.java +93 -85
351 lines not on this page · raw message
plugins/org.yocto.bc.ui/src/org/yocto/bc/ui/wizards/newproject/BBConfigurationInitializeOperation.java +4 -2
@@ -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); }
plugins/org.yocto.bc.ui/src/org/yocto/bc/ui/wizards/newproject/CreateBBCProjectOperation.java +10 -14
@@ -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; }
Signature · 1 line
1.7.9.5
PATCH 4/8 Fix incompatibility with jre1.6 support for typed HashMap
In reply to Ioana Grigoropol--- .../remote/utils/YoctoHostShellProcessAdapter.java | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-)
plugins/org.yocto.bc.ui/src/org/yocto/bc/remote/utils/YoctoHostShellProcessAdapter.java +12 -6
@@ -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() {
Signature · 1 line
1.7.9.5
PATCH 5/8 Remove validation for existing git repository
In reply to Ioana Grigoropol--- .../yocto/bc/ui/wizards/install/OptionsPage.java | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-)
plugins/org.yocto.bc.ui/src/org/yocto/bc/ui/wizards/install/OptionsPage.java +5 -5
@@ -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()) {
Signature · 1 line
1.7.9.5
PATCH 6/8 Fix synchronous waiting for command prompt in Linux & connection lost when restarting
In reply to Ioana Grigoropol- when waiting for an command to finish running, we wait to receive a command prompt using the syntax [email protected]. 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
--- .../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(-)
plugins/org.yocto.bc.ui/src/org/yocto/bc/bitbake/BBSession.java +2 -0
@@ -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;
plugins/org.yocto.bc.ui/src/org/yocto/bc/bitbake/ShellSession.java +8 -16
@@ -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(); }
plugins/org.yocto.bc.ui/src/org/yocto/bc/remote/utils/ProcessStreamBuffer.java +7 -7
@@ -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; } }
plugins/org.yocto.bc.ui/src/org/yocto/bc/remote/utils/RemoteHelper.java +9 -5
@@ -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();
plugins/org.yocto.bc.ui/src/org/yocto/bc/remote/utils/YoctoHostShellProcessAdapter.java +1 -27
@@ -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; }
plugins/org.yocto.bc.ui/src/org/yocto/bc/ui/Activator.java +22 -57
170 lines not on this page · raw message
plugins/org.yocto.bc.ui/src/org/yocto/bc/ui/model/ProjectInfo.java +4 -0
@@ -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; }
plugins/org.yocto.bc.ui/src/org/yocto/bc/ui/wizards/NewBitBakeFileRecipeWizard.java +2 -5
@@ -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 {
plugins/org.yocto.bc.ui/src/org/yocto/bc/ui/wizards/NewBitBakeFileRecipeWizardPage.java +5 -10
@@ -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) {
Signature · 1 line
1.7.9.5
PATCH 7/8 convert CRLF line terminators to CR only
In reply to Ioana Grigoropol--- .../org/yocto/bc/ui/wizards/FiniteStateWizard.java | 112 +++---- .../yocto/bc/ui/wizards/FiniteStateWizardPage.java | 320 ++++++++++---------- 2 files changed, 216 insertions(+), 216 deletions(-)
plugins/org.yocto.bc.ui/src/org/yocto/bc/ui/wizards/FiniteStateWizard.java +56 -56
@@ -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(); +}
plugins/org.yocto.bc.ui/src/org/yocto/bc/ui/wizards/FiniteStateWizardPage.java +160 -160
320 lines not on this page · raw message
Signature · 1 line
1.7.9.5
PATCH 8/8 Validate Bitbake Commander project when switching between new repo and existing one
In reply to Ioana Grigoropol--- .../yocto/bc/ui/wizards/FiniteStateWizardPage.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
plugins/org.yocto.bc.ui/src/org/yocto/bc/ui/wizards/FiniteStateWizardPage.java +1 -1
@@ -106,7 +106,7 @@ public abstract class FiniteStateWizardPage extends WizardPage { * @see org.eclipse.swt.events.SelectionListener#widgetSelected(org.eclipse.swt.events.SelectionEvent) */ public void widgetSelected(SelectionEvent e) { -// validate(); + validate(); } /*
Signature · 1 line
1.7.9.5