All of lore.kernel.org
 help / color / mirror / Atom feed
* Patch to poky-eclipse
@ 2012-08-31 12:36 Björn Arnelid
  0 siblings, 0 replies; only message in thread
From: Björn Arnelid @ 2012-08-31 12:36 UTC (permalink / raw)
  To: yocto


[-- Attachment #1.1: Type: text/plain, Size: 838 bytes --]

Hi, I hope this is the right place to send a patch, if not could someone pleace point me in the right direction for sending patches.

YoctoSDKUtils: Avoid NullPointerException when setting Yocto Properties

[Yocto Bugzilla] -- https://bugzilla.yoctoproject.org/show_bug.cgi?id=3019

When using a Toolchain where sysroot is not named <arch>-pokysdk-linux a NullPointerException is thrown when trying to apply changes in Yocto Preferences.
It should be possible to use Toolchains with a sysroot named <arch>-<organizationName>sdk-linux with the plugin.

static private String findHostArch(File sysroot_dir) now accept folders named *sdk-linux instead of *-pokysdk-linux. checkYoctoSDK will also return SDKCheckResults.TOOLCHAIN_NO_SYSROOT if findHostArch returns null.


Signed-off-by: Björn Arnelid <bjorn.arnelid@enea.com>


[-- Attachment #1.2: Type: text/html, Size: 1287 bytes --]

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-YoctoSDKUtils-Avoid-NullPointerException-when-settin.patch --]
[-- Type: text/x-patch; name="0001-YoctoSDKUtils-Avoid-NullPointerException-when-settin.patch", Size: 2773 bytes --]

From f8f4961f7b5d44ae92bf9b578955f40ae2342179 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Bj=C3=B6rn=20Arnelid?= <bjar@bjar-Latitude-D630.(none)>
Date: Fri, 31 Aug 2012 14:31:03 +0200
Subject: [PATCH] YoctoSDKUtils: Avoid NullPointerException when setting Yocto
 Properties
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

[Yocto Bugzilla] -- https://bugzilla.yoctoproject.org/show_bug.cgi?id=3019

When using a Toolchain where sysroot is not named <arch>-pokysdk-linux a NullPointerException is thrown when trying to apply changes in Yocto Preferences.
It should be possible to use Toolchains with a sysroot named <arch>-<organizationName>sdk-linux with the plugin.

static private String findHostArch(File sysroot_dir) now accept folders named *sdk-linux instead of *-pokysdk-linux. checkYoctoSDK will also return SDKCheckResults.TOOLCHAIN_NO_SYSROOT if findHostArch returns null.

Signed-off-by: Björn Arnelid <bjorn.arnelid@enea.com>
---
 .../src/org/yocto/sdk/ide/YoctoSDKUtils.java       |   20 +++++++++++++++-----
 1 file changed, 15 insertions(+), 5 deletions(-)

diff --git a/plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/YoctoSDKUtils.java b/plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/YoctoSDKUtils.java
index 6be90be..749fac7 100644
--- a/plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/YoctoSDKUtils.java
+++ b/plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/YoctoSDKUtils.java
@@ -100,7 +100,17 @@ public class YoctoSDKUtils {
 			File sysroot_dir = new File(sysroot_dir_str);
 			if (!sysroot_dir.exists())
 				return SDKCheckResults.TOOLCHAIN_NO_SYSROOT;
-			String toolchain_host_arch = findHostArch(sysroot_dir);
+			
+			String toolchain_host_arch = null;
+			
+			try 
+			{
+				toolchain_host_arch = findHostArch(sysroot_dir);
+			}
+			catch(NullPointerException e) 
+			{
+				return SDKCheckResults.TOOLCHAIN_NO_SYSROOT;
+			}
 			
 			if (!toolchain_host_arch.equalsIgnoreCase(platform)) {
 				if (!platform.matches("i\\d86") || !toolchain_host_arch.matches("i\\d86"))
@@ -576,7 +586,7 @@ public class YoctoSDKUtils {
 	static private String findHostArch(File sysroot_dir) {
 		FilenameFilter nativeFilter = new FilenameFilter() {
 			public boolean accept(File dir, String name) {
-				if (name.endsWith("-pokysdk-linux")) {
+				if (name.endsWith("sdk-linux")) {
 					return true;
 				} else {
 					return false;
@@ -590,11 +600,11 @@ public class YoctoSDKUtils {
 		for (File file : files) {
 			if (file.isDirectory()) {
 				String path = file.getName();
-				arch = path.substring(0, path.indexOf("-pokysdk-linux"));
+				String[] subPath = path.split("-");
+				arch = subPath[0];
 			} else 
 				continue;
         }
 		return arch;
 	}
-}
-
+}
\ No newline at end of file
-- 
1.7.9.5


^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2012-08-31 12:36 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-08-31 12:36 Patch to poky-eclipse Björn Arnelid

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.