base and sanity bbclasses + qemu: move gcc3 availability checking into base.bbclass...
authorMarcin Juszkiewicz <hrw@openembedded.org>
Thu, 3 Jan 2008 15:23:12 +0000 (15:23 +0000)
committerMarcin Juszkiewicz <hrw@openembedded.org>
Thu, 3 Jan 2008 15:23:12 +0000 (15:23 +0000)
classes/base.bbclass
classes/sanity.bbclass
packages/qemu/qemu-gcc3-check.inc

index 2b508a8..e0b4c59 100644 (file)
@@ -902,6 +902,23 @@ python () {
     base_after_parse(d)
 }
 
+def check_app_exists(app, d):
+       from bb import which, data
+
+       app = data.expand(app, d)
+       path = data.getVar('PATH', d)
+       return len(which(path, app)) != 0
+
+def check_gcc3(data):
+
+       gcc3_versions = 'gcc-3.4 gcc34 gcc-3.4.4 gcc-3.4.6 gcc-3.4.7 gcc-3.3 gcc33 gcc-3.3.6 gcc-3.2 gcc32'
+
+       for gcc3 in gcc3_versions.split():
+               if check_app_exists(gcc3, data):
+                       return gcc3
+       
+       return False
+
 # Patch handling
 inherit patch
 
index cc413b7..9994feb 100644 (file)
@@ -24,14 +24,6 @@ def check_conf_exists(fn, data):
                        return True
        return False
 
-def check_app_exists(app, d):
-       from bb import which, data
-
-       app = data.expand(app, d)
-       path = data.getVar('PATH', d)
-       return len(which(path, app)) != 0
-
-
 def check_sanity(e):
        from bb import note, error, data, __version__
        from bb.event import Handled, NotHandled, getName
index 658e72f..81c3555 100644 (file)
@@ -4,19 +4,8 @@ python __anonymous() {
     path = data.getVar('PATH', d, 1)
     oldOeConf = data.getVar('EXTRA_OECONF', d, 1)
     if not oldOeConf: oldOeConf = ""
-    if len(which(path, 'gcc-3.4.4')) != 0:
-        data.setVar('EXTRA_OECONF', oldOeConf + " --cc=gcc-3.4.4", d)
-    elif len(which(path, 'gcc-3.4')) != 0:
-        data.setVar('EXTRA_OECONF', oldOeConf + " --cc=gcc-3.4", d)
-    elif len(which(path, 'gcc34')) != 0:
-        data.setVar('EXTRA_OECONF', oldOeConf + " --cc=gcc34", d)
-    elif len(which(path, 'gcc33')) != 0:
-        data.setVar('EXTRA_OECONF', oldOeConf + " --cc=gcc33", d)
-    elif len(which(path, 'gcc-3.3')) != 0:
-        data.setVar('EXTRA_OECONF', oldOeConf + " --cc=gcc-3.3", d)
-    elif len(which(path, 'gcc-3.3.6')) != 0:
-        data.setVar('EXTRA_OECONF', oldOeConf + " --cc=gcc-3.3.6", d)
-    elif len(which(path, 'gcc-3.4.6')) != 0:
-        data.setVar('EXTRA_OECONF', oldOeConf + " --cc=gcc-3.4.6", d)
+    gcc3 = check_gcc3(d)
+    if gcc3:
+       data.setVar('EXTRA_OECONF', oldOeConf + " --cc=" + gcc3, d)
 }