Blame SOURCES/0004-github-coreos-rpm-ostree-pr2872.patch

c44415
From eca59b67b3350d3b49db5844eb143b428c95ca37 Mon Sep 17 00:00:00 2001
c44415
From: Luca BRUNO <luca.bruno@coreos.com>
c44415
Date: Wed, 2 Jun 2021 12:40:44 +0000
c44415
Subject: [PATCH 1/2] libdnf-sys/build: gracefully handle older gpgme versions
c44415
c44415
This tries to gracefully handle environments where gpgme
c44415
library cannot be directly discovered via pkg-config.
c44415
Older gpgme versions (including 1.13) do not provide a
c44415
.pc file, so in that case the build-script attempts to
c44415
fallback to hardcoded library flags.
c44415
---
c44415
 rust/libdnf-sys/Cargo.toml | 3 ++-
c44415
 rust/libdnf-sys/build.rs   | 5 +++++
c44415
 2 files changed, 7 insertions(+), 1 deletion(-)
c44415
c44415
diff --git a/rust/libdnf-sys/Cargo.toml b/rust/libdnf-sys/Cargo.toml
c44415
index 8695ad8c08..e20f04d0c8 100644
c44415
--- a/rust/libdnf-sys/Cargo.toml
c44415
+++ b/rust/libdnf-sys/Cargo.toml
c44415
@@ -26,7 +26,8 @@ rpm = "4"
c44415
 librepo = "1"
c44415
 libsolv = "0.7"
c44415
 libsolvext = "0.7"
c44415
-gpgme = "1"
c44415
+# Older libgpgme did not provide a pkg-config file
c44415
+gpgme = { version = "1", optional = true }
c44415
 openssl = "1"
c44415
 libcurl = "7"
c44415
 sqlite3 = "3"
c44415
diff --git a/rust/libdnf-sys/build.rs b/rust/libdnf-sys/build.rs
c44415
index 43f61a3544..ec86ca6a6f 100644
c44415
--- a/rust/libdnf-sys/build.rs
c44415
+++ b/rust/libdnf-sys/build.rs
c44415
@@ -3,6 +3,7 @@ use anyhow::Result;
c44415
 
c44415
 fn main() -> Result<()> {
c44415
     let libs = system_deps::Config::new().probe()?;
c44415
+    let has_gpgme_pkgconfig = libs.get_by_name("gpgme").is_some();
c44415
 
c44415
     // first, the submodule proper
c44415
     let libdnf = cmake::Config::new("../../libdnf")
c44415
@@ -31,6 +32,10 @@ fn main() -> Result<()> {
c44415
         .always_configure(false)
c44415
         .build_target("all")
c44415
         .build();
c44415
+    // NOTE(lucab): consider using `gpgme-config` it this stops working.
c44415
+    if !has_gpgme_pkgconfig {
c44415
+        println!("cargo:rustc-link-lib=gpgme");
c44415
+    }
c44415
     println!(
c44415
         "cargo:rustc-link-search=native={}/build/libdnf",
c44415
         libdnf.display()
c44415
c44415
From d874de293c27f2ed762f212ab65fb054a8006fc3 Mon Sep 17 00:00:00 2001
c44415
From: Luca BRUNO <luca.bruno@coreos.com>
c44415
Date: Wed, 2 Jun 2021 13:10:24 +0000
c44415
Subject: [PATCH 2/2] libdnf-sys/build: auto-enable zchunk if present
c44415
c44415
This adds an optional dependencies on the `zck` library (zchunk),
c44415
and automatically forwards it to libdnf configuration.
c44415
It allows to gracefully degrade in older environments where zchunk
c44415
is not present, and also matches autoconf behavior.
c44415
---
c44415
 rust/libdnf-sys/Cargo.toml | 1 +
c44415
 rust/libdnf-sys/build.rs   | 3 +++
c44415
 2 files changed, 4 insertions(+)
c44415
c44415
diff --git a/rust/libdnf-sys/Cargo.toml b/rust/libdnf-sys/Cargo.toml
c44415
index e20f04d0c8..13e0eca318 100644
c44415
--- a/rust/libdnf-sys/Cargo.toml
c44415
+++ b/rust/libdnf-sys/Cargo.toml
c44415
@@ -34,3 +34,4 @@ sqlite3 = "3"
c44415
 modulemd = { name = "modulemd-2.0", version = "2" }
c44415
 jsonc = { name = "json-c", version = "0" }
c44415
 glib = { name = "glib-2.0", version = "2" }
c44415
+zck = { version = "0.9", optional = true }
c44415
diff --git a/rust/libdnf-sys/build.rs b/rust/libdnf-sys/build.rs
c44415
index ec86ca6a6f..df07cc7cb7 100644
c44415
--- a/rust/libdnf-sys/build.rs
c44415
+++ b/rust/libdnf-sys/build.rs
c44415
@@ -4,6 +4,7 @@ use anyhow::Result;
c44415
 fn main() -> Result<()> {
c44415
     let libs = system_deps::Config::new().probe()?;
c44415
     let has_gpgme_pkgconfig = libs.get_by_name("gpgme").is_some();
c44415
+    let with_zck: u8 = libs.get_by_name("zck").is_some().into();
c44415
 
c44415
     // first, the submodule proper
c44415
     let libdnf = cmake::Config::new("../../libdnf")
c44415
@@ -24,6 +25,8 @@ fn main() -> Result<()> {
c44415
         // We don't need docs
c44415
         .define("WITH_HTML:BOOL", "0")
c44415
         .define("WITH_MAN:BOOL", "0")
c44415
+        // Auto-enable zchunk, if present
c44415
+        .define("WITH_ZCHUNK:BOOL", format!("{}", with_zck))
c44415
         // Don't need bindings
c44415
         .define("WITH_BINDINGS:BOOL", "0")
c44415
         // Needed in Koji at least because timestamps(?)