]> git.kernelconcepts.de Git - karo-tx-uboot.git/commitdiff
buildman: Allow architecture to alias to multiple toolchains
authorSimon Glass <sjg@chromium.org>
Tue, 2 Dec 2014 00:34:05 +0000 (17:34 -0700)
committerSimon Glass <sjg@chromium.org>
Thu, 15 Jan 2015 05:16:54 +0000 (21:16 -0800)
Some archs have need than one alias, so support a list of alises in the
..buildman file.

Signed-off-by: Simon Glass <sjg@chromium.org>
tools/buildman/README
tools/buildman/test.py
tools/buildman/toolchain.py

index 865390a6f351d7c279c1d9b4cfb5358c2935fb88..849e6ca7630193e586bf1733cd3b5244fed160f3 100644 (file)
@@ -701,8 +701,9 @@ a set of (tag, value) pairs.
 
     This converts toolchain architecture names to U-Boot names. For example,
     if an x86 toolchains is called i386-linux-gcc it will not normally be
-    used for architecture 'x86'. Adding 'x86: i386' to this section will
-    tell buildman that the i386 toolchain can be used for x86.
+    used for architecture 'x86'. Adding 'x86: i386 x86_64' to this section
+    will tell buildman that the i386 and x86_64 toolchains can be used for
+    the x86 architecture.
 
 '[make-flags]' section
 
index d19f6ea3d6c6ecab976bfad2d4cff510a097664e..25be43ff7dcda5f4308b61afa94a1e5d6b0dd7a5 100644 (file)
@@ -394,5 +394,20 @@ class TestBuild(unittest.TestCase):
         build.commit_count = 0
         self.CheckDirs(build, '')
 
+    def testToolchainAliases(self):
+        self.assertTrue(self.toolchains.Select('arm') != None)
+        with self.assertRaises(ValueError):
+            self.toolchains.Select('no-arch')
+        with self.assertRaises(ValueError):
+            self.toolchains.Select('x86')
+
+        self.toolchains = toolchain.Toolchains()
+        self.toolchains.Add('x86_64-linux-gcc', test=False)
+        self.assertTrue(self.toolchains.Select('x86') != None)
+
+        self.toolchains = toolchain.Toolchains()
+        self.toolchains.Add('i386-linux-gcc', test=False)
+        self.assertTrue(self.toolchains.Select('x86') != None)
+
 if __name__ == "__main__":
     unittest.main()
index cb693f4641831315d295c2f9c3886817374bf5bd..ad4df8cc9bacfc6d87fc42a9b95c7f3c7cef18f9 100644 (file)
@@ -185,9 +185,11 @@ class Toolchains:
         returns:
             toolchain object, or None if none found
         """
-        for name, value in bsettings.GetItems('toolchain-alias'):
-            if arch == name:
-                arch = value
+        for tag, value in bsettings.GetItems('toolchain-alias'):
+            if arch == tag:
+                for alias in value.split():
+                    if alias in self.toolchains:
+                        return self.toolchains[alias]
 
         if not arch in self.toolchains:
             raise ValueError, ("No tool chain found for arch '%s'" % arch)