richardphibel / rpms / libdnf

Forked from rpms/libdnf 2 years ago
Clone

Blame SOURCES/0002-Add-configuration-option-skip_if_unavailable-RhBug1689931.patch

75e666
From 7e8a01dc9408cc48700f3d2a75cff67b3364d0c5 Mon Sep 17 00:00:00 2001
75e666
From: Jaroslav Mracek <jmracek@redhat.com>
75e666
Date: Wed, 20 Mar 2019 09:06:15 +0100
75e666
Subject: [PATCH] Add configuration option skip_if_unavailable (RhBug:1689931)
75e666
75e666
---
75e666
 libdnf/conf/ConfigMain.cpp | 3 +++
75e666
 libdnf/conf/ConfigMain.hpp | 1 +
75e666
 libdnf/conf/ConfigRepo.cpp | 4 ++--
75e666
 libdnf/conf/ConfigRepo.hpp | 2 +-
75e666
 4 files changed, 7 insertions(+), 3 deletions(-)
75e666
75e666
diff --git a/libdnf/conf/ConfigMain.cpp b/libdnf/conf/ConfigMain.cpp
75e666
index 2fc1f11..39cf8ab 100644
75e666
--- a/libdnf/conf/ConfigMain.cpp
75e666
+++ b/libdnf/conf/ConfigMain.cpp
75e666
@@ -333,6 +333,7 @@ class ConfigMain::Impl {
75e666
     OptionString sslclientkey{""};
75e666
     OptionBool deltarpm{true};
75e666
     OptionNumber<std::uint32_t> deltarpm_percentage{75};
75e666
+    OptionBool skip_if_unavailable{false};
75e666
 };
75e666
 
75e666
 ConfigMain::Impl::Impl(Config & owner)
75e666
@@ -469,6 +470,7 @@ ConfigMain::Impl::Impl(Config & owner)
75e666
     owner.optBinds().add("sslclientkey", sslclientkey);
75e666
     owner.optBinds().add("deltarpm", deltarpm);
75e666
     owner.optBinds().add("deltarpm_percentage", deltarpm_percentage);
75e666
+    owner.optBinds().add("skip_if_unavailable", skip_if_unavailable);
75e666
 }
75e666
 
75e666
 ConfigMain::ConfigMain() { pImpl = std::unique_ptr<Impl>(new Impl(*this)); }
75e666
@@ -572,5 +574,6 @@ OptionString & ConfigMain::sslclientcert() { return pImpl->sslclientcert; }
75e666
 OptionString & ConfigMain::sslclientkey() { return pImpl->sslclientkey; }
75e666
 OptionBool & ConfigMain::deltarpm() { return pImpl->deltarpm; }
75e666
 OptionNumber<std::uint32_t> & ConfigMain::deltarpm_percentage() { return pImpl->deltarpm_percentage; }
75e666
+OptionBool & ConfigMain::skip_if_unavailable() { return pImpl->skip_if_unavailable; }
75e666
 
75e666
 }
75e666
diff --git a/libdnf/conf/ConfigMain.hpp b/libdnf/conf/ConfigMain.hpp
75e666
index 331cdec..c2ead25 100644
75e666
--- a/libdnf/conf/ConfigMain.hpp
75e666
+++ b/libdnf/conf/ConfigMain.hpp
75e666
@@ -151,6 +151,7 @@ public:
75e666
     OptionString & sslclientkey();
75e666
     OptionBool & deltarpm();
75e666
     OptionNumber<std::uint32_t> & deltarpm_percentage();
75e666
+    OptionBool & skip_if_unavailable();
75e666
 
75e666
 private:
75e666
     class Impl;
75e666
diff --git a/libdnf/conf/ConfigRepo.cpp b/libdnf/conf/ConfigRepo.cpp
75e666
index 43fe56b..e86cdff 100644
75e666
--- a/libdnf/conf/ConfigRepo.cpp
75e666
+++ b/libdnf/conf/ConfigRepo.cpp
75e666
@@ -71,7 +71,7 @@ class ConfigRepo::Impl {
75e666
     OptionChild<OptionString> sslclientkey{masterConfig.sslclientkey()};
75e666
     OptionChild<OptionBool> deltarpm{masterConfig.deltarpm()};
75e666
     OptionChild<OptionNumber<std::uint32_t> > deltarpm_percentage{masterConfig.deltarpm_percentage()};
75e666
-    OptionBool skip_if_unavailable{false};
75e666
+    OptionChild<OptionBool> skip_if_unavailable{masterConfig.skip_if_unavailable()};
75e666
     OptionString enabled_metadata{""};
75e666
     OptionEnum<std::string> failovermethod{"priority", {"priority", "roundrobin"}};
75e666
 };
75e666
@@ -195,7 +195,7 @@ OptionChild<OptionString> & ConfigRepo::sslclientcert() { return pImpl->sslclien
75e666
 OptionChild<OptionString> & ConfigRepo::sslclientkey() { return pImpl->sslclientkey; }
75e666
 OptionChild<OptionBool> & ConfigRepo::deltarpm() { return pImpl->deltarpm; }
75e666
 OptionChild<OptionNumber<std::uint32_t> > & ConfigRepo::deltarpm_percentage() { return pImpl->deltarpm_percentage; }
75e666
-OptionBool & ConfigRepo::skip_if_unavailable() { return pImpl->skip_if_unavailable; }
75e666
+OptionChild<OptionBool> & ConfigRepo::skip_if_unavailable() { return pImpl->skip_if_unavailable; }
75e666
 OptionString & ConfigRepo::enabled_metadata() { return pImpl->enabled_metadata; }
75e666
 OptionEnum<std::string> & ConfigRepo::failovermethod() { return pImpl->failovermethod; }
75e666
 
75e666
diff --git a/libdnf/conf/ConfigRepo.hpp b/libdnf/conf/ConfigRepo.hpp
75e666
index c3e992b..a47030b 100644
75e666
--- a/libdnf/conf/ConfigRepo.hpp
75e666
+++ b/libdnf/conf/ConfigRepo.hpp
75e666
@@ -85,7 +85,7 @@ public:
75e666
     OptionChild<OptionString> & sslclientkey();
75e666
     OptionChild<OptionBool> & deltarpm();
75e666
     OptionChild<OptionNumber<std::uint32_t> > & deltarpm_percentage();
75e666
-    OptionBool & skip_if_unavailable();
75e666
+    OptionChild<OptionBool> & skip_if_unavailable();
75e666
     // option recognized by other tools, e.g. gnome-software, but unused in dnf
75e666
     OptionString & enabled_metadata();
75e666
     // yum compatibility options
75e666
--
75e666
libgit2 0.27.7
75e666