X-Git-Url: https://git.sur5r.net/?a=blobdiff_plain;f=tools%2Fbuildman%2Ftoolchain.py;h=4b35f400e97d61cd9bc7d445b4c378e6e246d5d5;hb=8f48cf9f1758a2c5cef05381401184959af64a69;hp=41e4e4c5350e8159748ea27be84111055fa5c6cc;hpb=7351bf2b5b35819104d7c84ba8fd7d72eea544ee;p=u-boot diff --git a/tools/buildman/toolchain.py b/tools/buildman/toolchain.py index 41e4e4c535..4b35f400e9 100644 --- a/tools/buildman/toolchain.py +++ b/tools/buildman/toolchain.py @@ -1,7 +1,6 @@ +# SPDX-License-Identifier: GPL-2.0+ # Copyright (c) 2012 The Chromium OS Authors. # -# SPDX-License-Identifier: GPL-2.0+ -# import re import glob @@ -33,7 +32,7 @@ class MyHTMLParser(HTMLParser): HTMLParser.__init__(self) self.arch_link = None self.links = [] - self._match = '_%s-' % arch + self.re_arch = re.compile('[-_]%s-' % arch) def handle_starttag(self, tag, attrs): if tag == 'a': @@ -41,7 +40,7 @@ class MyHTMLParser(HTMLParser): if tag == 'href': if value and value.endswith('.xz'): self.links.append(value) - if self._match in value: + if self.re_arch.search(value): self.arch_link = value @@ -120,30 +119,49 @@ class Toolchain: Priority of toolchain, PRIORITY_CALC=highest, 20=lowest. """ priority_list = ['-elf', '-unknown-linux-gnu', '-linux', - '-none-linux-gnueabi', '-uclinux', '-none-eabi', - '-gentoo-linux-gnu', '-linux-gnueabi', '-le-linux', '-uclinux'] + '-none-linux-gnueabi', '-none-linux-gnueabihf', '-uclinux', + '-none-eabi', '-gentoo-linux-gnu', '-linux-gnueabi', + '-linux-gnueabihf', '-le-linux', '-uclinux'] for prio in range(len(priority_list)): if priority_list[prio] in fname: return PRIORITY_CALC + prio return PRIORITY_CALC + prio + def GetWrapper(self, show_warning=True): + """Get toolchain wrapper from the setting file. + """ + value = '' + for name, value in bsettings.GetItems('toolchain-wrapper'): + if not value: + print "Warning: Wrapper not found" + if value: + value = value + ' ' + + return value + def MakeEnvironment(self, full_path): """Returns an environment for using the toolchain. Thie takes the current environment and adds CROSS_COMPILE so that - the tool chain will operate correctly. + the tool chain will operate correctly. This also disables localized + output and possibly unicode encoded output of all build tools by + adding LC_ALL=C. Args: full_path: Return the full path in CROSS_COMPILE and don't set PATH """ env = dict(os.environ) + wrapper = self.GetWrapper() + if full_path: - env['CROSS_COMPILE'] = os.path.join(self.path, self.cross) + env['CROSS_COMPILE'] = wrapper + os.path.join(self.path, self.cross) else: - env['CROSS_COMPILE'] = self.cross + env['CROSS_COMPILE'] = wrapper + self.cross env['PATH'] = self.path + ':' + env['PATH'] + env['LC_ALL'] = 'C' + return env @@ -412,7 +430,7 @@ class Toolchains: """ arch = command.OutputOneLine('uname', '-m') base = 'https://www.kernel.org/pub/tools/crosstool/files/bin' - versions = ['4.9.0', '4.6.3', '4.6.2', '4.5.1', '4.2.4'] + versions = ['7.3.0', '6.4.0', '4.9.4'] links = [] for version in versions: url = '%s/%s/%s/' % (base, arch, version)