MCPcopy Create free account
hub / github.com/CodSpeedHQ/codspeed / try_install_from_source

Function try_install_from_source

src/executor/valgrind/setup.rs:229–262  ·  view source on GitHub ↗

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,
)

Source from the content-addressed store, hash-verified

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.
229pub(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.
265pub(super) async fn install_valgrind_from_package(

Callers 1

setupMethod · 0.85

Calls 4

is_valgrind_installedFunction · 0.85
is_wantedFunction · 0.85
build_and_installFunction · 0.85

Tested by

no test coverage detected