From: Heiko Schocher Date: Wed, 4 Mar 2015 10:19:43 +0100 Subject: [U-Boot] [PATCH] buildman: crash when fetching i386 toolchain from kernel.org Message-ID: <1425460784-21437-1-git-send-email-hs@denx.de> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de Currently buildman crashes when fetching i386 toolchain from kernel.org. solution: - first check, if the directory in which buildman will search exists - second, pass a string not a list of strings when instantiating a Toolchain object Signed-off-by: Heiko Schocher --- Tried to fetch toolchain for i386 with buildman, and get this error: $ ./tools/buildman/buildman sandbox --fetch-arch i386 Checking: https://www.kernel.org/pub/tools/crosstool/files/bin/x86_64/4.6.3/ Downloading: https://www.kernel.org/pub/tools/crosstool/files/bin/x86_64/4.6.3/x86_64-gcc-4.6.3-nolibc_i386-linux.tar.xz Unpacking to: /home/hs/.buildman-toolchains Testing - looking in '/home/hs/.buildman-toolchains/gcc-4.6.3-nolibc/i386-linux/.' - looking in '/home/hs/.buildman-toolchains/gcc-4.6.3-nolibc/i386-linux/bin' - found '/home/hs/.buildman-toolchains/gcc-4.6.3-nolibc/i386-linux/bin/i386-linux-gcc' - looking in '/home/hs/.buildman-toolchains/gcc-4.6.3-nolibc/i386-linux/usr/bin' Traceback (most recent call last): File "./tools/buildman/buildman", line 64, in ret_code = control.DoBuildman(options, args) File "/home/hs/zug/u-boot/tools/buildman/control.py", line 132, in DoBuildman ret = toolchains.FetchAndInstall(arch) File "/home/hs/zug/u-boot/tools/buildman/toolchain.py", line 472, in FetchAndInstall toolchain = Toolchain(compiler_fname, True, True) File "/home/hs/zug/u-boot/tools/buildman/toolchain.py", line 62, in __init__ self.path = os.path.dirname(fname) File "/usr/lib64/python2.7/posixpath.py", line 129, in dirname i = p.rfind('/') + 1 AttributeError: 'list' object has no attribute 'rfind' $ with this patch I see: $ ./tools/buildman/buildman sandbox --fetch-arch i386 Checking: https://www.kernel.org/pub/tools/crosstool/files/bin/x86_64/4.6.3/ Downloading: https://www.kernel.org/pub/tools/crosstool/files/bin/x86_64/4.6.3/x86_64-gcc-4.6.3-nolibc_i386-linux.tar.xz Unpacking to: /home/hs/.buildman-toolchains Testing - looking in '/home/hs/.buildman-toolchains/gcc-4.6.3-nolibc/i386-linux/.' - looking in '/home/hs/.buildman-toolchains/gcc-4.6.3-nolibc/i386-linux/bin' - found '/home/hs/.buildman-toolchains/gcc-4.6.3-nolibc/i386-linux/bin/i386-linux-gcc' Tool chain test: OK $ tools/buildman/toolchain.py | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/tools/buildman/toolchain.py b/tools/buildman/toolchain.py index 537797a..93811ea 100644 --- a/tools/buildman/toolchain.py +++ b/tools/buildman/toolchain.py @@ -200,10 +200,11 @@ class Toolchains: fnames = [] for subdir in ['.', 'bin', 'usr/bin']: dirname = os.path.join(path, subdir) - if verbose: print " - looking in '%s'" % dirname - for fname in glob.glob(dirname + '/*gcc'): - if verbose: print " - found '%s'" % fname - fnames.append(fname) + if os.path.exists(dirname): + if verbose: print " - looking in '%s'" % dirname + for fname in glob.glob(dirname + '/*gcc'): + if verbose: print " - found '%s'" % fname + fnames.append(fname) return fnames @@ -469,7 +470,7 @@ class Toolchains: if not compiler_fname: print 'Could not locate C compiler - fetch failed.' return 1 - toolchain = Toolchain(compiler_fname, True, True) + toolchain = Toolchain(compiler_fname[0], True, True) # Make sure that it will be found by buildman if not self.TestSettingsHasPath(dirpath): -- 2.1.0