Signed-off-by: Dmitry Eremin-Solenikov <dbarysh...@gmail.com>
---
 .../meta/external-toolchain-angstrom.bb            |   38 ++++++++++++++------
 1 files changed, 27 insertions(+), 11 deletions(-)

diff --git a/recipes-devtools/meta/external-toolchain-angstrom.bb 
b/recipes-devtools/meta/external-toolchain-angstrom.bb
index e730455..cb7f2c3 100644
--- a/recipes-devtools/meta/external-toolchain-angstrom.bb
+++ b/recipes-devtools/meta/external-toolchain-angstrom.bb
@@ -138,33 +138,46 @@ DESCRIPTION_gdbserver = "gdb - GNU debugger"
 
 def ang_get_main_version(d):
        import os,bb
-       if os.path.exists(bb.data.getVar('TOOLCHAIN_PATH', d, 1)+'/version'):
-               f = open(bb.data.getVar('TOOLCHAIN_PATH', d, 1)+'/version', 'r')
+       tp = bb.data.getVar('TOOLCHAIN_PATH', d, 1)
+       if tp == None:
+               return ""
+       if os.path.exists(tp+'/version'):
+               f = open(tp +'/version', 'r')
                l = f.readlines();
                f.close();
                for s in l:
                        if s.find('Version') > 0:
                                ver = s.split()[2]
                                return ver
-               return None
+               return ""
+       return ""
 
 def ang_get_gcc_version(d):
        import subprocess,os,bb
-       if os.path.exists(bb.data.getVar('TOOLCHAIN_PATH', d, 
1)+'/bin/'+bb.data.getVar('TARGET_PREFIX', d, 1)+'gcc'):
-               return subprocess.Popen([bb.data.getVar('TOOLCHAIN_PATH', d, 
1)+'/bin/'+bb.data.getVar('TARGET_PREFIX', d, 1)+'gcc', '-v'], 
stderr=subprocess.PIPE).communicate()[1].splitlines()[-1].split()[2]
+       tp = bb.data.getVar('TOOLCHAIN_PATH', d, 1)
+       if tp == None:
+               return ""
+       if os.path.exists(tp+'/bin/'+bb.data.getVar('TARGET_PREFIX', d, 
1)+'gcc'):
+               return 
subprocess.Popen([tp+'/bin/'+bb.data.getVar('TARGET_PREFIX', d, 1)+'gcc', 
'-v'], stderr=subprocess.PIPE).communicate()[1].splitlines()[-1].split()[2]
 
 def ang_get_libc_version(d):
        import os,bb
-       if os.path.exists(bb.data.getVar('TOOLCHAIN_SYSPATH', d, 1)+'/lib/'):
-               for file in os.listdir(bb.data.getVar('TOOLCHAIN_SYSPATH', d, 
1)+'/lib/'):
+       tsp = bb.data.getVar('TOOLCHAIN_SYSPATH', d, 1)
+       if tsp == None:
+               return ""
+       if os.path.exists(tsp+'/lib/'):
+               for file in os.listdir(tsp+'/lib/'):
                        if file.find('libc-') == 0:
                                return file[5:-3]
                return None
 
 def ang_get_kernel_version(d):
        import os,bb
-       if os.path.exists(bb.data.getVar('TOOLCHAIN_SYSPATH', d, 
1)+'/usr/include/linux/'):
-               f = open(bb.data.getVar('TOOLCHAIN_SYSPATH', d, 
1)+'/usr/include/linux/version.h', 'r')
+       tsp = bb.data.getVar('TOOLCHAIN_SYSPATH', d, 1)
+       if tsp == None:
+               return ""
+       if os.path.exists(tsp+'/usr/include/linux/'):
+               f = open(tsp+'/usr/include/linux/version.h', 'r')
                l = f.readlines();
                f.close();
                for s in l:
@@ -179,8 +192,11 @@ def ang_get_kernel_version(d):
 
 def ang_get_gdb_version(d):
        import subprocess,os,bb
-       if os.path.exists(bb.data.getVar('TOOLCHAIN_PATH', d, 
1)+'/bin/'+bb.data.getVar('TARGET_PREFIX', d, 1)+'gdb'):
-               return subprocess.Popen([bb.data.getVar('TOOLCHAIN_PATH', d, 
1)+'/bin/'+bb.data.getVar('TARGET_PREFIX', d, 1)+'gdb', 
'-v'],stdout=subprocess.PIPE).communicate()[0].splitlines()[0].split()[-1]
+       tp = bb.data.getVar('TOOLCHAIN_PATH', d, 1)
+       if tp == None:
+               return ""
+       if os.path.exists(tp+'/bin/'+bb.data.getVar('TARGET_PREFIX', d, 
1)+'gdb'):
+               return 
subprocess.Popen([tp+'/bin/'+bb.data.getVar('TARGET_PREFIX', d, 1)+'gdb', 
'-v'],stdout=subprocess.PIPE).communicate()[0].splitlines()[0].split()[-1]
 
 ANG_VER_MAIN := "${@ang_get_main_version(d)}"
 ANG_VER_GCC := "${@ang_get_gcc_version(d)}"
-- 
1.7.2.5


_______________________________________________
Angstrom-distro-devel mailing list
Angstrom-distro-devel@linuxtogo.org
http://lists.linuxtogo.org/cgi-bin/mailman/listinfo/angstrom-distro-devel

Reply via email to