From d1e8474adf24c0869c1b64b68d44603b54936bfd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jakub=20Ber=C3=A1nek?= Date: Fri, 1 Mar 2024 19:54:01 +0100 Subject: [PATCH] Update logic that finds libLLVM.so artifact --- collector/src/toolchain.rs | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/collector/src/toolchain.rs b/collector/src/toolchain.rs index 69bd052a8..1d76a3d17 100644 --- a/collector/src/toolchain.rs +++ b/collector/src/toolchain.rs @@ -283,16 +283,20 @@ impl ToolchainComponents { for entry in fs::read_dir(dir).context("Cannot read lib dir to find components")? { let entry = entry?; let path = entry.path(); - if path.is_file() && path.extension() == Some(OsStr::new("so")) { + if path.is_file() { if let Some(filename) = path.file_name().and_then(|s| s.to_str()) { + // libLLVM.so can have a weird suffix, like libLLVM.so., so we don't + // check its .so suffix directly. if filename.starts_with("libLLVM") { self.lib_llvm = Some(path); - } else if filename.starts_with("librustc_driver") { - self.lib_rustc = Some(path); - } else if filename.starts_with("libstd") { - self.lib_std = Some(path); - } else if filename.starts_with("libtest") { - self.lib_test = Some(path); + } else if path.extension() == Some(OsStr::new("so")) { + if filename.starts_with("librustc_driver") { + self.lib_rustc = Some(path); + } else if filename.starts_with("libstd") { + self.lib_std = Some(path); + } else if filename.starts_with("libtest") { + self.lib_test = Some(path); + } } } }