diff options
author | Ken Gilmer <kgilmer@gmail.com> | 2011-07-01 18:43:37 +0900 |
---|---|---|
committer | Ken Gilmer <kgilmer@gmail.com> | 2011-07-01 18:43:37 +0900 |
commit | 26c8f3d57ff23246545b65b87d679534a9423210 (patch) | |
tree | 77a24e9631a8c89075bf6dad68df50253323bbf9 /org.openembedded.bc.ui/src/org/openembedded/bc/ui/actions/AbstractBitbakeCommandAction.java | |
parent | 4c892e2bef2f65a92ec24defd224e1c91ce844c5 (diff) | |
download | eclipsetools-26c8f3d57ff23246545b65b87d679534a9423210.tar.gz |
OTE: all actions against bitbake now use package name-version instead of
directly referencing the recipe file.
Diffstat (limited to 'org.openembedded.bc.ui/src/org/openembedded/bc/ui/actions/AbstractBitbakeCommandAction.java')
-rw-r--r-- | org.openembedded.bc.ui/src/org/openembedded/bc/ui/actions/AbstractBitbakeCommandAction.java | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/org.openembedded.bc.ui/src/org/openembedded/bc/ui/actions/AbstractBitbakeCommandAction.java b/org.openembedded.bc.ui/src/org/openembedded/bc/ui/actions/AbstractBitbakeCommandAction.java index 406c887..484c8a6 100644 --- a/org.openembedded.bc.ui/src/org/openembedded/bc/ui/actions/AbstractBitbakeCommandAction.java +++ b/org.openembedded.bc.ui/src/org/openembedded/bc/ui/actions/AbstractBitbakeCommandAction.java @@ -205,5 +205,34 @@ public abstract class AbstractBitbakeCommandAction implements IWorkbenchWindowAc action.setEnabled(false); } + + /** + * @param path Path to recipe file + * @return The recipe name that bitbake will understand, based on a full path to a recipe file. + */ + protected 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 |