tarball: remove redundant "version" file

Use the version in Cargo.toml instead.

Print a warning if the Cargo.toml version is not a prefix of the Git
version.  This can happen legit scenarios, see 0dfc490721 (build.rs:
Use Cargo_PKG_VERSION if no version could be found, 2024-06-10)
but the next commit will fix that.

Also remove stale comments in git_version_gen.sh.
This commit is contained in:
Johannes Altmanninger
2026-01-12 10:25:17 +01:00
parent f7d9c92820
commit 92dae88f62
7 changed files with 50 additions and 44 deletions

View File

@@ -35,7 +35,7 @@ fn main() {
rsconf::set_env_value("BUILD_HOST_TRIPLE", &env_var("HOST").unwrap());
rsconf::set_env_value("BUILD_PROFILE", &env_var("PROFILE").unwrap());
let version = &get_version(&env::current_dir().unwrap());
let version = &get_version();
// Per https://doc.rust-lang.org/cargo/reference/build-scripts.html#inputs-to-the-build-script,
// the source directory is the current working directory of the build script
rsconf::set_env_value("FISH_BUILD_VERSION", version);
@@ -195,7 +195,7 @@ fn join_if_relative(parent_if_relative: &Path, path: String) -> PathBuf {
});
}
fn get_version(src_dir: &Path) -> String {
fn get_version() -> String {
use std::fs::read_to_string;
use std::process::Command;
@@ -203,11 +203,6 @@ fn get_version(src_dir: &Path) -> String {
return var;
}
let path = src_dir.join("version");
if let Ok(strver) = read_to_string(path) {
return strver;
}
let args = &["describe", "--always", "--dirty=-dirty"];
if let Ok(output) = Command::new("git").args(args).output() {
let rev = String::from_utf8_lossy(&output.stdout).trim().to_string();