Use gitcl instead of git2 to avoid compiling git

This commit is contained in:
Clément Renault 2024-05-23 16:38:44 +02:00
parent b1f5a72d0d
commit 5f4b0a0b25
No known key found for this signature in database
GPG Key ID: F250A4C4E3AE5F5F
3 changed files with 7 additions and 65 deletions

63
Cargo.lock generated
View File

@ -632,7 +632,7 @@ version = "1.8.0"
dependencies = [ dependencies = [
"anyhow", "anyhow",
"time", "time",
"vergen-git2", "vergen-gitcl",
] ]
[[package]] [[package]]
@ -816,10 +816,6 @@ name = "cc"
version = "1.0.94" version = "1.0.94"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "17f6e324229dc011159fcc089755d1e2e216a90d43a7dea6853ca740b84f35e7" checksum = "17f6e324229dc011159fcc089755d1e2e216a90d43a7dea6853ca740b84f35e7"
dependencies = [
"jobserver",
"libc",
]
[[package]] [[package]]
name = "cedarwood" name = "cedarwood"
@ -2109,19 +2105,6 @@ version = "0.27.3"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b6c80984affa11d98d1b88b66ac8853f143217b399d3c74116778ff8fdb4ed2e" checksum = "b6c80984affa11d98d1b88b66ac8853f143217b399d3c74116778ff8fdb4ed2e"
[[package]]
name = "git2"
version = "0.18.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1b3ba52851e73b46a4c3df1d89343741112003f0f6f13beb0dfac9e457c3fdcd"
dependencies = [
"bitflags 2.5.0",
"libc",
"libgit2-sys",
"log",
"url",
]
[[package]] [[package]]
name = "glob" name = "glob"
version = "0.3.1" version = "0.3.1"
@ -2571,15 +2554,6 @@ dependencies = [
"regex", "regex",
] ]
[[package]]
name = "jobserver"
version = "0.1.28"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ab46a6e9526ddef3ae7f787c06f0f2600639ba80ea3eade3d8e670a2230f51d6"
dependencies = [
"libc",
]
[[package]] [[package]]
name = "js-sys" name = "js-sys"
version = "0.3.69" version = "0.3.69"
@ -2664,18 +2638,6 @@ version = "0.2.153"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9c198f91728a82281a64e1f4f9eeb25d82cb32a5de251c6bd1b5154d63a8e7bd" checksum = "9c198f91728a82281a64e1f4f9eeb25d82cb32a5de251c6bd1b5154d63a8e7bd"
[[package]]
name = "libgit2-sys"
version = "0.16.2+1.7.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ee4126d8b4ee5c9d9ea891dd875cfdc1e9d0950437179104b183d7d8a74d24e8"
dependencies = [
"cc",
"libc",
"libz-sys",
"pkg-config",
]
[[package]] [[package]]
name = "libloading" name = "libloading"
version = "0.8.1" version = "0.8.1"
@ -2713,18 +2675,6 @@ dependencies = [
"libc", "libc",
] ]
[[package]]
name = "libz-sys"
version = "1.1.15"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "037731f5d3aaa87a5675e895b63ddff1a87624bc29f77004ea829809654e48f6"
dependencies = [
"cc",
"libc",
"pkg-config",
"vcpkg",
]
[[package]] [[package]]
name = "lindera" name = "lindera"
version = "0.30.0" version = "0.30.0"
@ -5535,12 +5485,6 @@ version = "0.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "830b7e5d4d90034032940e4ace0d9a9a057e7a45cd94e6c007832e39edb82f6d" checksum = "830b7e5d4d90034032940e4ace0d9a9a057e7a45cd94e6c007832e39edb82f6d"
[[package]]
name = "vcpkg"
version = "0.2.15"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "accd4ea62f7bb7a82fe23066fb0957d48ef677f6eeb8215f372f52e48bb32426"
[[package]] [[package]]
name = "vergen" name = "vergen"
version = "9.0.0-beta.2" version = "9.0.0-beta.2"
@ -5555,14 +5499,13 @@ dependencies = [
] ]
[[package]] [[package]]
name = "vergen-git2" name = "vergen-gitcl"
version = "1.0.0-beta.2" version = "1.0.0-beta.2"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8875c5d71074bb67118774e3d795ab6fe77c3ae3161cb54e19104cabc49487f1" checksum = "237ec19e307c303b26fdd234aa89bdf629dd7d91189dddff8591e531b05901bb"
dependencies = [ dependencies = [
"anyhow", "anyhow",
"derive_builder 0.13.1", "derive_builder 0.13.1",
"git2",
"rustversion", "rustversion",
"time", "time",
"vergen", "vergen",

View File

@ -15,4 +15,4 @@ time = { version = "0.3.34", features = ["parsing"] }
[build-dependencies] [build-dependencies]
anyhow = "1.0.80" anyhow = "1.0.80"
vergen-git2 = "1.0.0-beta.2" vergen-gitcl = "1.0.0-beta.2"

View File

@ -8,7 +8,7 @@ fn emit_git_variables() -> anyhow::Result<()> {
// Note: any code that needs VERGEN_ environment variables should take care to define them manually in the Dockerfile and pass them // Note: any code that needs VERGEN_ environment variables should take care to define them manually in the Dockerfile and pass them
// in the corresponding GitHub workflow (publish_docker.yml). // in the corresponding GitHub workflow (publish_docker.yml).
// This is due to the Dockerfile building the binary outside of the git directory. // This is due to the Dockerfile building the binary outside of the git directory.
let mut builder = vergen_git2::Git2Builder::default(); let mut builder = vergen_gitcl::GitclBuilder::default();
builder.branch(true); builder.branch(true);
builder.commit_timestamp(true); builder.commit_timestamp(true);
@ -16,7 +16,6 @@ fn emit_git_variables() -> anyhow::Result<()> {
builder.describe(true, true, None); builder.describe(true, true, None);
builder.sha(false); builder.sha(false);
let git2 = builder.build()?; let gitcl = builder.build()?;
vergen_gitcl::Emitter::default().fail_on_error().add_instructions(&gitcl)?.emit()
vergen_git2::Emitter::default().fail_on_error().add_instructions(&git2)?.emit()
} }