diff --git a/.gitignore b/.gitignore index ea928a5..601a2de 100644 --- a/.gitignore +++ b/.gitignore @@ -36,3 +36,4 @@ /libgit2-sys-0.13.5+1.4.5.crate /libgit2-sys-0.14.2+1.5.1.crate /libgit2-sys-0.15.2+1.6.4.crate +/libgit2-sys-0.16.1+1.7.1.crate diff --git a/0001-build-with-vendored-libgit2-unconditionally.patch b/0001-build-with-vendored-libgit2-unconditionally.patch index d970241..a52d14c 100644 --- a/0001-build-with-vendored-libgit2-unconditionally.patch +++ b/0001-build-with-vendored-libgit2-unconditionally.patch @@ -1,35 +1,73 @@ -From 9da92f6c0981aae2f4e6267e4a1cb4eaf0b92357 Mon Sep 17 00:00:00 2001 +From 16924a64fa662d649590a0a26d7f280616651435 Mon Sep 17 00:00:00 2001 From: Fabio Valentini -Date: Thu, 13 Jul 2023 13:53:24 +0200 +Date: Tue, 19 Sep 2023 22:02:24 +0200 Subject: [PATCH] build with vendored libgit2 unconditionally --- - build.rs | 12 ------------ - 1 file changed, 12 deletions(-) + build.rs | 47 ----------------------------------------------- + 1 file changed, 47 deletions(-) diff --git a/build.rs b/build.rs -index 24df572..7b551a7 100644 +index b497005..4bf1136 100644 --- a/build.rs +++ b/build.rs -@@ -10,18 +10,6 @@ fn main() { - let vendored = env::var("CARGO_FEATURE_VENDORED").is_ok(); - let zlib_ng_compat = env::var("CARGO_FEATURE_ZLIB_NG_COMPAT").is_ok(); +@@ -4,56 +4,9 @@ use std::io; + use std::path::{Path, PathBuf}; + use std::process::Command; -- // To use zlib-ng in zlib-compat mode, we have to build libgit2 ourselves. -- let try_to_use_system_libgit2 = !vendored && !zlib_ng_compat; -- if try_to_use_system_libgit2 { -- let mut cfg = pkg_config::Config::new(); -- if let Ok(lib) = cfg.range_version("1.6.4".."1.7.0").probe("libgit2") { +-/// Tries to use system libgit2 and emits necessary build script instructions. +-fn try_system_libgit2() -> Result { +- let mut cfg = pkg_config::Config::new(); +- match cfg.range_version("1.7.1".."1.8.0").probe("libgit2") { +- Ok(lib) => { - for include in &lib.include_paths { - println!("cargo:root={}", include.display()); - } -- return; +- Ok(lib) +- } +- Err(e) => { +- println!("cargo:warning=failed to probe system libgit2: {e}"); +- Err(e) - } - } +-} +- + fn main() { + let https = env::var("CARGO_FEATURE_HTTPS").is_ok(); + let ssh = env::var("CARGO_FEATURE_SSH").is_ok(); +- let vendored = env::var("CARGO_FEATURE_VENDORED").is_ok(); +- let zlib_ng_compat = env::var("CARGO_FEATURE_ZLIB_NG_COMPAT").is_ok(); +- +- // Specify `LIBGIT2_NO_VENDOR` to force to use system libgit2. +- // Due to the additive nature of Cargo features, if some crate in the +- // dependency graph activates `vendored` feature, there is no way to revert +- // it back. This env var serves as a workaround for this purpose. +- println!("cargo:rerun-if-env-changed=LIBGIT2_NO_VENDOR"); +- let forced_no_vendor = env::var_os("LIBGIT2_NO_VENDOR").map_or(false, |s| s != "0"); +- +- if forced_no_vendor { +- if try_system_libgit2().is_err() { +- panic!( +- "\ +-The environment variable `LIBGIT2_NO_VENDOR` has been set but no compatible system libgit2 could be found. +-The build is now aborting. To disable, unset the variable or use `LIBGIT2_NO_VENDOR=0`. +-", +- ); +- } - +- // We've reached here, implying we're using system libgit2. +- return; +- } +- +- // To use zlib-ng in zlib-compat mode, we have to build libgit2 ourselves. +- let try_to_use_system_libgit2 = !vendored && !zlib_ng_compat; +- if try_to_use_system_libgit2 && try_system_libgit2().is_ok() { +- // using system libgit2 has worked +- return; +- } + println!("cargo:rustc-cfg=libgit2_vendored"); - if !Path::new("libgit2/src").exists() { -- 2.41.0 diff --git a/libgit2-sys-fix-metadata.diff b/libgit2-sys-fix-metadata.diff index e81f354..ffb9357 100644 --- a/libgit2-sys-fix-metadata.diff +++ b/libgit2-sys-fix-metadata.diff @@ -1,11 +1,11 @@ ---- libgit2-sys-0.15.2+1.6.4/Cargo.toml 1970-01-01T00:00:01+00:00 -+++ libgit2-sys-0.15.2+1.6.4/Cargo.toml 2023-07-13T11:49:40.922952+00:00 +--- libgit2-sys-0.16.1+1.7.1/Cargo.toml 1970-01-01T00:00:01+00:00 ++++ libgit2-sys-0.16.1+1.7.1/Cargo.toml 2023-09-19T19:56:54.584806+00:00 @@ -12,7 +12,7 @@ [package] edition = "2018" name = "libgit2-sys" --version = "0.15.2+1.6.4" -+version = "0.15.2" +-version = "0.16.1+1.7.1" ++version = "0.16.1" authors = [ "Josh Triplett ", "Alex Crichton ", @@ -29,4 +29,4 @@ -] [target."cfg(unix)".dependencies.openssl-sys] - version = "0.9" + version = "0.9.45" diff --git a/rust-libgit2-sys.spec b/rust-libgit2-sys.spec index 46dab43..2959af4 100644 --- a/rust-libgit2-sys.spec +++ b/rust-libgit2-sys.spec @@ -3,10 +3,10 @@ %global debug_package %{nil} %global crate libgit2-sys -%global upstream_version 0.15.2+1.6.4 +%global crate_version 0.16.1+1.7.1 Name: rust-libgit2-sys -Version: 0.15.2 +Version: 0.16.1 Release: %autorelease Summary: Native bindings to the libgit2 library @@ -16,7 +16,7 @@ Summary: Native bindings to the libgit2 library # * bundled pcre: BSD-3-Clause License: (MIT OR Apache-2.0) AND BSD-3-Clause AND GPL-2.0-only WITH GCC-exception-2.0 AND MIT URL: https://crates.io/crates/libgit2-sys -Source: %{crates_source %{crate} %{upstream_version}} +Source: %{crates_source %{crate} %{crate_version}} # Manually created patch for downstream crate metadata changes # * remove libgit2 version from version field # * update package.license field to reflect bundled dependencies @@ -36,7 +36,7 @@ Native bindings to the libgit2 library.} Summary: %{summary} BuildArch: noarch -Provides: bundled(libgit2) = 1.6.4 +Provides: bundled(libgit2) = 1.7.1 Provides: bundled(http-parser) = 2.0 Provides: bundled(pcre) = 8.44 @@ -139,7 +139,7 @@ use the "vendored" feature of the "%{crate}" crate. %ghost %{crate_instdir}/Cargo.toml %prep -%autosetup -n %{crate}-%{upstream_version} -p1 +%autosetup -n %{crate}-%{crate_version} -p1 # remove upstream development scripts from libgit2 rm -r libgit2/script/ # remove unused bundled dependencies diff --git a/sources b/sources index cf05c62..1695259 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -SHA512 (libgit2-sys-0.15.2+1.6.4.crate) = 28b66ffe6da956bd1127aef295b222b55681b25c1820e016284802531f5360e6d21c11c695be569d26a318321868a0ce0b2c848bfcc887f09f47fbaadb13b478 +SHA512 (libgit2-sys-0.16.1+1.7.1.crate) = 746e80309af40af7f6d11a7d45721054a6b7f456e10af5b25ea5ddc3ae1f8d934196e9e3b9948f7d7b41b6d9dc45a660874029a39c1c3d67307daebae3f2cb69