mirror of
https://git.joinplu.me/Plume/Plume.git
synced 2024-11-22 19:41:03 +00:00
use openssl instead of sha256sum for build.rs (#568)
* use openssl instead of sha256sum for build.rs * use a more portable flag for stat
This commit is contained in:
parent
90f6ef0380
commit
5b50f90d2b
1 changed files with 6 additions and 4 deletions
10
build.rs
10
build.rs
|
@ -5,7 +5,7 @@ use std::process::{Command, Stdio};
|
|||
use std::{env, fs::*, io::Write, path::PathBuf};
|
||||
|
||||
fn compute_static_hash() -> String {
|
||||
//"find static/ -type f ! -path 'static/media/*' | sort | xargs stat --printf='%n %Y\n' | sha256sum"
|
||||
//"find static/ -type f ! -path 'static/media/*' | sort | xargs stat -c'%n %Y' | openssl dgst -r"
|
||||
|
||||
let find = Command::new("find")
|
||||
.args(&["static/", "-type", "f", "!", "-path", "static/media/*"])
|
||||
|
@ -20,17 +20,19 @@ fn compute_static_hash() -> String {
|
|||
.expect("failed sort command");
|
||||
|
||||
let xargs = Command::new("xargs")
|
||||
.args(&["stat", "--printf='%n %Y\n'"])
|
||||
.args(&["stat", "-c'%n %Y'"])
|
||||
.stdin(sort.stdout.unwrap())
|
||||
.stdout(Stdio::piped())
|
||||
.spawn()
|
||||
.expect("failed xargs command");
|
||||
|
||||
let sha = Command::new("sha256sum")
|
||||
let mut sha = Command::new("openssl")
|
||||
.args(&["dgst", "-r"])
|
||||
.stdin(xargs.stdout.unwrap())
|
||||
.output()
|
||||
.expect("failed sha256sum command");
|
||||
.expect("failed openssl command");
|
||||
|
||||
sha.stdout.resize(64, 0);
|
||||
String::from_utf8(sha.stdout).unwrap()
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue