richardphibel / rpms / libdnf

Forked from rpms/libdnf 2 years ago
Clone
Blob Blame History Raw
From d4917c293fda8f533ef57130c1a46215901f92a4 Mon Sep 17 00:00:00 2001
From: Jaroslav Mracek <jmracek@redhat.com>
Date: Wed, 3 Apr 2019 12:25:17 +0200
Subject: [PATCH] Add configuration option skip_if_unavailable (RhBug:1689931)

---
 libdnf/conf/ConfigMain.cpp | 4 ++++
 libdnf/conf/ConfigMain.hpp | 1 +
 libdnf/conf/ConfigRepo.cpp | 4 ++--
 libdnf/conf/ConfigRepo.hpp | 2 +-
 4 files changed, 8 insertions(+), 3 deletions(-)

diff --git a/libdnf/conf/ConfigMain.cpp b/libdnf/conf/ConfigMain.cpp
index aff6b87..9016e6e 100644
--- a/libdnf/conf/ConfigMain.cpp
+++ b/libdnf/conf/ConfigMain.cpp
@@ -530,6 +530,9 @@ class ConfigMain::Impl {
 
     OptionNumber<std::uint32_t> deltarpm_percentage{75};
     OptionBinding deltaRpmPercentageBinding{owner, deltarpm_percentage, "deltarpm_percentage"};
+
+    OptionBool skip_if_unavailable{false};
+    OptionBinding skip_if_unavailableBinding{owner, skip_if_unavailable, "skip_if_unavailable"};
 };
 
 ConfigMain::ConfigMain() { pImpl = std::unique_ptr<Impl>(new Impl(*this)); }
@@ -631,5 +634,6 @@ OptionString & ConfigMain::sslclientcert() { return pImpl->sslclientcert; }
 OptionString & ConfigMain::sslclientkey() { return pImpl->sslclientkey; }
 OptionBool & ConfigMain::deltarpm() { return pImpl->deltarpm; }
 OptionNumber<std::uint32_t> & ConfigMain::deltarpm_percentage() { return pImpl->deltarpm_percentage; }
+OptionBool & ConfigMain::skip_if_unavailable() { return pImpl->skip_if_unavailable; }
 
 }
diff --git a/libdnf/conf/ConfigMain.hpp b/libdnf/conf/ConfigMain.hpp
index 2aef32a..6423644 100644
--- a/libdnf/conf/ConfigMain.hpp
+++ b/libdnf/conf/ConfigMain.hpp
@@ -147,6 +147,7 @@ public:
     OptionString & sslclientkey();
     OptionBool & deltarpm();
     OptionNumber<std::uint32_t> & deltarpm_percentage();
+    OptionBool & skip_if_unavailable();
 
 private:
     class Impl;
diff --git a/libdnf/conf/ConfigRepo.cpp b/libdnf/conf/ConfigRepo.cpp
index 754401e..17f8817 100644
--- a/libdnf/conf/ConfigRepo.cpp
+++ b/libdnf/conf/ConfigRepo.cpp
@@ -162,7 +162,7 @@ class ConfigRepo::Impl {
     OptionChild<OptionNumber<std::uint32_t> > deltarpm_percentage{masterConfig.deltarpm_percentage()};
     OptionBinding deltaRpmPercentageBinding{owner, deltarpm_percentage, "deltarpm_percentage"};
 
-    OptionBool skip_if_unavailable{false};
+    OptionChild<OptionBool> skip_if_unavailable{masterConfig.skip_if_unavailable()};
     OptionBinding skipIfUnavailableBinding{owner, skip_if_unavailable, "skip_if_unavailable"};
 
     OptionString enabled_metadata{""};
@@ -216,7 +216,7 @@ OptionChild<OptionString> & ConfigRepo::sslclientcert() { return pImpl->sslclien
 OptionChild<OptionString> & ConfigRepo::sslclientkey() { return pImpl->sslclientkey; }
 OptionChild<OptionBool> & ConfigRepo::deltarpm() { return pImpl->deltarpm; }
 OptionChild<OptionNumber<std::uint32_t> > & ConfigRepo::deltarpm_percentage() { return pImpl->deltarpm_percentage; }
-OptionBool & ConfigRepo::skip_if_unavailable() { return pImpl->skip_if_unavailable; }
+OptionChild<OptionBool> & ConfigRepo::skip_if_unavailable() { return pImpl->skip_if_unavailable; }
 OptionString & ConfigRepo::enabled_metadata() { return pImpl->enabled_metadata; }
 OptionEnum<std::string> & ConfigRepo::failovermethod() { return pImpl->failovermethod; }
 
diff --git a/libdnf/conf/ConfigRepo.hpp b/libdnf/conf/ConfigRepo.hpp
index 781a40f..0f0eda3 100644
--- a/libdnf/conf/ConfigRepo.hpp
+++ b/libdnf/conf/ConfigRepo.hpp
@@ -83,7 +83,7 @@ public:
     OptionChild<OptionString> & sslclientkey();
     OptionChild<OptionBool> & deltarpm();
     OptionChild<OptionNumber<std::uint32_t> > & deltarpm_percentage();
-    OptionBool & skip_if_unavailable();
+    OptionChild<OptionBool> & skip_if_unavailable();
     // option recognized by other tools, e.g. gnome-software, but unused in dnf
     OptionString & enabled_metadata();
     // yum compatibility options
--
libgit2 0.27.7