Source reconstructed at patch state 0 of 1 — not the installed (fully patched) source.
1 Debian patch touch this file
| 1 |
use std::{fs::File, io::Write}; |
| 2 |
|
| 3 |
// Build.rs does not use all provided functions |
| 4 |
#[allow(dead_code)] |
| 5 |
#[path = "src/git.rs"] |
| 6 |
mod git; |
| 7 |
|
| 8 |
fn main() { |
| 9 |
let repo_path = git::git_dir(".").unwrap(); |
| 10 |
let head_path = repo_path.join("HEAD"); |
| 11 |
println!("cargo:rerun-if-changed={}", head_path.display()); |
| 12 |
let head = std::fs::read_to_string(&head_path).unwrap(); |
| 13 |
if let Some(ref_) = head.trim_end().strip_prefix("ref: ") { |
| 14 |
let ref_path = repo_path.join(ref_); |
| 15 |
assert!(ref_path.is_file()); |
| 16 |
println!("cargo:rerun-if-changed={}", ref_path.display()); |
| 17 |
} |
| 18 |
let ver = git::repo_hash(".").unwrap_or_else(|| "???".into()); |
| 19 |
|
| 20 |
File::create("src/gir_version.rs") |
| 21 |
.and_then(|mut f| writeln!(f, "pub const VERSION: &str = \"{ver}\";",)) |
| 22 |
.unwrap(); |
| 23 |
} |