diff --git a/Cargo.lock b/Cargo.lock index f93fc4e2..111d3695 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -239,6 +239,7 @@ dependencies = [ "serde", "serde_json", "serde_yaml", + "serpent_buildinfo", "sha2", "stone", "stone_recipe", @@ -1414,6 +1415,7 @@ dependencies = [ "rayon", "reqwest", "serde", + "serpent_buildinfo", "sha2", "stone", "strum", @@ -2040,6 +2042,14 @@ dependencies = [ "unsafe-libyaml", ] +[[package]] +name = "serpent_buildinfo" +version = "0.1.0" +dependencies = [ + "chrono", + "thiserror", +] + [[package]] name = "sha2" version = "0.10.8" diff --git a/Cargo.toml b/Cargo.toml index 56202ab7..befeca58 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -10,7 +10,9 @@ default-members = [ resolver = "2" [workspace.package] +version = "0.1.0" edition = "2021" +rust-version = "1.78" [workspace.dependencies] blsforme = { git = "https://github.com/serpent-os/blsforme.git", rev = "0aaece601fe4d11025382fa6e0e45deb1d668c92" } diff --git a/boulder/Cargo.toml b/boulder/Cargo.toml index 06b09d46..5b4d34a1 100644 --- a/boulder/Cargo.toml +++ b/boulder/Cargo.toml @@ -1,7 +1,8 @@ [package] name = "boulder" -version = "0.1.0" edition.workspace = true +version.workspace = true +rust-version.workspace = true # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html @@ -9,6 +10,7 @@ edition.workspace = true config = { path = "../crates/config" } container = { path = "../crates/container" } moss = { path = "../moss" } +serpent_buildinfo = { path = "../crates/serpent_buildinfo" } stone = { path = "../crates/stone" } stone_recipe = { path = "../crates/stone_recipe" } tui = { path = "../crates/tui" } diff --git a/boulder/src/cli.rs b/boulder/src/cli.rs index a778c439..e8666c80 100644 --- a/boulder/src/cli.rs +++ b/boulder/src/cli.rs @@ -11,9 +11,9 @@ mod build; mod chroot; mod profile; mod recipe; +mod version; #[derive(Debug, Parser)] -#[command(version = version())] pub struct Command { #[command(flatten)] pub global: Global, @@ -23,6 +23,14 @@ pub struct Command { #[derive(Debug, Args)] pub struct Global { + #[arg( + short, + long = "verbose", + help = "Prints additional information about what boulder is doing", + default_value = "false", + global = true + )] + pub verbose: bool, #[arg(long, global = true)] pub cache_dir: Option, #[arg(long, global = true)] @@ -39,12 +47,20 @@ pub enum Subcommand { Chroot(chroot::Command), Profile(profile::Command), Recipe(recipe::Command), + Version(version::Command), } pub fn process() -> Result<(), Error> { let args = replace_aliases(std::env::args()); let Command { global, subcommand } = Command::parse_from(args); + if global.verbose { + match subcommand { + Subcommand::Version(_) => (), + _ => version::print(), + } + } + let env = Env::new(global.cache_dir, global.config_dir, global.data_dir, global.moss_root)?; match subcommand { @@ -52,6 +68,7 @@ pub fn process() -> Result<(), Error> { Subcommand::Chroot(command) => chroot::handle(command, env)?, Subcommand::Profile(command) => profile::handle(command, env)?, Subcommand::Recipe(command) => recipe::handle(command, env)?, + Subcommand::Version(command) => version::handle(command), } Ok(()) @@ -94,15 +111,3 @@ pub enum Error { #[error("recipe")] Recipe(#[from] recipe::Error), } - -fn version() -> String { - use moss::environment; - - pub const VERSION: &str = env!("CARGO_PKG_VERSION"); - - let hash = environment::GIT_HASH - .map(|hash| format!(" ({hash})")) - .unwrap_or_default(); - - format!("{VERSION}{hash}") -} diff --git a/boulder/src/cli/version.rs b/boulder/src/cli/version.rs new file mode 100644 index 00000000..fda84488 --- /dev/null +++ b/boulder/src/cli/version.rs @@ -0,0 +1,34 @@ +// SPDX-FileCopyrightText: Copyright © 2020-2024 Serpent OS Developers +// +// SPDX-License-Identifier: MPL-2.0 + +use clap::Parser; + +#[derive(Debug, Parser)] +#[command(about = "Print version info and exit")] +pub struct Command { + #[arg( + long = "full", + help = "Print the full build and version info", + default_value = "false" + )] + full: bool, +} + +pub fn handle(command: Command) { + if command.full { + print_full() + } else { + print() + } +} + +/// Print program version +pub fn print() { + println!("boulder {}", serpent_buildinfo::get_simple_version()); +} + +/// Print additional build information +pub fn print_full() { + println!("boulder {}", serpent_buildinfo::get_full_version()); +} diff --git a/crates/config/Cargo.toml b/crates/config/Cargo.toml index afa8d62e..5b44e6c6 100644 --- a/crates/config/Cargo.toml +++ b/crates/config/Cargo.toml @@ -1,7 +1,8 @@ [package] name = "config" -version = "0.1.0" edition.workspace = true +version.workspace = true +rust-version.workspace = true # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html diff --git a/crates/container/Cargo.toml b/crates/container/Cargo.toml index 7c764143..59e797b2 100644 --- a/crates/container/Cargo.toml +++ b/crates/container/Cargo.toml @@ -1,7 +1,8 @@ [package] name = "container" -version = "0.1.0" edition.workspace = true +version.workspace = true +rust-version.workspace = true # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html diff --git a/crates/dag/Cargo.toml b/crates/dag/Cargo.toml index 92398aac..1e39ff2d 100644 --- a/crates/dag/Cargo.toml +++ b/crates/dag/Cargo.toml @@ -1,7 +1,8 @@ [package] name = "dag" -version = "0.1.0" edition.workspace = true +version.workspace = true +rust-version.workspace = true # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html diff --git a/crates/fnmatch/Cargo.toml b/crates/fnmatch/Cargo.toml index e1b75ac5..1f75b586 100644 --- a/crates/fnmatch/Cargo.toml +++ b/crates/fnmatch/Cargo.toml @@ -1,7 +1,8 @@ [package] name = "fnmatch" -version = "0.1.0" edition.workspace = true +version.workspace = true +rust-version.workspace = true # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html diff --git a/crates/serpent_buildinfo/Cargo.toml b/crates/serpent_buildinfo/Cargo.toml new file mode 100644 index 00000000..34fa6473 --- /dev/null +++ b/crates/serpent_buildinfo/Cargo.toml @@ -0,0 +1,13 @@ +[package] +name = "serpent_buildinfo" +edition.workspace = true +version.workspace = true +rust-version.workspace = true +build = "build.rs" + +[dependencies] +chrono.workspace = true + +[build-dependencies] +chrono.workspace = true +thiserror.workspace = true diff --git a/crates/serpent_buildinfo/build.rs b/crates/serpent_buildinfo/build.rs new file mode 100644 index 00000000..dea62f54 --- /dev/null +++ b/crates/serpent_buildinfo/build.rs @@ -0,0 +1,149 @@ +// build.rs +use std::os::unix::ffi::OsStringExt; + +use chrono::{DateTime, Utc}; + +/// Returns value of given environment variable or error if missing. +/// +/// This also outputs necessary ‘cargo:rerun-if-env-changed’ tag to make sure +/// build script is rerun if the environment variable changes. +fn env(key: &str) -> Result> { + println!("cargo:rerun-if-env-changed={}", key); + std::env::var_os(key).ok_or_else(|| Box::from(format!("Missing `{}` environmental variable", key))) +} + +/// Calls program with given arguments and returns its standard output. If +/// calling the program fails or it exits with non-zero exit status returns an +/// error. +fn command(prog: &str, args: &[&str], cwd: Option) -> Result, Box> { + println!("cargo:rerun-if-env-changed=PATH"); + let mut cmd = std::process::Command::new(prog); + cmd.args(args); + cmd.stderr(std::process::Stdio::inherit()); + if let Some(cwd) = cwd { + cmd.current_dir(cwd); + } + let out = cmd.output()?; + if out.status.success() { + let mut stdout = out.stdout; + if let Some(b'\n') = stdout.last() { + stdout.pop(); + if let Some(b'\r') = stdout.last() { + stdout.pop(); + } + } + Ok(stdout) + } else if let Some(code) = out.status.code() { + Err(Box::from(format!("{}: terminated with {}", prog, code))) + } else { + Err(Box::from(format!("{}: killed by signal", prog))) + } +} + +/// Checks to see if we're building from a git source and if so attempts to gather information about the git status +fn get_git_info() -> Result<(), Box> { + let pkg_dir = std::path::PathBuf::from(env("CARGO_MANIFEST_DIR")?); + let git_dir = command("git", &["rev-parse", "--git-dir"], Some(pkg_dir.clone())); + let git_dir = match git_dir { + Ok(git_dir) => { + println!("cargo:rustc-cfg=BUILDINFO_IS_GIT_BUILD"); + + std::path::PathBuf::from(std::ffi::OsString::from_vec(git_dir)) + } + Err(msg) => { + // We're not in a git repo, most likely we're building from a source archive + println!("cargo:warning=unable to determine git version (not in git repository?)"); + println!("cargo:warning={}", msg); + + // It's unlikely, but possible that someone could run git init. Might as well catch that. + println!("cargo::rerun-if-changed={}/.git", pkg_dir.display()); + return Ok(()); + } + }; + + // Make Cargo rerun us if currently checked out commit or the state of the + // working tree changes. We try to accomplish that by looking at a few + // crucial git state files. This probably may result in some false + // negatives but it’s best we’ve got. + for subpath in ["HEAD", "logs/HEAD", "index"] { + let path = git_dir.join(subpath).canonicalize()?; + println!("cargo:rerun-if-changed={}", path.display()); + } + + // Get the full git hash + let args = &["rev-parse", "--output-object-format=sha1", "HEAD"]; + let out = command("git", args, None)?; + match String::from_utf8_lossy(&out) { + std::borrow::Cow::Borrowed(full_hash) => { + println!("cargo:rustc-env=BUILDINFO_GIT_FULL_HASH={}", full_hash.trim()); + } + std::borrow::Cow::Owned(full_hash) => return Err(Box::from(format!("git: Invalid output: {}", full_hash))), + } + + // Get the short git hash + let args = &["rev-parse", "--output-object-format=sha1", "--short", "HEAD"]; + let out = command("git", args, None)?; + match String::from_utf8_lossy(&out) { + std::borrow::Cow::Borrowed(short_hash) => { + println!("cargo:rustc-env=BUILDINFO_GIT_SHORT_HASH={}", short_hash.trim()); + } + std::borrow::Cow::Owned(short_hash) => return Err(Box::from(format!("git: Invalid output: {}", short_hash))), + } + + // Get whether this is built from a dirty tree + let args = &["status", "--porcelain"]; + let out = command("git", args, None)?; + match String::from_utf8_lossy(&out) { + std::borrow::Cow::Borrowed(output) => match output.trim().len() { + 0 => {} + _ => println!("cargo:rustc-cfg=BUILDINFO_IS_DIRTY"), + }, + std::borrow::Cow::Owned(output) => return Err(Box::from(format!("git: Invalid output: {}", output))), + } + + // Get the commit summary + let args = &["show", "--format=\"%s\"", "-s"]; + let out = command("git", args, None)?; + match String::from_utf8_lossy(&out) { + std::borrow::Cow::Borrowed(summary) => { + println!("cargo:rustc-env=BUILDINFO_GIT_SUMMARY={}", summary.trim()); + } + std::borrow::Cow::Owned(summary) => return Err(Box::from(format!("git: Invalid output: {}", summary))), + } + + Ok(()) +} + +fn get_build_time() -> Result<(), Box> { + // Propagate SOURCE_DATE_EPOCH if set + if let Ok(epoch_env) = env("SOURCE_DATE_EPOCH") { + if let Ok(seconds) = epoch_env.to_string_lossy().parse::() { + if let Some(time) = DateTime::from_timestamp(seconds, 0) { + println!("cargo:rustc-env=BUILDINFO_BUILD_TIME={}", time.timestamp()); + return Ok(()); + } + } + } + + println!("cargo:rustc-env=BUILDINFO_BUILD_TIME={}", Utc::now().timestamp()); + Ok(()) +} + +fn main() -> Result<(), Box> { + // This should include all top-level directories that contain source code or otherwise modify the build in meaningful ways + let top_level = std::path::PathBuf::from("../..").canonicalize()?; + println!("cargo::rerun-if-changed={}/boulder", top_level.display()); + println!("cargo::rerun-if-changed={}/crates", top_level.display()); + println!("cargo::rerun-if-changed={}/moss", top_level.display()); + println!("cargo::rerun-if-changed={}/test", top_level.display()); + println!("cargo::rerun-if-changed={}/Cargo.toml", top_level.display()); + + let version = env("CARGO_PKG_VERSION")?; + println!("cargo:rustc-env=BUILDINFO_VERSION={}", version.to_string_lossy()); + + get_build_time()?; + + get_git_info()?; + + Ok(()) +} diff --git a/crates/serpent_buildinfo/src/lib.rs b/crates/serpent_buildinfo/src/lib.rs new file mode 100644 index 00000000..76fd54cf --- /dev/null +++ b/crates/serpent_buildinfo/src/lib.rs @@ -0,0 +1,118 @@ +// SPDX-FileCopyrightText: Copyright © 2020-2024 Serpent OS Developers +// +// SPDX-License-Identifier: MPL-2.0 + +use chrono::DateTime; + +mod values; + +/// Returns the version of the project, as defined in the top-level Cargo.toml +/// +/// This will look like "0.1.0" +pub const fn get_version() -> &'static str { + values::VERSION +} + +/// Returns the build time of the project, printed in UTC time format +/// +/// If SOURCE_DATE_EPOCH is set during the build then that will be the timestamp returned +/// +/// This will look like "2024-07-09T19:20:40+00:00" +pub fn get_build_time() -> String { + if let Ok(time) = values::BUILD_TIME.parse::() { + if let Some(build_time) = DateTime::from_timestamp(time, 0) { + return build_time.to_rfc3339(); + } + } + "unknown".to_string() +} + +/// Returns `true` if the project was built from a git source, `false` otherwise +pub const fn get_if_git_build() -> bool { + cfg!(BUILDINFO_IS_GIT_BUILD) +} + +/// Returns `-dirty` if the project was built from a dirty git source, `` otherwise +pub const fn get_git_dirty() -> &'static str { + if cfg!(BUILDINFO_IS_DIRTY) { + "-dirty" + } else { + "" + } +} + +/// Returns the git hash that the project was built from if built from a git source +/// +/// This currently returns the SHA1 hash, though eventually it will return the SHA256 one +/// +/// If built from a non-git source (like a release archive) this will return "unknown" +#[cfg(BUILDINFO_IS_GIT_BUILD)] +pub const fn get_git_full_hash() -> &'static str { + values::GIT_FULL_HASH +} + +/// Returns the git hash that the project was built from if built from a git source +/// +/// This currently returns the SHA1 hash, though eventually it will return the SHA256 one +/// +/// If built from a non-git source (like a release archive) this will return "unknown" +#[cfg(not(BUILDINFO_IS_GIT_BUILD))] +pub const fn get_git_full_hash() -> &'static str { + "unknown" +} + +/// Returns the shortened form of the git hash that this project was built from if built from git source +/// +/// If built from a non-git source (like a release archive) this will return "unknown" +#[cfg(BUILDINFO_IS_GIT_BUILD)] +pub const fn get_git_short_hash() -> &'static str { + values::GIT_SHORT_HASH +} + +/// Returns the shortened form of the git hash that this project was built from if built from git source +/// +/// If built from a non-git source (like a release archive) this will return "unknown" +#[cfg(not(BUILDINFO_IS_GIT_BUILD))] +pub const fn get_git_short_hash() -> &'static str { + "unknown" +} + +/// Returns the summary of the git commit that the project was built from +/// +/// If built from a non-git source (like a release archive) this will return "unknown" +#[cfg(BUILDINFO_IS_GIT_BUILD)] +pub const fn get_git_summary() -> &'static str { + values::GIT_SUMMARY +} + +/// Returns the summary of the git commit that the project was built from +/// +/// If built from a non-git source (like a release archive) this will return "unknown" +#[cfg(not(BUILDINFO_IS_GIT_BUILD))] +pub const fn get_git_summary() -> &'static str { + "unknown" +} + +/// For git builds this returns a string like `v0.1.0 (git 4ecad5d7e70c2cdc81350dc6b46fb55b1ccb18f5-dirty)` +/// +/// For builds from a non-git source just the version will be returned: `v0.1.0` +pub fn get_simple_version() -> String { + let git = if cfg!(BUILDINFO_IS_GIT_BUILD) { + format!(" (Git ref {}{})", get_git_full_hash(), get_git_dirty()) + } else { + "".to_string() + }; + format!("v{}{}", values::VERSION, git) +} + +/// For git builds this returns a string like `v0.1.0 (git 4ecad5d7e70c2cdc81350dc6b46fb55b1ccb18f5-dirty)` +/// +/// For builds from a non-git source just the version will be returned: `v0.1.0` +pub fn get_full_version() -> String { + let git = if cfg!(BUILDINFO_IS_GIT_BUILD) { + format!(" (Git ref {}{})", get_git_full_hash(), get_git_dirty()) + } else { + "".to_string() + }; + format!("version v{}{} (Built at {})", values::VERSION, git, get_build_time()) +} diff --git a/crates/serpent_buildinfo/src/values.rs b/crates/serpent_buildinfo/src/values.rs new file mode 100644 index 00000000..8c54d1ac --- /dev/null +++ b/crates/serpent_buildinfo/src/values.rs @@ -0,0 +1,16 @@ +// SPDX-FileCopyrightText: Copyright © 2020-2024 Serpent OS Developers +// +// SPDX-License-Identifier: MPL-2.0 + +pub(crate) const VERSION: &str = env!("BUILDINFO_VERSION"); + +pub(crate) const BUILD_TIME: &str = env!("BUILDINFO_BUILD_TIME"); + +#[cfg(BUILDINFO_IS_GIT_BUILD)] +pub(crate) const GIT_FULL_HASH: &str = env!("BUILDINFO_GIT_FULL_HASH"); + +#[cfg(BUILDINFO_IS_GIT_BUILD)] +pub(crate) const GIT_SHORT_HASH: &str = env!("BUILDINFO_GIT_SHORT_HASH"); + +#[cfg(BUILDINFO_IS_GIT_BUILD)] +pub(crate) const GIT_SUMMARY: &str = env!("BUILDINFO_GIT_SUMMARY"); diff --git a/crates/stone/Cargo.toml b/crates/stone/Cargo.toml index 54b34ba1..e926303c 100644 --- a/crates/stone/Cargo.toml +++ b/crates/stone/Cargo.toml @@ -1,7 +1,8 @@ [package] name = "stone" -version = "0.1.0" edition.workspace = true +version.workspace = true +rust-version.workspace = true # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html diff --git a/crates/stone_recipe/Cargo.toml b/crates/stone_recipe/Cargo.toml index 0b8b5f2f..de28f576 100644 --- a/crates/stone_recipe/Cargo.toml +++ b/crates/stone_recipe/Cargo.toml @@ -1,7 +1,8 @@ [package] name = "stone_recipe" -version = "0.1.0" edition.workspace = true +version.workspace = true +rust-version.workspace = true # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html diff --git a/crates/triggers/Cargo.toml b/crates/triggers/Cargo.toml index 8b8c5548..6a5867df 100644 --- a/crates/triggers/Cargo.toml +++ b/crates/triggers/Cargo.toml @@ -1,7 +1,8 @@ [package] name = "triggers" -version = "0.1.0" edition.workspace = true +version.workspace = true +rust-version.workspace = true [dependencies] dag = { path = "../dag" } diff --git a/crates/tui/Cargo.toml b/crates/tui/Cargo.toml index 061bb7a9..a0193e94 100644 --- a/crates/tui/Cargo.toml +++ b/crates/tui/Cargo.toml @@ -1,7 +1,8 @@ [package] name = "tui" -version = "0.1.0" edition.workspace = true +version.workspace = true +rust-version.workspace = true # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html diff --git a/moss/Cargo.toml b/moss/Cargo.toml index eff8db6f..e28045c6 100644 --- a/moss/Cargo.toml +++ b/moss/Cargo.toml @@ -1,12 +1,14 @@ [package] name = "moss" -version = "0.1.0" edition.workspace = true +version.workspace = true +rust-version.workspace = true [dependencies] config = { path = "../crates/config" } container = { path = "../crates/container" } dag = { path = "../crates/dag" } +serpent_buildinfo = { path = "../crates/serpent_buildinfo" } stone = { path = "../crates/stone" } triggers = { path = "../crates/triggers" } tui = { path = "../crates/tui" } diff --git a/moss/build.rs b/moss/build.rs deleted file mode 100644 index a7d67723..00000000 --- a/moss/build.rs +++ /dev/null @@ -1,15 +0,0 @@ -use std::process::Command; - -fn main() { - if let Ok(hash) = git_hash() { - println!("cargo:rustc-env=GIT_HASH={}", hash); - } - - println!("cargo:rerun-if-changed=../boulder/src"); - println!("cargo:rerun-if-changed=../Cargo.lock"); -} - -fn git_hash() -> Result> { - let output = Command::new("git").args(["rev-parse", "--short", "HEAD"]).output()?; - Ok(String::from_utf8(output.stdout)?) -} diff --git a/moss/src/cli/mod.rs b/moss/src/cli/mod.rs index eabbfa5b..109e12fb 100644 --- a/moss/src/cli/mod.rs +++ b/moss/src/cli/mod.rs @@ -26,9 +26,11 @@ fn command() -> Command { Command::new("moss") .about("Next generation package manager") .arg( - Arg::new("version") + Arg::new("verbose") .short('v') - .long("version") + .long("verbose") + .global(true) + .help("Prints additional information about what moss is doing") .action(ArgAction::SetTrue), ) .arg( @@ -77,9 +79,13 @@ pub fn process() -> Result<(), Error> { let args = replace_aliases(env::args()); let matches = command().get_matches_from(args); - if matches.get_flag("version") { - version::print(); - return Ok(()); + // Print the version, but not if the user is using the version subcommand + if matches.get_flag("verbose") { + if let Some(command) = matches.subcommand_name() { + if command != "version" { + version::print(); + } + } } let root = matches.get_one::("root").unwrap(); @@ -105,8 +111,8 @@ pub fn process() -> Result<(), Error> { Some(("search", args)) => search::handle(args, installation).map_err(Error::Search), Some(("state", args)) => state::handle(args, installation).map_err(Error::State), Some(("sync", args)) => sync::handle(args, installation).map_err(Error::Sync), - Some(("version", _)) => { - version::print(); + Some(("version", args)) => { + version::handle(args); Ok(()) } None => { diff --git a/moss/src/cli/version.rs b/moss/src/cli/version.rs index 1998c13a..29c524c4 100644 --- a/moss/src/cli/version.rs +++ b/moss/src/cli/version.rs @@ -2,19 +2,30 @@ // // SPDX-License-Identifier: MPL-2.0 -use clap::Command; -use moss::environment; +use clap::{arg, ArgMatches, Command}; /// Construct the Version command pub fn command() -> Command { - Command::new("version").about("Display version and exit") + Command::new("version") + .about("Display version and exit") + .arg(arg!(-f --"full" "Print the full build and version info").action(clap::ArgAction::SetTrue)) +} + +pub fn handle(args: &ArgMatches) { + let show_full = args.get_flag("full"); + if show_full { + print_full() + } else { + print() + } } /// Print program version pub fn print() { - let hash = environment::GIT_HASH - .map(|hash| format!(" ({hash})")) - .unwrap_or_default(); + println!("moss {}", serpent_buildinfo::get_simple_version()); +} - println!("moss {}{hash}", environment::VERSION); +/// Print additional build information +pub fn print_full() { + println!("moss {}", serpent_buildinfo::get_full_version()); } diff --git a/moss/src/client/mod.rs b/moss/src/client/mod.rs index e731ec8d..62e48862 100644 --- a/moss/src/client/mod.rs +++ b/moss/src/client/mod.rs @@ -774,7 +774,7 @@ PRETTY_NAME="Serpent OS {version} (fstx #{tx})" ANSI_COLOR="1;35" HOME_URL="https://serpentos.com" BUG_REPORT_URL="https://github.com/serpent-os""#, - version = environment::VERSION, + version = serpent_buildinfo::get_version(), // TODO: Better id for ephemeral transactions tx = state_id.unwrap_or_default() ); diff --git a/moss/src/environment.rs b/moss/src/environment.rs index 62b94b0e..b732e0d4 100644 --- a/moss/src/environment.rs +++ b/moss/src/environment.rs @@ -3,8 +3,6 @@ // SPDX-License-Identifier: MPL-2.0 pub const NAME: &str = env!("CARGO_PKG_NAME"); -pub const VERSION: &str = env!("CARGO_PKG_VERSION"); -pub const GIT_HASH: Option<&str> = option_env!("GIT_HASH"); /// Max concurrency for disk tasks pub const MAX_DISK_CONCURRENCY: usize = 16; /// Max concurrency for network tasks