aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKen Gilmer <kgilmer@gmail.com>2011-06-25 13:47:38 +0900
committerKen Gilmer <kgilmer@gmail.com>2011-06-25 13:47:38 +0900
commite8efeeb77a0d584b2542e0a2631f9e66c2b2f1b8 (patch)
tree5ac13985a6370d5b3aa95c764272822ffee2a925
parentde324a5fca37889afba76c0b357ffb7034a67f89 (diff)
downloadeclipsetools-e8efeeb77a0d584b2542e0a2631f9e66c2b2f1b8.tar.gz
bitbake commander: Build a recipe without specifing "-b" option, as
that no longer seems to work with bitbake 1.10. Change-Id: Id9db9a4b8b5ef469fcb12eef3e07e87e390ef7ed
-rw-r--r--org.openembedded.bc.ui/src/org/openembedded/bc/ui/actions/BitbakeBuildRecipeAction.java33
1 files changed, 32 insertions, 1 deletions
diff --git a/org.openembedded.bc.ui/src/org/openembedded/bc/ui/actions/BitbakeBuildRecipeAction.java b/org.openembedded.bc.ui/src/org/openembedded/bc/ui/actions/BitbakeBuildRecipeAction.java
index e8f6708..073ee8b 100644
--- a/org.openembedded.bc.ui/src/org/openembedded/bc/ui/actions/BitbakeBuildRecipeAction.java
+++ b/org.openembedded.bc.ui/src/org/openembedded/bc/ui/actions/BitbakeBuildRecipeAction.java
@@ -10,15 +10,46 @@
*******************************************************************************/
package org.openembedded.bc.ui.actions;
+import org.eclipse.core.resources.IFile;
+
public class BitbakeBuildRecipeAction extends AbstractBitbakeCommandAction {
@Override
public String [] getCommands() {
- return new String[] {"bitbake -b " + recipe.getLocationURI().getPath()};
+ return new String[] {"bitbake " + getRecipeFromIFile(recipe)};
}
@Override
public String getJobTitle() {
return "Building " + recipe.getName();
}
+
+ /**
+ * @param path Path to recipe file
+ * @return The recipe name that bitbake will understand, based on a full path to a recipe file.
+ */
+ private static String getRecipeFromIFile(IFile path) {
+ String bbRecipeExtension = ".bb";
+ if (!path.getName().endsWith(bbRecipeExtension))
+ throw new RuntimeException("File is not a bitbake recipe: " + path.getName());
+
+ //Extract the filename without the extension.
+ String name = path.getName().substring(0, path.getName().length() - bbRecipeExtension.length());
+
+ String [] nvp = name.split("_");
+
+ if (nvp.length == 0)
+ throw new RuntimeException("Unable to parse recipe name from filename: " + name);
+
+ //No version information embedded in the filename
+ if (nvp.length == 1)
+ return nvp[0];
+
+ //Use bitbake's convention for specifying the version with a "-"
+ if (nvp.length == 2)
+ return nvp[0] + "-" + nvp[1];
+
+ //Unknown format, just return the name
+ return nvp[0];
+ }
} \ No newline at end of file