def LocateArchUrl(self, fetch_arch): """Find a toolchain available online Look in standard places for available toolchains. At present the only standard place is at kernel.org. Args: arch: Architecture to look for, or 'list' for all Returns: If fetch_arch is 'list', a tuple: Machine architecture (e.g. x86_64) List of toolchains else URL containing this toolchain, if avaialble, else None """ arch = command.OutputOneLine('uname', '-m') if arch == 'aarch64': arch = 'arm64' base = 'https://www.kernel.org/pub/tools/crosstool/files/bin' versions = ['11.1.0', '9.2.0', '7.3.0', '6.4.0', '4.9.4'] links = [] for version in versions: url = '%s/%s/%s/' % (base, arch, version) print('Checking: %s' % url) response = urllib.request.urlopen(url) html = tools.ToString(response.read()) parser = MyHTMLParser(fetch_arch) parser.feed(html) if fetch_arch == 'list': links += parser.links elif parser.arch_link: return url + parser.arch_link if fetch_arch == 'list': return arch, links return None
def ToOutput(self, binary): if not binary: self.stdout = tools.ToString(self.stdout) self.stderr = tools.ToString(self.stderr) self.combined = tools.ToString(self.combined) return self