diff --git a/build.rs b/build.rs index ccaa98f..7714837 100644 --- a/build.rs +++ b/build.rs @@ -4,9 +4,11 @@ fn main() -> Result<(), Box> { // Emit version information (if not cached by just vendor) let mut vergen = vergen::EmitBuilder::builder(); + println!("cargo:rerun-if-env-changed=VERGEN_GIT_COMMIT_DATE"); if std::env::var_os("VERGEN_GIT_COMMIT_DATE").is_none() { vergen.git_commit_date(); } + println!("cargo:rerun-if-env-changed=VERGEN_GIT_SHA"); if std::env::var_os("VERGEN_GIT_SHA").is_none() { vergen.git_sha(true); } diff --git a/debian/control b/debian/control index 97e6177..76c1214 100644 --- a/debian/control +++ b/debian/control @@ -4,7 +4,6 @@ Priority: optional Maintainer: Jeremy Soller Build-Depends: debhelper-compat (=13), - git, just (>= 1.13.0), pkg-config, rust-all, diff --git a/justfile b/justfile index 9ae289d..29e3fda 100644 --- a/justfile +++ b/justfile @@ -71,14 +71,21 @@ uninstall: # Vendor dependencies locally vendor: + #!/usr/bin/env bash mkdir -p .cargo - cargo vendor --sync Cargo.toml \ - | head -n -1 > .cargo/config.toml + cargo vendor --sync Cargo.toml | head -n -1 > .cargo/config.toml echo 'directory = "vendor"' >> .cargo/config.toml echo >> .cargo/config.toml echo '[env]' >> .cargo/config.toml - echo "VERGEN_GIT_COMMIT_DATE = \"$(git log -1 --pretty=format:'%cs' HEAD)\"" >> .cargo/config.toml - echo "VERGEN_GIT_SHA = \"$(git rev-parse --short HEAD)\"" >> .cargo/config.toml + if [ -n "${SOURCE_DATE_EPOCH}" ] + then + source_date="$(date -d "@${SOURCE_DATE_EPOCH}" "+%Y-%m-%d")" + echo "VERGEN_GIT_COMMIT_DATE = \"${source_date}\"" >> .cargo/config.toml + fi + if [ -n "${SOURCE_GIT_HASH}" ] + then + echo "VERGEN_GIT_SHA = \"${SOURCE_GIT_HASH}\"" >> .cargo/config.toml + fi tar pcf vendor.tar .cargo vendor rm -rf .cargo vendor