Clean up format strings.
This commit is contained in:
parent
f861aa6d2a
commit
49f30480ea
5 changed files with 10 additions and 17 deletions
|
|
@ -6,7 +6,7 @@ use anyhow::Result;
|
||||||
use crate::StorePath;
|
use crate::StorePath;
|
||||||
|
|
||||||
pub fn activate(store_path: StorePath, ephemeral: bool) -> Result<()> {
|
pub fn activate(store_path: StorePath, ephemeral: bool) -> Result<()> {
|
||||||
log::info!("Activating system-manager profile: {}", store_path);
|
log::info!("Activating system-manager profile: {store_path}");
|
||||||
if ephemeral {
|
if ephemeral {
|
||||||
log::info!("Running in ephemeral mode");
|
log::info!("Running in ephemeral mode");
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -75,7 +75,7 @@ fn create_etc_link(name: &str, entry: &EtcFile, etc_dir: &Path) -> Result<()> {
|
||||||
etc_dir.join(link_target).as_path(),
|
etc_dir.join(link_target).as_path(),
|
||||||
)
|
)
|
||||||
} else {
|
} else {
|
||||||
anyhow::bail!("Cannot create link for this entry ({}).", name)
|
anyhow::bail!("Cannot create link for this entry ({name}).")
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
Ok(())
|
Ok(())
|
||||||
|
|
|
||||||
|
|
@ -126,7 +126,7 @@ fn link_services(services: Services, ephemeral: bool) -> Result<LinkedServices>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
Err(e) => {
|
Err(e) => {
|
||||||
log::error!("Error linking service {}, skipping.", name);
|
log::error!("Error linking service {name}, skipping.");
|
||||||
log::error!("{:?}", e);
|
log::error!("{:?}", e);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
@ -227,12 +227,8 @@ where
|
||||||
set
|
set
|
||||||
}
|
}
|
||||||
Err(e) => {
|
Err(e) => {
|
||||||
log::error!(
|
log::error!("Service {service}: error {log_action}, please consult the logs");
|
||||||
"Service {}: error {}, please consult the logs",
|
log::error!("{e}");
|
||||||
service,
|
|
||||||
log_action
|
|
||||||
);
|
|
||||||
log::error!("{}", e);
|
|
||||||
set
|
set
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
|
||||||
|
|
@ -19,7 +19,7 @@ pub fn generate(flake_uri: &str) -> Result<StorePath> {
|
||||||
let profile_dir = Path::new(PROFILE_DIR);
|
let profile_dir = Path::new(PROFILE_DIR);
|
||||||
let profile_name = Path::new(PROFILE_NAME);
|
let profile_name = Path::new(PROFILE_NAME);
|
||||||
|
|
||||||
log::info!("Creating new generation from {}", store_path);
|
log::info!("Creating new generation from {store_path}");
|
||||||
install_nix_profile(&store_path, profile_dir, profile_name)?;
|
install_nix_profile(&store_path, profile_dir, profile_name)?;
|
||||||
|
|
||||||
log::info!("Registering GC root...");
|
log::info!("Registering GC root...");
|
||||||
|
|
@ -70,7 +70,7 @@ fn get_store_path(nix_build_result: process::Output) -> Result<StorePath> {
|
||||||
String::from_utf8(nix_build_result.stderr)
|
String::from_utf8(nix_build_result.stderr)
|
||||||
.map_err(anyhow::Error::from)
|
.map_err(anyhow::Error::from)
|
||||||
.and_then(|e| {
|
.and_then(|e| {
|
||||||
log::error!("{}", e);
|
log::error!("{e}");
|
||||||
anyhow::bail!("Nix build failed.")
|
anyhow::bail!("Nix build failed.")
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
@ -85,10 +85,7 @@ fn parse_nix_build_output(output: String) -> Result<StorePath> {
|
||||||
if let Some(store_path) = result.outputs.get(expected_output_name) {
|
if let Some(store_path) = result.outputs.get(expected_output_name) {
|
||||||
return Ok(StorePath::from(store_path.to_owned()));
|
return Ok(StorePath::from(store_path.to_owned()));
|
||||||
}
|
}
|
||||||
anyhow::bail!(
|
anyhow::bail!("No output '{expected_output_name}' found in nix build result.")
|
||||||
"No output '{}' found in nix build result.",
|
|
||||||
expected_output_name
|
|
||||||
)
|
|
||||||
}
|
}
|
||||||
anyhow::bail!("Multiple build results were returned, we cannot handle that yet.")
|
anyhow::bail!("Multiple build results were returned, we cannot handle that yet.")
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -99,7 +99,7 @@ fn go(action: Action) -> Result<()> {
|
||||||
|
|
||||||
fn build(flake_uri: String) -> Result<()> {
|
fn build(flake_uri: String) -> Result<()> {
|
||||||
let store_path = do_build(flake_uri)?;
|
let store_path = do_build(flake_uri)?;
|
||||||
log::info!("{store_path}");
|
log::info!("Build system-manager profile {store_path}");
|
||||||
// Print the raw store path to stdout
|
// Print the raw store path to stdout
|
||||||
println!("{store_path}");
|
println!("{store_path}");
|
||||||
Ok(())
|
Ok(())
|
||||||
|
|
@ -130,7 +130,7 @@ fn check_root() -> Result<()> {
|
||||||
|
|
||||||
fn handle_toplevel_error<T>(r: Result<T>) -> ExitCode {
|
fn handle_toplevel_error<T>(r: Result<T>) -> ExitCode {
|
||||||
if let Err(e) = r {
|
if let Err(e) = r {
|
||||||
log::error!("{}", e);
|
log::error!("{e}");
|
||||||
return ExitCode::FAILURE;
|
return ExitCode::FAILURE;
|
||||||
}
|
}
|
||||||
ExitCode::SUCCESS
|
ExitCode::SUCCESS
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue