mirror of
https://github.com/apognu/tuigreet.git
synced 2024-08-17 02:20:51 +03:00
Align version strings between AUR git package and the program itself. [skip ci]
This commit is contained in:
parent
77be52aa65
commit
e7872bb58f
14
build.rs
14
build.rs
@ -12,17 +12,5 @@ fn main() {
|
||||
}
|
||||
|
||||
fn get_git_version() -> Result<String, Box<dyn Error>> {
|
||||
let tag = Command::new("git").args(&["describe", "--abbrev=0"]).output()?;
|
||||
let tag = match tag.status.code() {
|
||||
Some(0) => String::from_utf8(tag.stdout)?,
|
||||
_ => "0.0.0".to_string(),
|
||||
};
|
||||
let count = String::from_utf8(Command::new("git").args(&["rev-list", "--count", "HEAD"]).output()?.stdout)?;
|
||||
let commit = String::from_utf8(Command::new("git").args(&["rev-parse", "--short", "HEAD"]).output()?.stdout)?;
|
||||
let version = format!("{}.r{}.{}", tag.trim(), count.trim(), commit.trim());
|
||||
|
||||
match version.as_str() {
|
||||
"0.0.0.r." => Err("could not retrieve version".into()),
|
||||
version => Ok(version.to_string()),
|
||||
}
|
||||
Ok(String::from_utf8(Command::new("./contrib/git-version.sh").output()?.stdout)?)
|
||||
}
|
||||
|
3
contrib/git-version.sh
Executable file
3
contrib/git-version.sh
Executable file
@ -0,0 +1,3 @@
|
||||
#!/bin/sh
|
||||
|
||||
git describe --long | sed 's/-/.r/;s/-/./'
|
Loading…
Reference in New Issue
Block a user