Skip to contentSkip to conversation

buildman: crash when fetching i386 toolchain from kernel.org

PATCH New Heiko Schocher 2 participants 2 messages Mar 4, 2015

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 buildman: crash when fetching i386 toolchain from kernel.org

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

---

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 <module>
    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(-)
tools/buildman/toolchain.py +6 -5
index 537797a..93811ea 100644
@@ -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):
Signature · 1 line
2.1.0
#1 lore raw

PATCH 1/1 buildman: crash when fetching i386 toolchain from kernel.org

Hi Heiko,

Quoted 9 lines · Heiko Schocher

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

Yes this was broken by a recent change - please see here:

http://patchwork.ozlabs.org/patch/445496/

Quoted 75 lines

---

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 <module>
    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(-)
tools/buildman/toolchain.py +6 -6
index 537797a..93811ea 100644
@@ -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):
--
Quoted 2 lines

2.1.0

Regards,
Simon