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

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