Do not require git to handle versioning
This commit is contained in:
parent
fa86c7f1c4
commit
707eb18334
3 changed files with 13 additions and 5 deletions
2
build.rs
2
build.rs
|
|
@ -4,9 +4,11 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
|
|||
|
||||
// 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);
|
||||
}
|
||||
|
|
|
|||
1
debian/control
vendored
1
debian/control
vendored
|
|
@ -4,7 +4,6 @@ Priority: optional
|
|||
Maintainer: Jeremy Soller <jeremy@system76.com>
|
||||
Build-Depends:
|
||||
debhelper-compat (=13),
|
||||
git,
|
||||
just (>= 1.13.0),
|
||||
pkg-config,
|
||||
rust-all,
|
||||
|
|
|
|||
15
justfile
15
justfile
|
|
@ -74,14 +74,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
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue