From 70cdd5de8f72869d72d78d11eab9cd9304cb1569 Mon Sep 17 00:00:00 2001 From: Fabio Valentini Date: Tue, 7 Jun 2022 21:36:11 +0200 Subject: [PATCH] Update to version 0.13.4+1.4.2; Fixes RHBZ#2058289 --- .gitignore | 1 + .rust2rpm.conf | 9 --- ...ith-vendored-libgit2-unconditionally.patch | 39 +++++++++++ libgit2-sys-fix-metadata.diff | 26 +++++-- rust-libgit2-sys.spec | 67 ++++++++++++++----- sources | 2 +- 6 files changed, 109 insertions(+), 35 deletions(-) delete mode 100644 .rust2rpm.conf create mode 100644 0001-build-with-vendored-libgit2-unconditionally.patch diff --git a/.gitignore b/.gitignore index 716373f..db1000d 100644 --- a/.gitignore +++ b/.gitignore @@ -32,3 +32,4 @@ /libgit2-sys-0.12.21+1.1.0.crate /libgit2-sys-0.12.25+1.3.0.crate /libgit2-sys-0.12.26+1.3.0.crate +/libgit2-sys-0.13.4+1.4.2.crate diff --git a/.rust2rpm.conf b/.rust2rpm.conf deleted file mode 100644 index 1b8dd8b..0000000 --- a/.rust2rpm.conf +++ /dev/null @@ -1,9 +0,0 @@ -[DEFAULT] -buildrequires = - (pkgconfig(libgit2) >= 1.3.0 with pkgconfig(libgit2) < 2.0.0) -lib.requires = - (pkgconfig(libgit2) >= 1.3.0 with pkgconfig(libgit2) < 2.0.0) -unwanted-features = - vendored - vendored-openssl - zlib-ng-compat diff --git a/0001-build-with-vendored-libgit2-unconditionally.patch b/0001-build-with-vendored-libgit2-unconditionally.patch new file mode 100644 index 0000000..d58e39d --- /dev/null +++ b/0001-build-with-vendored-libgit2-unconditionally.patch @@ -0,0 +1,39 @@ +From 85a4c00de01f5aa340cf3246953a00fef4386cc2 Mon Sep 17 00:00:00 2001 +From: Fabio Valentini +Date: Tue, 7 Jun 2022 21:27:22 +0200 +Subject: [PATCH] build with vendored libgit2 unconditionally + +--- + build.rs | 16 ---------------- + 1 file changed, 16 deletions(-) + +diff --git a/build.rs b/build.rs +index ef0468b..f7a5b4b 100644 +--- a/build.rs ++++ b/build.rs +@@ -10,22 +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(); + +- // 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.4.0".."1.5.0") +- .print_system_libs(false) +- .probe("libgit2") +- { +- for include in &lib.include_paths { +- println!("cargo:root={}", include.display()); +- } +- return; +- } +- } +- + println!("cargo:rustc-cfg=libgit2_vendored"); + + if !Path::new("libgit2/src").exists() { +-- +2.36.1 + diff --git a/libgit2-sys-fix-metadata.diff b/libgit2-sys-fix-metadata.diff index 5d29b75..24c0166 100644 --- a/libgit2-sys-fix-metadata.diff +++ b/libgit2-sys-fix-metadata.diff @@ -1,11 +1,23 @@ ---- libgit2-sys-0.12.26+1.3.0/Cargo.toml 1970-01-01T00:00:01+00:00 -+++ libgit2-sys-0.12.26+1.3.0/Cargo.toml 2021-12-01T20:56:13.290820+00:00 +--- libgit2-sys-0.13.4+1.4.2/Cargo.toml 1970-01-01T00:00:01+00:00 ++++ libgit2-sys-0.13.4+1.4.2/Cargo.toml 2022-05-25T11:00:08.639367+00:00 @@ -12,7 +12,7 @@ [package] edition = "2018" name = "libgit2-sys" --version = "0.12.26+1.3.0" -+version = "0.12.26" - authors = ["Josh Triplett ", "Alex Crichton "] - build = "build.rs" - links = "git2" +-version = "0.13.4+1.4.2" ++version = "0.13.4" + authors = [ + "Josh Triplett ", + "Alex Crichton ", +@@ -58,11 +58,6 @@ + ssh = ["libssh2-sys"] + ssh_key_from_memory = [] + vendored = [] +-vendored-openssl = ["openssl-sys/vendored"] +-zlib-ng-compat = [ +- "libz-sys/zlib-ng", +- "libssh2-sys?/zlib-ng-compat", +-] + + [target."cfg(unix)".dependencies.openssl-sys] + version = "0.9" diff --git a/rust-libgit2-sys.spec b/rust-libgit2-sys.spec index bcffa15..f325d0f 100644 --- a/rust-libgit2-sys.spec +++ b/rust-libgit2-sys.spec @@ -1,26 +1,29 @@ -# Generated by rust2rpm 20 +# Generated by rust2rpm 21 %bcond_without check %global debug_package %{nil} %global crate libgit2-sys -%global upstream_version 0.12.26+1.3.0 +%global upstream_version 0.13.4+1.4.2 Name: rust-%{crate} -Version: 0.12.26 +Version: 0.13.4 Release: %autorelease Summary: Native bindings to the libgit2 library -# Upstream license specification: MIT/Apache-2.0 +# Upstream license specification: MIT OR Apache-2.0 License: MIT or ASL 2.0 URL: https://crates.io/crates/libgit2-sys Source: %{crates_source %{crate} %{upstream_version}} # Initial patched metadata -# * Remove libgit2 version from version field +# * remove libgit2 version from version field Patch0: libgit2-sys-fix-metadata.diff +# * build against the bundled copy of libgit2 unconditionally: +# the version in the Fedora repositories is too old +Patch1: 0001-build-with-vendored-libgit2-unconditionally.patch ExclusiveArch: %{rust_arches} -BuildRequires: rust-packaging +BuildRequires: rust-packaging >= 21 %global _description %{expand: Native bindings to the libgit2 library.} @@ -30,7 +33,15 @@ Native bindings to the libgit2 library.} %package devel Summary: %{summary} BuildArch: noarch -Requires: (pkgconfig(libgit2) >= 1.3.0 with pkgconfig(libgit2) < 2.0.0) + +# libgit2: GPLv2 with exceptions +Provides: bundled(libgit2) = 1.4.2 +# http-parser: MIT +Provides: bundled(http-parser) = 2.0 +# pcre: BSD +Provides: bundled(pcre) = 8.44 + +License: MIT and GPLv2 with exceptions and BSD %description devel %{_description} @@ -38,8 +49,12 @@ This package contains library source intended for building other packages which use the "%{crate}" crate. %files devel -%license LICENSE-APACHE LICENSE-MIT -%{cargo_registry}/%{crate}-%{version_no_tilde}/ +%license %{crate_instdir}/LICENSE-APACHE +%license %{crate_instdir}/LICENSE-MIT +%license %{crate_instdir}/libgit2/COPYING +%license %{crate_instdir}/libgit2/deps/http-parser/COPYING +%license %{crate_instdir}/libgit2/deps/pcre/LICENCE +%{crate_instdir}/ %package -n %{name}+default-devel Summary: %{summary} @@ -51,7 +66,7 @@ This package contains library source intended for building other packages which use the "default" feature of the "%{crate}" crate. %files -n %{name}+default-devel -%ghost %{cargo_registry}/%{crate}-%{version_no_tilde}/Cargo.toml +%ghost %{crate_instdir}/Cargo.toml %package -n %{name}+https-devel Summary: %{summary} @@ -63,7 +78,7 @@ This package contains library source intended for building other packages which use the "https" feature of the "%{crate}" crate. %files -n %{name}+https-devel -%ghost %{cargo_registry}/%{crate}-%{version_no_tilde}/Cargo.toml +%ghost %{crate_instdir}/Cargo.toml %package -n %{name}+libssh2-sys-devel Summary: %{summary} @@ -75,7 +90,7 @@ This package contains library source intended for building other packages which use the "libssh2-sys" feature of the "%{crate}" crate. %files -n %{name}+libssh2-sys-devel -%ghost %{cargo_registry}/%{crate}-%{version_no_tilde}/Cargo.toml +%ghost %{crate_instdir}/Cargo.toml %package -n %{name}+openssl-sys-devel Summary: %{summary} @@ -87,7 +102,7 @@ This package contains library source intended for building other packages which use the "openssl-sys" feature of the "%{crate}" crate. %files -n %{name}+openssl-sys-devel -%ghost %{cargo_registry}/%{crate}-%{version_no_tilde}/Cargo.toml +%ghost %{crate_instdir}/Cargo.toml %package -n %{name}+ssh-devel Summary: %{summary} @@ -99,7 +114,7 @@ This package contains library source intended for building other packages which use the "ssh" feature of the "%{crate}" crate. %files -n %{name}+ssh-devel -%ghost %{cargo_registry}/%{crate}-%{version_no_tilde}/Cargo.toml +%ghost %{crate_instdir}/Cargo.toml %package -n %{name}+ssh_key_from_memory-devel Summary: %{summary} @@ -111,17 +126,33 @@ This package contains library source intended for building other packages which use the "ssh_key_from_memory" feature of the "%{crate}" crate. %files -n %{name}+ssh_key_from_memory-devel -%ghost %{cargo_registry}/%{crate}-%{version_no_tilde}/Cargo.toml +%ghost %{crate_instdir}/Cargo.toml + +%package -n %{name}+vendored-devel +Summary: %{summary} +BuildArch: noarch + +%description -n %{name}+vendored-devel %{_description} + +This package contains library source intended for building other packages which +use the "vendored" feature of the "%{crate}" crate. + +%files -n %{name}+vendored-devel +%ghost %{crate_instdir}/Cargo.toml %prep %autosetup -n %{crate}-%{upstream_version} -p1 -# Remove bundled dependencies -rm -vrf libgit2 +# remove upstream development scripts from libgit2 +rm -r libgit2/script/ +# remove unused bundled dependencies +rm -r libgit2/deps/chromium-zlib +rm -r libgit2/deps/ntlmclient +rm -r libgit2/deps/winhttp +rm -r libgit2/deps/zlib %cargo_prep %generate_buildrequires %cargo_generate_buildrequires -echo '(pkgconfig(libgit2) >= 1.3.0 with pkgconfig(libgit2) < 2.0.0)' %build %cargo_build diff --git a/sources b/sources index 546d1a1..06cbd9b 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -SHA512 (libgit2-sys-0.12.26+1.3.0.crate) = de30865b3d4ab0288e090381e5646e3e8028c341fac93014168fcfa5f166f7fbad9fc4ebd285919247cc6bac178658eb936ea1fdf168068248be07ad34ecc54d +SHA512 (libgit2-sys-0.13.4+1.4.2.crate) = 71e3f4ed8a123109ae1f0cfaad90092bbea25658356e6eaee3135d4576ffcfadd83ada28367459dd70903ddce716bed6278388e294e13712dcbcf8202e884548