From c21a784918f81a9ab66d1cf06c72beda061a366c Mon Sep 17 00:00:00 2001 From: Jakub Jirutka Date: Sat, 20 Aug 2022 15:40:30 +0200 Subject: [PATCH] testing/gitoxide: new aport --- testing/gitoxide/APKBUILD | 73 ++++++++++++++++++++++++ testing/gitoxide/skip-online-tests.patch | 20 +++++++ testing/gitoxide/system-curl.patch | 27 +++++++++ testing/gitoxide/zlib-ng.patch | 52 +++++++++++++++++ 4 files changed, 172 insertions(+) create mode 100644 testing/gitoxide/APKBUILD create mode 100644 testing/gitoxide/skip-online-tests.patch create mode 100644 testing/gitoxide/system-curl.patch create mode 100644 testing/gitoxide/zlib-ng.patch diff --git a/testing/gitoxide/APKBUILD b/testing/gitoxide/APKBUILD new file mode 100644 index 00000000000..fefeeb34772 --- /dev/null +++ b/testing/gitoxide/APKBUILD @@ -0,0 +1,73 @@ +# Contributor: Jakub Jirutka +# Maintainer: Jakub Jirutka +pkgname=gitoxide +pkgver=0.14.0 +pkgrel=0 +pkgdesc="An idiomatic, lean, fast & safe pure Rust implementation of Git" +url="https://github.com/Byron/gitoxide" +# armhf, armv7, ppc64le, s390x: fails to build crate sha1-asm +# riscv64: zlib-ng-dev is not available yet +arch="all !armhf !armv7 !ppc64le !riscv64 !s390x" +license="Apache-2.0 OR MIT" +makedepends=" + cargo + curl-dev + zlib-dev + zlib-ng-dev + " +checkdepends=" + bash + git-daemon + xz-dev + " +source="https://github.com/Byron/gitoxide/archive/v$pkgver/gitoxide-$pkgver.tar.gz + system-curl.patch + zlib-ng.patch + skip-online-tests.patch + " + +export CARGO_PROFILE_RELEASE_CODEGEN_UNITS=1 +export CARGO_PROFILE_RELEASE_LTO="true" +export CARGO_PROFILE_RELEASE_OPT_LEVEL="s" +# unwind is required to assure that destructors are called, important for +# tempfiles (comment from Cargo.toml). +export CARGO_PROFILE_RELEASE_PANIC="unwind" + +_cargo_opts="--frozen --no-default-features --features lean" + +prepare() { + default_prepare + + # Rust target triple. + local target=$(rustc -vV | sed -n 's/host: //p') + + # Build against system-provided libz-ng. + mkdir -p .cargo + cat >> .cargo/config.toml <<-EOF + [target.$target] + z-ng = { rustc-link-lib = ["z-ng"], rustc-cfg = ["zng"] } + EOF + + cargo fetch --locked +} + +build() { + cargo build $_cargo_opts --release +} + +check() { + # CI - skip tests that require TTY. + CI=1 make journey-tests +} + +package() { + install -D -m755 target/release/gix -t "$pkgdir"/usr/bin/ + install -D -m755 target/release/ein -t "$pkgdir"/usr/bin/ +} + +sha512sums=" +2bd4c20a71ef3f37e37ef54d271fa5df9f43b7b396923e581ce1ae5f9b87969eabdc300267f365aeb5c06f83f2ccc68e2f709bee006ee54a6e65774f93979642 gitoxide-0.14.0.tar.gz +e512f0b9904b57b181a5d203ffbed85bd2aed6db44b255bc7e370ec6ef94d0d6dbe8f62b334e8d7b980728cc10f7a3fd694487a73031e8a953604d2e2f1d9192 system-curl.patch +ad2b931dfcecbf099d3b6c1abc4e9522016f60486b20f23a73bac55fe3061aa97236e877c53a1b1709495885e5f820a721c9d1a86dd99d72e09e21758135b50e zlib-ng.patch +eabb202211c28ed6209522f39b6ae32e0f51c9ed71943c41a18550f236064f676b1b88d6ff0baa5490c7e76bea43ba06f04653824a6af50355d4eb6cfc92cf9e skip-online-tests.patch +" diff --git a/testing/gitoxide/skip-online-tests.patch b/testing/gitoxide/skip-online-tests.patch new file mode 100644 index 00000000000..e064ae63336 --- /dev/null +++ b/testing/gitoxide/skip-online-tests.patch @@ -0,0 +1,20 @@ +--- a/tests/journey/gix.sh ++++ b/tests/journey/gix.sh +@@ -205,7 +205,7 @@ + ) + ) + ) +- (on_ci ++ (CI= on_ci + if test "$kind" = "max"; then + (with "https:// protocol" + (with "version 1" +@@ -584,7 +584,7 @@ + } + ) + fi +- (on_ci ++ (CI= on_ci + if [[ "$kind" = "max" ]]; then + (with "https:// protocol" + (with "version 1" diff --git a/testing/gitoxide/system-curl.patch b/testing/gitoxide/system-curl.patch new file mode 100644 index 00000000000..400e7f14f80 --- /dev/null +++ b/testing/gitoxide/system-curl.patch @@ -0,0 +1,27 @@ +--- a/git-transport/Cargo.toml ++++ b/git-transport/Cargo.toml +@@ -70 +70 @@ +-curl = { version = "0.4", optional = true, features = ["static-curl", "static-ssl", "zlib-ng-compat"] } ++curl = { version = "0.4", optional = true } +--- a/Cargo.lock ++++ b/Cargo.lock +@@ -2230,13 +2230,4 @@ + + [[package]] +-name = "openssl-src" +-version = "111.22.0+1.1.1q" +-source = "registry+https://github.com/rust-lang/crates.io-index" +-checksum = "8f31f0d509d1c1ae9cada2f9539ff8f37933831fd5098879e482aa687d659853" +-dependencies = [ +- "cc", +-] +- +-[[package]] + name = "openssl-sys" + version = "0.9.74" +@@ -2247,5 +2238,4 @@ + "cc", + "libc", +- "openssl-src", + "pkg-config", + "vcpkg", diff --git a/testing/gitoxide/zlib-ng.patch b/testing/gitoxide/zlib-ng.patch new file mode 100644 index 00000000000..b1570e11879 --- /dev/null +++ b/testing/gitoxide/zlib-ng.patch @@ -0,0 +1,52 @@ +From: Jakub Jirutka +Date: Sat, 20 Aug 2022 00:09:00 +0200 +Subject: [PATCH] Build with native zlib-ng (no compat) + +Use zlib-ng (libz-ng-sys) with native API (no compat mode) that can +co-exist with system libz (loaded by e.g. libcurl). + +--- a/git-features/Cargo.toml ++++ b/git-features/Cargo.toml +@@ -46,2 +46,4 @@ + zlib-rust-backend = ["flate2/rust_backend"] ++## Use zlib-ng (libz-ng-sys) with native API (no compat mode) that can co-exist with system libz. ++zlib-ng = ["flate2/zlib-ng"] + +--- a/git-repository/Cargo.toml ++++ b/git-repository/Cargo.toml +@@ -66,3 +66,2 @@ + "git-features/parallel", +- "git-features/zlib-ng-compat", + "git-pack/pack-cache-lru-static", +--- a/Cargo.toml ++++ b/Cargo.toml +@@ -33 +33 @@ +-fast = ["git-features/parallel", "git-features/fast-sha1", "git-features/zlib-ng-compat", "git-repository/max-performance"] ++fast = ["git-features/parallel", "git-features/fast-sha1", "git-features/zlib-ng", "git-repository/max-performance"] +--- a/Cargo.lock ++++ b/Cargo.lock +@@ -911,6 +911,7 @@ + checksum = "f82b0f4c27ad9f8bfd1f3208d882da2b09c301bc1c828fd3a00d0216d2fbbff6" + dependencies = [ + "crc32fast", ++ "libz-ng-sys", + "libz-sys", + "miniz_oxide", + ] +@@ -2005,6 +2006,16 @@ + "openssl-sys", + "pkg-config", + "vcpkg", ++] ++ ++[[package]] ++name = "libz-ng-sys" ++version = "1.1.8" ++source = "registry+https://github.com/rust-lang/crates.io-index" ++checksum = "4399ae96a9966bf581e726de86969f803a81b7ce795fcd5480e640589457e0f2" ++dependencies = [ ++ "cmake", ++ "libc", + ] + + [[package]]