Provide valgrind on the systems we publish no package for: take the installation the user brings, or build one from source, and otherwise ask for a manual installation.
(
system_info: &SystemInfo,
run_environment: &RunEnvironment,
)
| 227 | /// Provide valgrind on the systems we publish no package for: take the installation the |
| 228 | /// user brings, or build one from source, and otherwise ask for a manual installation. |
| 229 | pub(super) async fn try_install_from_source( |
| 230 | system_info: &SystemInfo, |
| 231 | run_environment: &RunEnvironment, |
| 232 | ) -> Result<()> { |
| 233 | if is_valgrind_installed() { |
| 234 | debug!( |
| 235 | "Using the valgrind installation already present on {}", |
| 236 | system_info.os |
| 237 | ); |
| 238 | return Ok(()); |
| 239 | } |
| 240 | |
| 241 | // The build compiles for a few minutes and installs system-wide, so the user decides |
| 242 | // whether we do it or they install by hand. |
| 243 | warn!( |
| 244 | "CodSpeed does not publish a valgrind package for {}", |
| 245 | system_info.os |
| 246 | ); |
| 247 | |
| 248 | if build_from_source::is_wanted() { |
| 249 | // A best effort: the toolchain may be missing or the build may fail, in which case |
| 250 | // the user is pointed to a manual installation like a declined build would be. |
| 251 | match build_from_source::build_and_install(run_environment).await { |
| 252 | Ok(()) if is_valgrind_installed() => { |
| 253 | info!("valgrind-codspeed has been built and installed from source"); |
| 254 | return Ok(()); |
| 255 | } |
| 256 | Ok(()) => warn!("The freshly built valgrind is not usable, see the logs above"), |
| 257 | Err(error) => warn!("Building valgrind from source failed: {error}"), |
| 258 | } |
| 259 | } |
| 260 | |
| 261 | Err(manual_installation_error(system_info)) |
| 262 | } |
| 263 | |
| 264 | /// Install the valgrind-codspeed package we publish for this system, from apt. |
| 265 | pub(super) async fn install_valgrind_from_package( |
no test coverage detected