diff --git a/crates/nao/src/lib.rs b/crates/nao/src/lib.rs index f36e0f4eac..db4f6e663b 100644 --- a/crates/nao/src/lib.rs +++ b/crates/nao/src/lib.rs @@ -3,6 +3,7 @@ use std::{ net::Ipv4Addr, path::Path, process::Stdio, + time::Duration, }; use color_eyre::{ @@ -16,7 +17,7 @@ use tokio::{ select, }; -pub const PING_TIMEOUT_SECONDS: u32 = 2; +const PING_TIMEOUT: Duration = Duration::from_secs(2); const NAO_SSH_FLAGS: &[&str] = &[ "-lnao", @@ -47,17 +48,17 @@ pub struct Nao { } impl Nao { - pub fn new(host: Ipv4Addr) -> Self { - Self { address: host } + pub fn new(address: Ipv4Addr) -> Self { + Self { address } } pub async fn try_new_with_ping(host: Ipv4Addr) -> Result { - Self::try_new_with_ping_and_arguments(host, PING_TIMEOUT_SECONDS).await + Self::try_new_with_ping_and_arguments(host, PING_TIMEOUT).await } pub async fn try_new_with_ping_and_arguments( host: Ipv4Addr, - timeout_seconds: u32, + timeout: Duration, ) -> Result { #[cfg(target_os = "macos")] const TIMEOUT_FLAG: &str = "-t"; @@ -68,7 +69,7 @@ impl Nao { .arg("-c") .arg("1") .arg(TIMEOUT_FLAG) - .arg(timeout_seconds.to_string()) + .arg(timeout.as_secs().to_string()) .arg(host.to_string()) .output() .await diff --git a/crates/repository/src/cargo.rs b/crates/repository/src/cargo.rs index b624b29317..f1a1cc61d1 100644 --- a/crates/repository/src/cargo.rs +++ b/crates/repository/src/cargo.rs @@ -194,7 +194,7 @@ impl<'a> CargoCommand<'a> { repository_root=self.repository_root.to_str().wrap_err("failed to convert repository root to string")?, cargo_home=cargo_home.to_str().wrap_err("failed to convert cargo home to string")?, command=self.sub_command, -) + ) } }; Ok(shell_command) diff --git a/crates/repository/src/communication.rs b/crates/repository/src/communication.rs index 98084549f1..173093da11 100644 --- a/crates/repository/src/communication.rs +++ b/crates/repository/src/communication.rs @@ -1,15 +1,14 @@ use std::path::Path; -use color_eyre::Result; +use color_eyre::{eyre::Context, Result}; use serde_json::Value; use crate::modify_json::modify_json_inplace; -/// Sets the communication address in the framework.json file. -/// -/// This function takes a boolean value to enable or disable communication. It reads the -/// framework.json file, updates the communication address field, and writes the updated JSON back. -pub async fn set_communication(enable: bool, repository_root: impl AsRef) -> Result<()> { +pub async fn configure_communication( + enable: bool, + repository_root: impl AsRef, +) -> Result<()> { let framework_json = repository_root .as_ref() .join("etc/parameters/framework.json"); @@ -20,11 +19,17 @@ pub async fn set_communication(enable: bool, repository_root: impl AsRef) Value::Null }; - modify_json_inplace(framework_json, |mut hardware_json: Value| { + modify_json_inplace(&framework_json, |mut hardware_json: Value| { hardware_json["communication_addresses"] = address; hardware_json }) - .await?; + .await + .wrap_err_with(|| { + format!( + "failed to configure communication address in {}", + framework_json.display() + ) + })?; Ok(()) } diff --git a/crates/repository/src/configuration.rs b/crates/repository/src/configuration.rs index 2acfbfd7be..ebd15ea1d7 100644 --- a/crates/repository/src/configuration.rs +++ b/crates/repository/src/configuration.rs @@ -10,17 +10,19 @@ pub struct Configuration { pub sdk_version: String, } -pub async fn get_os_version(repository_root: impl AsRef) -> Result { - let hulk = find_and_parse_hulk_toml(repository_root).await?; +/// Get the OS version configured in the `hulk.toml`. +pub async fn read_os_version(repository_root: impl AsRef) -> Result { + let hulk = read_hulk_toml(repository_root).await?; Ok(hulk.os_version) } -pub async fn get_sdk_version(repository_root: impl AsRef) -> Result { - let hulk = find_and_parse_hulk_toml(repository_root).await?; +/// Get the SDK version configured in the `hulk.toml`. +pub async fn read_sdk_version(repository_root: impl AsRef) -> Result { + let hulk = read_hulk_toml(repository_root).await?; Ok(hulk.sdk_version) } -pub async fn find_and_parse_hulk_toml(repository_root: impl AsRef) -> Result { +pub async fn read_hulk_toml(repository_root: impl AsRef) -> Result { let hulk_toml = repository_root.as_ref().join("hulk.toml"); let hulk_toml = read_to_string(hulk_toml) .await diff --git a/crates/repository/src/inspect_version.rs b/crates/repository/src/inspect_version.rs index d7703809d3..f48b638296 100644 --- a/crates/repository/src/inspect_version.rs +++ b/crates/repository/src/inspect_version.rs @@ -9,71 +9,33 @@ use serde::Deserialize; struct Cargo { package: Package, } + #[derive(Deserialize, Debug)] struct Package { version: String, } -/// Inspects and returns the version of a Cargo package from its `Cargo.toml` file. -/// -/// This function takes a path to a `Cargo.toml` file, reads the file, -/// parses the contents to extract the package version, and returns the version. -/// -/// # Errors -/// -/// This function will return an error if: -/// -/// * The `Cargo.toml` file cannot be read. -/// * The contents of the `Cargo.toml` file cannot be parsed. -/// * The version string extracted from the `Cargo.toml` file cannot be parsed into a `Version` object. -/// -/// # Example -/// -/// ```no_run -/// let version = inspect_version(Path::new("path/to/Cargo.toml")).expect("failed to inspect version"); -/// println!("Package version: {}", version); -/// ``` -pub fn inspect_version(path: impl AsRef) -> Result { - let path = path.as_ref(); - let cargo_toml_text = read_to_string(path) - .wrap_err_with(|| format!("failed to load Cargo.toml at {}", path.display()))?; - let cargo_toml: Cargo = toml::from_str(&cargo_toml_text) - .wrap_err_with(|| format!("failed to parse package version from {}", path.display()))?; - let version = Version::parse(&cargo_toml.package.version).wrap_err_with(|| { - format!( - "failed to parse package version '{}' from {}", - cargo_toml.package.version, - path.display() - ) - })?; +/// Inspects and returns the version of a package from its `Cargo.toml` file. +pub fn inspect_version(toml_path: impl AsRef) -> Result { + let toml_path = toml_path.as_ref(); + let cargo_toml_text = read_to_string(toml_path).wrap_err("failed to read file")?; + let cargo_toml: Cargo = toml::from_str(&cargo_toml_text).wrap_err("failed to parse content")?; + let raw_version = &cargo_toml.package.version; + let version = Version::parse(raw_version) + .wrap_err_with(|| format!("failed to parse version '{raw_version}' as SemVer"))?; Ok(version) } -/// Checks if there is a new version of the crate available. -/// -/// This function takes the current version of a package and the path to a `Cargo.toml` file, -/// reads and parses the version from the `Cargo.toml` file, and compares it with the current version. -/// If the version in the `Cargo.toml` file is newer, it prints a message indicating that a new version -/// is available and provides the command to install the new version. -/// -/// # Errors -/// -/// This function will return an error if: -/// -/// * The `own_version` string cannot be parsed into a `Version` object. -/// * The `Cargo.toml` file cannot be read or parsed to extract the package version. -/// -/// # Example -/// -/// ```no_run -/// let current_version = "1.0.0"; -/// let cargo_toml_path = Path::new("path/to/Cargo.toml"); -/// -/// check_for_update(current_version, &cargo_toml_path).expect("failed to check for update"); -/// ``` +/// Checks whether the package has a newer version than the provided version. pub fn check_for_update(own_version: &str, cargo_toml: impl AsRef) -> Result<()> { - let own_version = Version::parse(own_version)?; - let cargo_toml_version = inspect_version(&cargo_toml)?; + let own_version = Version::parse(own_version) + .wrap_err_with(|| format!("failed to parse own version '{own_version}' as SemVer"))?; + let cargo_toml_version = inspect_version(&cargo_toml).wrap_err_with(|| { + format!( + "failed to inspect version of package at {}", + cargo_toml.as_ref().display() + ) + })?; if own_version < cargo_toml_version { let crate_path = cargo_toml.as_ref().parent().unwrap(); warn!( diff --git a/crates/repository/src/lib.rs b/crates/repository/src/lib.rs index ea538bf04c..52902670cc 100644 --- a/crates/repository/src/lib.rs +++ b/crates/repository/src/lib.rs @@ -1,3 +1,8 @@ +//! Tools and utilities for managing development workflows in the repository. +//! +//! This crate simplifies tasks like building for specific targets, handling SDKs, and setting up +//! configurations, making it easier to develop, configure, and deploy for NAO robots. + pub mod cargo; pub mod communication; pub mod configuration; diff --git a/crates/repository/src/location.rs b/crates/repository/src/location.rs index 5b4ee749ef..4dec1c306a 100644 --- a/crates/repository/src/location.rs +++ b/crates/repository/src/location.rs @@ -1,8 +1,4 @@ -use std::{ - collections::{HashMap, HashSet}, - io::ErrorKind, - path::Path, -}; +use std::{io::ErrorKind, path::Path}; use color_eyre::{ eyre::{bail, eyre, Context}, @@ -15,9 +11,9 @@ use tokio::{ io, }; -pub async fn get_configured_locations( +pub async fn list_configured_locations( repository_root: impl AsRef, -) -> Result>> { +) -> Result)>> { let parameters_root = &repository_root.as_ref().join("etc/parameters"); let results: Vec<_> = [ "nao_location", @@ -66,8 +62,13 @@ pub async fn set_location( repository_root: impl AsRef, ) -> Result<()> { let parameters_root = repository_root.as_ref().join("etc/parameters"); - if !try_exists(parameters_root.join(location)).await? { - let location_set = list_available_locations(&repository_root).await?; + if !try_exists(parameters_root.join(location)) + .await + .wrap_err_with(|| format!("failed checking if location '{location}' exists"))? + { + let location_set = list_available_locations(&repository_root) + .await + .unwrap_or_default(); let available_locations: String = intersperse( location_set .into_iter() @@ -76,29 +77,28 @@ pub async fn set_location( ) .collect(); bail!( - "location {location} does not exist. \navailable locations are:\n{available_locations}" + "location {location} does not exist.\navailable locations are:\n{available_locations}" ); } let target_location = parameters_root.join(format!("{target}_location")); let _ = remove_file(&target_location).await; - symlink(location, &target_location) - .await - .wrap_err_with(|| { - format!("failed creating symlink named {target_location:?} pointing to {location:?}, does the location exist?") - }) + symlink(location, &target_location).await.wrap_err_with(|| { + format!( + "failed creating symlink named {target_location} pointing to {location}", + target_location = target_location.display() + ) + }) } -pub async fn list_available_locations( - repository_root: impl AsRef, -) -> Result> { +pub async fn list_available_locations(repository_root: impl AsRef) -> Result> { let parameters_root = repository_root.as_ref().join("etc/parameters"); let mut locations = read_dir(parameters_root) .await .wrap_err("failed to read parameters directory")?; - let mut results = HashSet::new(); + let mut results = Vec::new(); while let Ok(Some(entry)) = locations.next_entry().await { if entry.path().is_dir() && !entry.path().is_symlink() { - results.insert( + results.push( entry .path() .file_name() diff --git a/crates/repository/src/player_number.rs b/crates/repository/src/player_number.rs index 09c710e5e1..805550fcc2 100644 --- a/crates/repository/src/player_number.rs +++ b/crates/repository/src/player_number.rs @@ -8,10 +8,7 @@ use parameters::{ use spl_network_messages::PlayerNumber; use types::hardware::Ids; -/// Sets the player number in the parameters directory. -/// -/// This function takes a head ID of a robot and a player number, and writes it to the parameters. -pub async fn set_player_number( +pub async fn configure_player_number( head_id: &str, player_number: PlayerNumber, repository_root: impl AsRef, @@ -35,5 +32,6 @@ pub async fn set_player_number( head_id: head_id.to_string(), }, ) - .wrap_err("failed to serialize parameters directory") + .wrap_err("failed to serialize parameters directory")?; + Ok(()) } diff --git a/crates/repository/src/recording.rs b/crates/repository/src/recording.rs index 6dfb4aea30..29fbcaecd9 100644 --- a/crates/repository/src/recording.rs +++ b/crates/repository/src/recording.rs @@ -5,7 +5,7 @@ use serde_json::{to_value, Value}; use crate::modify_json::modify_json_inplace; -pub async fn set_recording_intervals( +pub async fn configure_recording_intervals( recording_intervals: HashMap, repository_root: impl AsRef, ) -> Result<()> { @@ -15,11 +15,17 @@ pub async fn set_recording_intervals( let serialized_intervals = to_value(recording_intervals).wrap_err("failed to convert recording intervals to JSON")?; - modify_json_inplace(framework_json, |mut hardware_json: Value| { + modify_json_inplace(&framework_json, |mut hardware_json: Value| { hardware_json["recording_intervals"] = serialized_intervals; hardware_json }) - .await?; + .await + .wrap_err_with(|| { + format!( + "failed to configure recording intervals in {}", + framework_json.display() + ) + })?; Ok(()) } diff --git a/crates/repository/src/sdk.rs b/crates/repository/src/sdk.rs index cd6d77bf24..c6df339f17 100644 --- a/crates/repository/src/sdk.rs +++ b/crates/repository/src/sdk.rs @@ -67,7 +67,9 @@ async fn download(version: &str, sdk_home: impl AsRef) -> Result format!("http://bighulk.hulks.dev/sdk/{installer_name}"), format!("https://github.com/HULKs/meta-nao/releases/download/{version}/{installer_name}"), ]; - download_with_fallback(urls, &download_path, CONNECT_TIMEOUT).await?; + download_with_fallback(urls, &download_path, CONNECT_TIMEOUT) + .await + .wrap_err("failed to download SDK")?; set_permissions(&download_path, Permissions::from_mode(0o755)) .await diff --git a/crates/repository/src/team.rs b/crates/repository/src/team.rs index 870dd8f1d6..b0972b5703 100644 --- a/crates/repository/src/team.rs +++ b/crates/repository/src/team.rs @@ -18,12 +18,12 @@ pub struct Nao { pub head_id: String, } -pub async fn get_team_configuration(repository_root: impl AsRef) -> Result { +pub async fn read_team_configuration(repository_root: impl AsRef) -> Result { let team_toml = repository_root.as_ref().join("etc/parameters/team.toml"); let content = read_to_string(&team_toml) .await - .wrap_err_with(|| format!("failed to open {}", team_toml.display()))?; + .wrap_err_with(|| format!("failed to read {}", team_toml.display()))?; let team = toml::from_str(&content).wrap_err("failed to parse team.toml")?; Ok(team) diff --git a/tools/pepsi/src/aliveness.rs b/tools/pepsi/src/aliveness.rs index b80493ced7..93f1d51e27 100644 --- a/tools/pepsi/src/aliveness.rs +++ b/tools/pepsi/src/aliveness.rs @@ -14,7 +14,7 @@ use aliveness::{ AlivenessError, AlivenessState, Battery, JointsArray, }; use argument_parsers::NaoAddress; -use repository::configuration::get_os_version; +use repository::configuration::read_os_version; #[derive(Args)] pub struct Arguments { @@ -52,7 +52,7 @@ pub async fn aliveness( print_verbose(&states); } else { let expected_os_version = match repository_root { - Ok(repository_root) => match get_os_version(repository_root).await { + Ok(repository_root) => match read_os_version(repository_root).await { Ok(version) => Some(version), Err(error) => { error!("{error:#?}"); diff --git a/tools/pepsi/src/cargo.rs b/tools/pepsi/src/cargo.rs index 32f7a304d6..15fdbd20d2 100644 --- a/tools/pepsi/src/cargo.rs +++ b/tools/pepsi/src/cargo.rs @@ -4,7 +4,7 @@ use clap::Args; use color_eyre::{eyre::WrapErr, Result}; use repository::{ cargo::{run_shell, Cargo, Environment, Executor}, - configuration::get_sdk_version, + configuration::read_sdk_version, data_home::get_data_home, sdk::download_and_install, }; @@ -85,7 +85,7 @@ pub async fn cargo( .await .wrap_err("failed to run remote script")?; } else { - let sdk_version = get_sdk_version(&repository_root) + let sdk_version = read_sdk_version(&repository_root) .await .wrap_err("failed to get HULK OS version")?; let data_home = get_data_home().wrap_err("failed to get data home")?; diff --git a/tools/pepsi/src/communication.rs b/tools/pepsi/src/communication.rs index a4b25ac8da..a1a35096ac 100644 --- a/tools/pepsi/src/communication.rs +++ b/tools/pepsi/src/communication.rs @@ -2,7 +2,7 @@ use std::path::Path; use clap::Subcommand; use color_eyre::{eyre::WrapErr, Result}; -use repository::communication::set_communication; +use repository::communication::configure_communication; #[derive(Subcommand)] pub enum Arguments { @@ -11,7 +11,7 @@ pub enum Arguments { } pub async fn communication(arguments: Arguments, repository_root: impl AsRef) -> Result<()> { - set_communication(matches!(arguments, Arguments::Enable), repository_root) + configure_communication(matches!(arguments, Arguments::Enable), repository_root) .await .wrap_err("failed to set communication enablement") } diff --git a/tools/pepsi/src/gammaray.rs b/tools/pepsi/src/gammaray.rs index 663ed6502e..5a823cec24 100644 --- a/tools/pepsi/src/gammaray.rs +++ b/tools/pepsi/src/gammaray.rs @@ -6,7 +6,7 @@ use color_eyre::{eyre::WrapErr, Result}; use argument_parsers::NaoAddress; use nao::Nao; use opn::verify_image; -use repository::{configuration::get_os_version, data_home::get_data_home, image::download_image}; +use repository::{configuration::read_os_version, data_home::get_data_home, image::download_image}; use crate::progress_indicator::ProgressIndicator; @@ -26,7 +26,7 @@ pub struct Arguments { pub async fn gammaray(arguments: Arguments, repository_root: impl AsRef) -> Result<()> { let version = match arguments.version { Some(version) => version, - None => get_os_version(&repository_root) + None => read_os_version(&repository_root) .await .wrap_err("failed to get OS version")?, }; diff --git a/tools/pepsi/src/location.rs b/tools/pepsi/src/location.rs index 9ccd2f8e70..6ab048e821 100644 --- a/tools/pepsi/src/location.rs +++ b/tools/pepsi/src/location.rs @@ -2,7 +2,7 @@ use std::path::Path; use clap::Subcommand; use color_eyre::{eyre::WrapErr, Result}; -use repository::location::{get_configured_locations, list_available_locations, set_location}; +use repository::location::{list_available_locations, list_configured_locations, set_location}; #[derive(Subcommand)] pub enum Arguments { @@ -39,7 +39,7 @@ pub async fn location(arguments: Arguments, repository_root: impl AsRef) - } Arguments::Status {} => { println!("Configured Locations:"); - for (target, location) in get_configured_locations(repository_root) + for (target, location) in list_configured_locations(repository_root) .await .wrap_err("failed to get configured locations")? { diff --git a/tools/pepsi/src/ping.rs b/tools/pepsi/src/ping.rs index 92a114ed02..70555fd164 100644 --- a/tools/pepsi/src/ping.rs +++ b/tools/pepsi/src/ping.rs @@ -1,3 +1,5 @@ +use std::time::Duration; + use clap::Args; use argument_parsers::NaoAddress; @@ -7,9 +9,9 @@ use crate::progress_indicator::ProgressIndicator; #[derive(Args)] pub struct Arguments { - /// Time in seconds after which ping is aborted + /// Timeout in seconds after which ping is aborted #[arg(long, default_value = "2")] - pub timeout_seconds: u32, + pub timeout: u64, /// The NAOs to ping to e.g. 20w or 10.1.24.22 #[arg(required = true)] pub naos: Vec, @@ -20,9 +22,12 @@ pub async fn ping(arguments: Arguments) { arguments.naos, "Pinging NAO...", |nao_address, _progress_bar| async move { - Nao::try_new_with_ping_and_arguments(nao_address.ip, arguments.timeout_seconds) - .await - .map(|_| ()) + Nao::try_new_with_ping_and_arguments( + nao_address.ip, + Duration::from_secs(arguments.timeout), + ) + .await + .map(|_| ()) }, ) .await; diff --git a/tools/pepsi/src/player_number.rs b/tools/pepsi/src/player_number.rs index ef0bd14cdf..76e99e5381 100644 --- a/tools/pepsi/src/player_number.rs +++ b/tools/pepsi/src/player_number.rs @@ -7,7 +7,7 @@ use color_eyre::{ }; use argument_parsers::NaoNumberPlayerAssignment; -use repository::{player_number::set_player_number, team::get_team_configuration}; +use repository::{player_number::configure_player_number, team::read_team_configuration}; use crate::progress_indicator::ProgressIndicator; @@ -20,7 +20,7 @@ pub struct Arguments { pub async fn player_number(arguments: Arguments, repository_root: impl AsRef) -> Result<()> { let repository_root = repository_root.as_ref(); - let team = get_team_configuration(repository_root) + let team = read_team_configuration(repository_root) .await .wrap_err("failed to get team configuration")?; @@ -38,7 +38,7 @@ pub async fn player_number(arguments: Arguments, repository_root: impl AsRef Result<()> { if arguments.all { let repository_root = repository_root?; - let team = get_team_configuration(repository_root) + let team = read_team_configuration(repository_root) .await .wrap_err("failed to get team configuration")?; let addresses = team diff --git a/tools/pepsi/src/pre_game.rs b/tools/pepsi/src/pre_game.rs index 7beb0e8377..1be1cac360 100644 --- a/tools/pepsi/src/pre_game.rs +++ b/tools/pepsi/src/pre_game.rs @@ -16,8 +16,8 @@ use indicatif::ProgressBar; use log::warn; use nao::{Nao, Network, SystemctlAction}; use repository::{ - communication::set_communication, configuration::get_os_version, location::set_location, - recording::set_recording_intervals, upload::populate_upload_directory, + communication::configure_communication, configuration::read_os_version, location::set_location, + recording::configure_recording_intervals, upload::populate_upload_directory, }; use tempfile::tempdir; @@ -81,7 +81,7 @@ pub async fn pre_game(arguments: Arguments, repository_root: impl AsRef) - .map(|assignment| assignment.nao_address) .collect(); - set_recording_intervals( + configure_recording_intervals( HashMap::from_iter(arguments.recording_intervals.clone()), repository_root, ) @@ -92,7 +92,7 @@ pub async fn pre_game(arguments: Arguments, repository_root: impl AsRef) - .await .wrap_err_with(|| format!("failed setting location for nao to {}", arguments.location))?; - set_communication(arguments.with_communication, repository_root) + configure_communication(arguments.with_communication, repository_root) .await .wrap_err("failed to set communication")?; @@ -165,7 +165,7 @@ async fn setup_nao( .get_os_version() .await .wrap_err_with(|| format!("failed to get OS version of {nao_address}"))?; - let expected_os_version = get_os_version(repository_root) + let expected_os_version = read_os_version(repository_root) .await .wrap_err("failed to get configured OS version")?; if nao_os_version != expected_os_version { diff --git a/tools/pepsi/src/recording.rs b/tools/pepsi/src/recording.rs index e0e9dc23c7..2e8cd9a0b1 100644 --- a/tools/pepsi/src/recording.rs +++ b/tools/pepsi/src/recording.rs @@ -2,7 +2,7 @@ use std::{collections::HashMap, error::Error, path::Path}; use clap::Args; use color_eyre::{eyre::WrapErr, Result}; -use repository::recording::set_recording_intervals; +use repository::recording::configure_recording_intervals; #[derive(Args)] pub struct Arguments { @@ -13,7 +13,7 @@ pub struct Arguments { } pub async fn recording(arguments: Arguments, repository_root: impl AsRef) -> Result<()> { - set_recording_intervals( + configure_recording_intervals( HashMap::from_iter(arguments.recording_intervals), repository_root, ) diff --git a/tools/pepsi/src/sdk.rs b/tools/pepsi/src/sdk.rs index f6a6130475..6b624b43fa 100644 --- a/tools/pepsi/src/sdk.rs +++ b/tools/pepsi/src/sdk.rs @@ -4,7 +4,7 @@ use clap::Subcommand; use color_eyre::{eyre::Context, Result}; use repository::{ - configuration::get_sdk_version, data_home::get_data_home, sdk::download_and_install, + configuration::read_sdk_version, data_home::get_data_home, sdk::download_and_install, }; #[derive(Subcommand)] @@ -23,14 +23,14 @@ pub async fn sdk(arguments: Arguments, repository_root: impl AsRef) -> Res let data_home = get_data_home()?; let version = match version { Some(version) => version, - None => get_sdk_version(repository_root) + None => read_sdk_version(repository_root) .await .wrap_err("failed to get OS version")?, }; download_and_install(&version, data_home).await?; } Arguments::Path => { - let sdk_version = get_sdk_version(&repository_root) + let sdk_version = read_sdk_version(&repository_root) .await .wrap_err("failed to get HULK OS version")?; let data_home = get_data_home().wrap_err("failed to get data home")?; diff --git a/tools/pepsi/src/upload.rs b/tools/pepsi/src/upload.rs index d712adbe38..30f1095dae 100644 --- a/tools/pepsi/src/upload.rs +++ b/tools/pepsi/src/upload.rs @@ -8,7 +8,7 @@ use color_eyre::{ }; use futures_util::{stream::FuturesUnordered, StreamExt}; use nao::{Nao, SystemctlAction}; -use repository::{configuration::get_os_version, upload::populate_upload_directory}; +use repository::{configuration::read_os_version, upload::populate_upload_directory}; use tempfile::tempdir; use crate::{ @@ -53,7 +53,7 @@ async fn upload_with_progress( .get_os_version() .await .wrap_err_with(|| format!("failed to get OS version of {nao_address}"))?; - let expected_os_version = get_os_version(repository_root) + let expected_os_version = read_os_version(repository_root) .await .wrap_err("failed to get configured OS version")?; if nao_os_version != expected_os_version {