From 5b50f90d2b98b539b091cbfc0ec6bacec124ec59 Mon Sep 17 00:00:00 2001 From: fdb-hiroshima <35889323+fdb-hiroshima@users.noreply.github.com> Date: Fri, 10 May 2019 16:15:30 +0200 Subject: [PATCH] use openssl instead of sha256sum for build.rs (#568) * use openssl instead of sha256sum for build.rs * use a more portable flag for stat --- build.rs | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/build.rs b/build.rs index 6832254d..f1e2e819 100644 --- a/build.rs +++ b/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() }