mirror of
https://github.com/gentoo-mirror/guru.git
synced 2025-04-20 08:18:49 -04:00
Closes: https://bugs.gentoo.org/935882 Fixes: 13c4e705268820984b5f4a8a326df8fc7b583f2a Signed-off-by: Lucio Sauer <watermanpaint@posteo.net>
42 lines
1.3 KiB
Diff
42 lines
1.3 KiB
Diff
Statically provide the release commit hash and date by replacing the
|
|
placeholder values within the ebuild.
|
|
|
|
Author: Lucio Sauer <watermanpaint@posteo.net>
|
|
--- a/build.rs
|
|
+++ b/build.rs
|
|
@@ -1,25 +1,11 @@
|
|
-use std::process::Command;
|
|
-
|
|
fn main() {
|
|
- let hash = Command::new("git")
|
|
- .args(["rev-parse", "--short", "HEAD"])
|
|
- .env("GIT_CONFIG_GLOBAL", "/dev/null")
|
|
- .output()
|
|
- .map(|o| String::from_utf8(o.stdout).unwrap());
|
|
- let date = Command::new("git")
|
|
- .args(["log", "--pretty=format:'%ad'", "-n1", "--date=short"])
|
|
- .env("GIT_CONFIG_GLOBAL", "/dev/null")
|
|
- .output()
|
|
- .map(|o| String::from_utf8(o.stdout).unwrap());
|
|
- if let (Ok(hash), Ok(date)) = (hash, date) {
|
|
- let ver = format!(
|
|
- "{} (commit {} {})",
|
|
- env!("CARGO_PKG_VERSION"),
|
|
- hash.trim(),
|
|
- date.trim_matches('\'')
|
|
- );
|
|
- println!("cargo:rustc-env=VERSION={ver}");
|
|
- } else {
|
|
- println!("cargo:rustc-env=VERSION={}", env!("CARGO_PKG_VERSION"));
|
|
- }
|
|
+ let hash = String::from("%COMMIT%");
|
|
+ let date = String::from("%DATE%");
|
|
+ let ver = format!(
|
|
+ "{} (commit {} {})",
|
|
+ env!("CARGO_PKG_VERSION"),
|
|
+ hash.trim(),
|
|
+ date.trim_matches('\'')
|
|
+ );
|
|
+ println!("cargo:rustc-env=VERSION={ver}");
|
|
}
|