From d82f539ab900c52a669a4f8407a39b8fb125f0ab Mon Sep 17 00:00:00 2001 From: Trevor Woerner Date: Wed, 21 Nov 2018 03:31:12 -0500 Subject: buildman/toolchain.py: fix toolchain directory The hexagon toolchain (4.6.1) from kernel.org, for example, was packaged in a way that is different from most toolchains. The first entry when unpacking most toolchain tarballs is: gcc--nolib/- e.g.: gcc-8.1.0-nolibc/aarch64-linux/ The first entry of the hexagon toolchain, however, is: gcc-4.6.1-nolibc/ This causes the buildman logic in toolchain.py::ScanPath() to not be able to find the "*gcc" executable since it looks in gcc-4.6.1-nolib/{.|bin|usr/bin} instead of gcc-4.6.1/hexagon-linux/{.|bin|usr/bin}. Therefore when buildman tries to download a set of toolchains that includes hexagon, the script fails. This update takes the second line of the tarball unpacking (which works for all the toolchains I've tested from kernel.org) and parses it to take the first two elements, separated by '/'. It makes this logic a bit more robust. Signed-off-by: Trevor Woerner Reviewed-by: Simon Glass --- tools/buildman/toolchain.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'tools') diff --git a/tools/buildman/toolchain.py b/tools/buildman/toolchain.py index 4b35f400e97..59dd309c2b4 100644 --- a/tools/buildman/toolchain.py +++ b/tools/buildman/toolchain.py @@ -502,7 +502,8 @@ class Toolchains: trailing / """ stdout = command.Output('tar', 'xvfJ', fname, '-C', dest) - return stdout.splitlines()[0][:-1] + dirs = stdout.splitlines()[1].split('/')[:2] + return '/'.join(dirs) def TestSettingsHasPath(self, path): """Check if buildman will find this toolchain -- cgit v1.3.1 From b11f12642f4da249d5f07bb45ba5ba9b01235818 Mon Sep 17 00:00:00 2001 From: Trevor Woerner Date: Wed, 21 Nov 2018 03:31:13 -0500 Subject: buildman/toolchain.py: handle inconsistent tarball names Unfortunately, for some releases the kernel.org toolchain tarball names adhere to the following pattern: -gcc--nolib--.tar.xz e.g.: x86_64-gcc-8.1.0-nolibc-aarch64-linux.tar.xz while others use the following pattern: -gcc--nolib_-.tar.xz e.g.: x86_64-gcc-7.3.0-nolibc_aarch64-linux.tar.xz Notice that the first pattern has dashes throughout, while the second has dashes throughout except just before the target architecture which has an underscore. The "dash throughout" versions from kernel.org are: 8.1.0, 6.4.0, 5.5.0, 4.9.4, 4.8.5, 4.6.1 while the "dash and underscore" versions from kernel.org are: 7.3.0, 4.9.0, 4.8.0, 4.7.3, 4.6.3, 4.6.2, 4.5.1, 4.2.4 This tweak allows the code to handle both versions. Note that this tweak also causes the architecture parsing to get confused and find the following two bogus architectures, "2.0" and "64", which are explicitly checked for, and removed. Signed-off-by: Trevor Woerner Reviewed-by: Simon Glass Change single quotes to double quotes: Signed-off-by: Simon Glass --- tools/buildman/toolchain.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'tools') diff --git a/tools/buildman/toolchain.py b/tools/buildman/toolchain.py index 59dd309c2b4..c62ce136fa1 100644 --- a/tools/buildman/toolchain.py +++ b/tools/buildman/toolchain.py @@ -517,13 +517,14 @@ class Toolchains: def ListArchs(self): """List architectures with available toolchains to download""" host_arch, archives = self.LocateArchUrl('list') - re_arch = re.compile('[-a-z0-9.]*_([^-]*)-.*') + re_arch = re.compile('[-a-z0-9.]*[-_]([^-]*)-.*') arch_set = set() for archive in archives: # Remove the host architecture from the start arch = re_arch.match(archive[len(host_arch):]) if arch: - arch_set.add(arch.group(1)) + if arch.group(1) != '2.0' and arch.group(1) != '64': + arch_set.add(arch.group(1)) return sorted(arch_set) def FetchAndInstall(self, arch): -- cgit v1.3.1