flowey_lib_hvlite/
install_openvmm_rust_build_essential.rs1use flowey::node::prelude::*;
11
12flowey_request! {
13 pub struct Request(pub WriteVar<SideEffect>);
14}
15
16new_flow_node!(struct Node);
17
18impl FlowNode for Node {
19 type Request = Request;
20
21 fn imports(ctx: &mut ImportCtx<'_>) {
22 ctx.import::<crate::init_openvmm_magicpath_protoc::Node>();
23 ctx.import::<crate::init_openvmm_cargo_config_deny_warnings::Node>();
24 ctx.import::<flowey_lib_common::install_rust::Node>();
25 ctx.import::<flowey_lib_common::install_dist_pkg::Node>();
26 }
27
28 fn emit(requests: Vec<Self::Request>, ctx: &mut NodeCtx<'_>) -> anyhow::Result<()> {
29 if requests.is_empty() {
30 return Ok(());
31 }
32
33 let mut side_effects = vec![
34 ctx.reqv(crate::init_openvmm_cargo_config_deny_warnings::Request::Done),
35 ctx.reqv(crate::init_openvmm_magicpath_protoc::Request),
36 ctx.reqv(flowey_lib_common::install_rust::Request::EnsureInstalled),
37 ];
38
39 let packages = match ctx.platform() {
40 FlowPlatform::Linux(FlowPlatformLinuxDistro::Ubuntu) => {
41 vec!["build-essential", "cmake"]
42 }
43 FlowPlatform::Linux(FlowPlatformLinuxDistro::OpenSuse) => {
44 vec!["gcc", "gcc-c++", "glibc-devel", "make", "cmake"]
45 }
46 _ => Vec::new(),
47 };
48 if !packages.is_empty() {
49 side_effects.push(ctx.reqv(|v| {
50 flowey_lib_common::install_dist_pkg::Request::Install {
51 package_names: packages.into_iter().map(Into::into).collect(),
52 done: v,
53 }
54 }));
55 }
56
57 ctx.emit_side_effect_step(side_effects, requests.into_iter().map(|x| x.0));
58
59 Ok(())
60 }
61}