Add runtime warning to `stderr` when calling deprecated API
This commit is contained in:
parent
9f0ad0ed10
commit
9733790c20
|
@ -0,0 +1,30 @@
|
||||||
|
/*
|
||||||
|
Copyright Contributors to the libdnf project.
|
||||||
|
|
||||||
|
This file is part of libdnf: https://github.com/rpm-software-management/libdnf/
|
||||||
|
|
||||||
|
Libdnf is free software: you can redistribute it and/or modify
|
||||||
|
it under the terms of the GNU Lesser General Public License as published by
|
||||||
|
the Free Software Foundation, either version 2.1 of the License, or
|
||||||
|
(at your option) any later version.
|
||||||
|
|
||||||
|
Libdnf is distributed in the hope that it will be useful,
|
||||||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
GNU Lesser General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU Lesser General Public License
|
||||||
|
along with libdnf. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef LIBDNF5_UTILS_DEPRACATE_HPP
|
||||||
|
#define LIBDNF5_UTILS_DEPRACATE_HPP
|
||||||
|
|
||||||
|
#include <iostream>
|
||||||
|
|
||||||
|
#define LIBDNF5_DEPRECATED(msg) \
|
||||||
|
{ \
|
||||||
|
std::cerr << __PRETTY_FUNCTION__ << " is deprecated: " << msg << std::endl; \
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif // LIBDNF5_UTILS_DEPRACATE_HPP
|
|
@ -21,6 +21,7 @@ along with libdnf. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
#include "config_utils.hpp"
|
#include "config_utils.hpp"
|
||||||
|
#include "utils/deprecate.hpp"
|
||||||
#include "utils/system.hpp"
|
#include "utils/system.hpp"
|
||||||
|
|
||||||
#include "libdnf5/common/xdg.hpp"
|
#include "libdnf5/common/xdg.hpp"
|
||||||
|
@ -475,9 +476,11 @@ const OptionNumber<std::int32_t> & ConfigMain::get_debuglevel_option() const {
|
||||||
}
|
}
|
||||||
|
|
||||||
OptionNumber<std::int32_t> & ConfigMain::get_errorlevel_option() {
|
OptionNumber<std::int32_t> & ConfigMain::get_errorlevel_option() {
|
||||||
|
LIBDNF5_DEPRECATED("The option does nothing");
|
||||||
return p_impl->errorlevel;
|
return p_impl->errorlevel;
|
||||||
}
|
}
|
||||||
const OptionNumber<std::int32_t> & ConfigMain::get_errorlevel_option() const {
|
const OptionNumber<std::int32_t> & ConfigMain::get_errorlevel_option() const {
|
||||||
|
LIBDNF5_DEPRECATED("The option does nothing");
|
||||||
return p_impl->errorlevel;
|
return p_impl->errorlevel;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -912,9 +915,11 @@ const OptionString & ConfigMain::get_rpmverbosity_option() const {
|
||||||
}
|
}
|
||||||
|
|
||||||
OptionBool & ConfigMain::get_strict_option() {
|
OptionBool & ConfigMain::get_strict_option() {
|
||||||
|
LIBDNF5_DEPRECATED("Use get_skip_broken_option() and get_skip_unavailable_option()");
|
||||||
return p_impl->strict;
|
return p_impl->strict;
|
||||||
}
|
}
|
||||||
const OptionBool & ConfigMain::get_strict_option() const {
|
const OptionBool & ConfigMain::get_strict_option() const {
|
||||||
|
LIBDNF5_DEPRECATED("Use get_skip_broken_option() const and get_skip_unavailable_option() const");
|
||||||
return p_impl->strict;
|
return p_impl->strict;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1142,9 +1147,11 @@ const OptionString & ConfigMain::get_password_option() const {
|
||||||
}
|
}
|
||||||
|
|
||||||
OptionBool & ConfigMain::get_gpgcheck_option() {
|
OptionBool & ConfigMain::get_gpgcheck_option() {
|
||||||
|
LIBDNF5_DEPRECATED("Use get_pkg_gpgcheck_option()");
|
||||||
return p_impl->pkg_gpgcheck;
|
return p_impl->pkg_gpgcheck;
|
||||||
}
|
}
|
||||||
const OptionBool & ConfigMain::get_gpgcheck_option() const {
|
const OptionBool & ConfigMain::get_gpgcheck_option() const {
|
||||||
|
LIBDNF5_DEPRECATED("Use get_pkg_gpgcheck_option() const");
|
||||||
return p_impl->pkg_gpgcheck;
|
return p_impl->pkg_gpgcheck;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -20,6 +20,7 @@ along with libdnf. If not, see <https://www.gnu.org/licenses/>.
|
||||||
#include "libdnf5/repo/config_repo.hpp"
|
#include "libdnf5/repo/config_repo.hpp"
|
||||||
|
|
||||||
#include "conf/config_utils.hpp"
|
#include "conf/config_utils.hpp"
|
||||||
|
#include "utils/deprecate.hpp"
|
||||||
|
|
||||||
#include "libdnf5/conf/const.hpp"
|
#include "libdnf5/conf/const.hpp"
|
||||||
#include "libdnf5/utils/bgettext/bgettext-mark-domain.h"
|
#include "libdnf5/utils/bgettext/bgettext-mark-domain.h"
|
||||||
|
@ -324,9 +325,11 @@ const OptionChild<OptionStringAppendList> & ConfigRepo::get_protected_packages_o
|
||||||
}
|
}
|
||||||
|
|
||||||
OptionChild<OptionBool> & ConfigRepo::get_gpgcheck_option() {
|
OptionChild<OptionBool> & ConfigRepo::get_gpgcheck_option() {
|
||||||
|
LIBDNF5_DEPRECATED("Use get_pkg_gpgcheck_option()");
|
||||||
return p_impl->pkg_gpgcheck;
|
return p_impl->pkg_gpgcheck;
|
||||||
}
|
}
|
||||||
const OptionChild<OptionBool> & ConfigRepo::get_gpgcheck_option() const {
|
const OptionChild<OptionBool> & ConfigRepo::get_gpgcheck_option() const {
|
||||||
|
LIBDNF5_DEPRECATED("Use get_pkg_gpgcheck_option() const");
|
||||||
return p_impl->pkg_gpgcheck;
|
return p_impl->pkg_gpgcheck;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -31,6 +31,7 @@ along with libdnf. If not, see <https://www.gnu.org/licenses/>.
|
||||||
#include "solv/solver.hpp"
|
#include "solv/solver.hpp"
|
||||||
#include "solv_repo.hpp"
|
#include "solv_repo.hpp"
|
||||||
#include "utils/auth.hpp"
|
#include "utils/auth.hpp"
|
||||||
|
#include "utils/deprecate.hpp"
|
||||||
#include "utils/fs/utils.hpp"
|
#include "utils/fs/utils.hpp"
|
||||||
#include "utils/on_scope_exit.hpp"
|
#include "utils/on_scope_exit.hpp"
|
||||||
#include "utils/string.hpp"
|
#include "utils/string.hpp"
|
||||||
|
@ -607,6 +608,7 @@ void RepoSack::Impl::update_and_load_repos(libdnf5::repo::RepoQuery & repos, boo
|
||||||
|
|
||||||
|
|
||||||
void RepoSack::update_and_load_enabled_repos(bool load_system) {
|
void RepoSack::update_and_load_enabled_repos(bool load_system) {
|
||||||
|
LIBDNF5_DEPRECATED("Use load_repos() which allows specifying repo type.");
|
||||||
if (load_system) {
|
if (load_system) {
|
||||||
load_repos();
|
load_repos();
|
||||||
} else {
|
} else {
|
||||||
|
|
Loading…
Reference in New Issue