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
10
build.rs
10
build.rs
@ -5,7 +5,7 @@ use std::process::{Command, Stdio};
|
|||||||
use std::{env, fs::*, io::Write, path::PathBuf};
|
use std::{env, fs::*, io::Write, path::PathBuf};
|
||||||
|
|
||||||
fn compute_static_hash() -> String {
|
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")
|
let find = Command::new("find")
|
||||||
.args(&["static/", "-type", "f", "!", "-path", "static/media/*"])
|
.args(&["static/", "-type", "f", "!", "-path", "static/media/*"])
|
||||||
@ -20,17 +20,19 @@ fn compute_static_hash() -> String {
|
|||||||
.expect("failed sort command");
|
.expect("failed sort command");
|
||||||
|
|
||||||
let xargs = Command::new("xargs")
|
let xargs = Command::new("xargs")
|
||||||
.args(&["stat", "--printf='%n %Y\n'"])
|
.args(&["stat", "-c'%n %Y'"])
|
||||||
.stdin(sort.stdout.unwrap())
|
.stdin(sort.stdout.unwrap())
|
||||||
.stdout(Stdio::piped())
|
.stdout(Stdio::piped())
|
||||||
.spawn()
|
.spawn()
|
||||||
.expect("failed xargs command");
|
.expect("failed xargs command");
|
||||||
|
|
||||||
let sha = Command::new("sha256sum")
|
let mut sha = Command::new("openssl")
|
||||||
|
.args(&["dgst", "-r"])
|
||||||
.stdin(xargs.stdout.unwrap())
|
.stdin(xargs.stdout.unwrap())
|
||||||
.output()
|
.output()
|
||||||
.expect("failed sha256sum command");
|
.expect("failed openssl command");
|
||||||
|
|
||||||
|
sha.stdout.resize(64, 0);
|
||||||
String::from_utf8(sha.stdout).unwrap()
|
String::from_utf8(sha.stdout).unwrap()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user