diff mbox

[U-Boot,7/8] buildman: Allow the toolchain architecture to be specified

Message ID 1457318739-22993-7-git-send-email-sjg@chromium.org
State Accepted
Commit 608e399fdef82e983db44c5cb8f5e772bba870e2
Delegated to: Simon Glass
Headers show

Commit Message

Simon Glass March 7, 2016, 2:45 a.m. UTC
At present the architecture is deduced from the toolchain filename. Allow it
to be specified by the caller.

Signed-off-by: Simon Glass <sjg@chromium.org>
---

 tools/buildman/toolchain.py | 17 ++++++++++++-----
 1 file changed, 12 insertions(+), 5 deletions(-)

Comments

Joe Hershberger March 7, 2016, 4:58 p.m. UTC | #1
On Sun, Mar 6, 2016 at 8:45 PM, Simon Glass <sjg@chromium.org> wrote:
> At present the architecture is deduced from the toolchain filename. Allow it
> to be specified by the caller.
>
> Signed-off-by: Simon Glass <sjg@chromium.org>

Reviewed-by: Joe Hershberger <joe.hershberger@ni.com
Simon Glass March 13, 2016, 1:52 a.m. UTC | #2
On 7 March 2016 at 09:58, Joe Hershberger <joe.hershberger@gmail.com> wrote:
> On Sun, Mar 6, 2016 at 8:45 PM, Simon Glass <sjg@chromium.org> wrote:
>> At present the architecture is deduced from the toolchain filename. Allow it
>> to be specified by the caller.
>>
>> Signed-off-by: Simon Glass <sjg@chromium.org>
>
> Reviewed-by: Joe Hershberger <joe.hershberger@ni.com

Applied to u-boot-dm/next
diff mbox

Patch

diff --git a/tools/buildman/toolchain.py b/tools/buildman/toolchain.py
index 1874d73..7bcc0af 100644
--- a/tools/buildman/toolchain.py
+++ b/tools/buildman/toolchain.py
@@ -54,7 +54,8 @@  class Toolchain:
                 component of the filename. E.g. arm-linux-gcc becomes arm
         priority: Toolchain priority (0=highest, 20=lowest)
     """
-    def __init__(self, fname, test, verbose=False, priority=PRIORITY_CALC):
+    def __init__(self, fname, test, verbose=False, priority=PRIORITY_CALC,
+                 arch=None):
         """Create a new toolchain object.
 
         Args:
@@ -75,7 +76,10 @@  class Toolchain:
 
         # The architecture is the first part of the name
         pos = self.cross.find('-')
-        self.arch = self.cross[:pos] if pos != -1 else 'sandbox'
+        if arch:
+            self.arch = arch
+        else:
+            self.arch = self.cross[:pos] if pos != -1 else 'sandbox'
 
         env = self.MakeEnvironment(False)
 
@@ -92,7 +96,8 @@  class Toolchain:
             if verbose:
                 print 'Tool chain test: ',
                 if self.ok:
-                    print 'OK, priority %d' % self.priority
+                    print "OK, arch='%s', priority %d" % (self.arch,
+                                                          self.priority)
                 else:
                     print 'BAD'
                     print 'Command: ', cmd
@@ -179,7 +184,8 @@  class Toolchains:
     def GetSettings(self):
       self.paths += self.GetPathList()
 
-    def Add(self, fname, test=True, verbose=False, priority=PRIORITY_CALC):
+    def Add(self, fname, test=True, verbose=False, priority=PRIORITY_CALC,
+            arch=None):
         """Add a toolchain to our list
 
         We select the given toolchain as our preferred one for its
@@ -189,8 +195,9 @@  class Toolchains:
             fname: Filename of toolchain's gcc driver
             test: True to run the toolchain to test it
             priority: Priority to use for this toolchain
+            arch: Toolchain architecture, or None if not known
         """
-        toolchain = Toolchain(fname, test, verbose, priority)
+        toolchain = Toolchain(fname, test, verbose, priority, arch)
         add_it = toolchain.ok
         if toolchain.arch in self.toolchains:
             add_it = (toolchain.priority <