diff --git a/CHANGELOG.md b/CHANGELOG.md index 02ffb3ebb..6e7dd7dae 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -89,7 +89,7 @@ - modules: Simplify finding whether profile is default in module list - modules: Fix `ModuleProfile::is_default` method - modules: Store if profile is default in ModuleProfile object -- Generate docs for undocummented functions so they at least show up +- Generate docs for undocumented functions so they at least show up - Add python advisory docs - Add advisory python API tests - Enable AdvisoryModule bindings @@ -176,7 +176,7 @@ - Abort PGP checking immediately if any checks fail - Display warning message when any PGP checks skipped - Don't allow main gpgcheck=0 to override repo config -- gups and environments to `history info` ouput +- gups and environments to `history info` output - Store missing id and repoid in db for groups/environments - Fix out-of-bounds access in Goal::Impl::add_install_to_goal - Fix repoquery `--list` diff --git a/bindings/libdnf5/common.i b/bindings/libdnf5/common.i index f37cd8f70..6a03c9f6c 100644 --- a/bindings/libdnf5/common.i +++ b/bindings/libdnf5/common.i @@ -134,6 +134,35 @@ del ClassName##__iter__ #endif %enddef +%define add_str(ClassName) +#if defined(SWIGPYTHON) +%extend ClassName { + std::string __str__() const { + return $self->to_string(); + } +} +#endif +%enddef + +%define add_repr(ClassName) +#if defined(SWIGPYTHON) +%extend ClassName { + std::string __repr__() const { + return $self->to_string_description(); + } +} +#endif +%enddef + +%define add_hash(ClassName) +#if defined(SWIGPYTHON) +%extend ClassName { + int __hash__() const { + return $self->get_hash(); + } +} +#endif +%enddef %{ #include "libdnf5/common/sack/query.hpp" diff --git a/bindings/libdnf5/rpm.i b/bindings/libdnf5/rpm.i index 12f5f0fed..fb8d36872 100644 --- a/bindings/libdnf5/rpm.i +++ b/bindings/libdnf5/rpm.i @@ -29,6 +29,7 @@ } } + %{ #include "libdnf5/rpm/arch.hpp" #include "libdnf5/rpm/checksum.hpp" @@ -61,12 +62,19 @@ %include "libdnf5/rpm/package_sack.hpp" %template(PackageSackWeakPtr) libdnf5::WeakPtr; +add_str(libdnf5::rpm::Reldep) +add_repr(libdnf5::rpm::Reldep) +add_hash(libdnf5::rpm::Reldep) %include "libdnf5/rpm/reldep.hpp" %rename(next) libdnf5::rpm::ReldepListIterator::operator++(); %rename(value) libdnf5::rpm::ReldepListIterator::operator*(); %include "libdnf5/rpm/reldep_list_iterator.hpp" %include "libdnf5/rpm/reldep_list.hpp" + +add_str(libdnf5::rpm::Package) +add_repr(libdnf5::rpm::Package) +add_hash(libdnf5::rpm::Package) %include "libdnf5/rpm/package.hpp" %template(VectorPackage) std::vector; diff --git a/bindings/perl5/CMakeLists.txt b/bindings/perl5/CMakeLists.txt index 1419b1848..29621652f 100644 --- a/bindings/perl5/CMakeLists.txt +++ b/bindings/perl5/CMakeLists.txt @@ -59,7 +59,7 @@ elseif(PERL_INSTALLDIRS STREQUAL "vendor") elseif(PERL_INSTALLDIRS STREQUAL "site") set(PERL_INSTALL_PATH "${PERL_SITEARCH}") else() - message(FATAL_ERROR "Uknown PERL_INSTALLDIRS value: ${PERL_INSTALLDIRS}") + message(FATAL_ERROR "Unknown PERL_INSTALLDIRS value: ${PERL_INSTALLDIRS}") endif() message(STATUS "Perl5 files will be installed to ${PERL_INSTALL_PATH}") diff --git a/bindings/python3/CMakeLists.txt b/bindings/python3/CMakeLists.txt index b45f47ad8..addc6b8ef 100644 --- a/bindings/python3/CMakeLists.txt +++ b/bindings/python3/CMakeLists.txt @@ -15,16 +15,16 @@ function(add_python3_module LIBRARY_NAME MODULE_NAME) set(SWIG_COMPILE_OPTIONS ${SWIG_COMPILE_OPTIONS} -Wno-redundant-decls ) - # Currenly the SWIG_PYTHON_SILENT_MEMLEAK controls only whether message: + # Currently the SWIG_PYTHON_SILENT_MEMLEAK controls only whether message: # "swig/python detected a memory leak of type '%s', no destructor found." is printed, used here: # https://github.com/swig/swig/blob/33f6a2d0b2c3d90b928f56ddfa599afe87903f76/Lib/python/pyrun.swg#L776 - # We want to supress this message due to a bug in Python part of swig. + # We want to suppress this message due to a bug in Python part of swig. # The core of the issue is that Python Swig has a global list of types used in all swig modules. This is # needed because the modules are interlinked eg. libdnf5::Base is used in all of them. During finalization # of the Python runtime unused modules are cleaned up before garbage collector runs and cleans global objects. - # This can result in a situation where for example libdnf5.advisory module is destoyed, removing its types - # from the global swig types list includeing libdnf5.base.Base, and only after that a global libdnf5.base.Base - # is garbage collected which is now missing type information -> no destructor can be called -> swig want's to + # This can result in a situation where for example libdnf5.advisory module is destroyed, removing its types + # from the global swig types list including libdnf5.base.Base, and only after that a global libdnf5.base.Base + # is garbage collected which is now missing type information -> no destructor can be called -> swig wants to # print the message # There is an issue reported on SWIG with the same root cause: https://github.com/swig/swig/issues/2037 it # also contains more details. diff --git a/common/utils/regex.hpp b/common/utils/regex.hpp index 1ce2c153c..d8039cbf1 100644 --- a/common/utils/regex.hpp +++ b/common/utils/regex.hpp @@ -21,7 +21,7 @@ along with libdnf. If not, see . #define LIBDNF5_UTILS_REGEX_HPP -// Limit the string legth, because GCC std::regex_match() exhausts a stack on very long strings. +// Limit the string length, because GCC std::regex_match() exhausts a stack on very long strings. #define MAX_STRING_LENGTH_FOR_REGEX_MATCH 2 << 10 diff --git a/dnf5-plugins/builddep_plugin/builddep.cpp b/dnf5-plugins/builddep_plugin/builddep.cpp index 49d5d079c..b75b009b6 100644 --- a/dnf5-plugins/builddep_plugin/builddep.cpp +++ b/dnf5-plugins/builddep_plugin/builddep.cpp @@ -270,7 +270,7 @@ void BuildDepCommand::run() { auto goal = get_context().get_goal(); goal->set_allow_erasing(allow_erasing->get_value()); - // Search only for solution in provides and files. Use buildrequire with name search migh result in inconsistent + // Search only for solution in provides and files. Use buildrequire with name search might result in inconsistent // behavior with installing dependencies of RPMs libdnf5::GoalJobSettings settings; settings.with_nevra = false; diff --git a/dnf5-plugins/config-manager_plugin/addrepo.cpp b/dnf5-plugins/config-manager_plugin/addrepo.cpp index 9ab306a46..80c129c4c 100644 --- a/dnf5-plugins/config-manager_plugin/addrepo.cpp +++ b/dnf5-plugins/config-manager_plugin/addrepo.cpp @@ -181,7 +181,8 @@ void ConfigManagerAddRepoCommand::set_argument_parser() { const char * value) { auto val = strchr(value + 1, '='); if (!val) { - throw cli::ArgumentParserError(M_("set: Badly formatted argument value \"{}\""), std::string{value}); + throw cli::ArgumentParserError( + M_("{}: Badly formatted argument value \"{}\""), std::string{"set"}, std::string{value}); } std::string key{value, val}; std::string key_value{val + 1}; diff --git a/dnf5-plugins/config-manager_plugin/addrepo.hpp b/dnf5-plugins/config-manager_plugin/addrepo.hpp index 702b62013..254afb989 100644 --- a/dnf5-plugins/config-manager_plugin/addrepo.hpp +++ b/dnf5-plugins/config-manager_plugin/addrepo.hpp @@ -71,7 +71,7 @@ class ConfigManagerAddRepoCommand : public Command { /// Tests if the repositories IDs in the vector do not already exist in the configuration. /// @param repo_ids List of repositories IDs to check. - /// @param ignore_path The file in this path will be ignored/skiped. + /// @param ignore_path The file in this path will be ignored/skipped. /// @throws ConfigManagerError Trown if an already existent repository ID was found. void test_if_ids_not_already_exist( const std::vector & repo_ids, const std::filesystem::path & ignore_path) const; diff --git a/dnf5-plugins/config-manager_plugin/setopt.cpp b/dnf5-plugins/config-manager_plugin/setopt.cpp index 96c7adc37..7a117c38a 100644 --- a/dnf5-plugins/config-manager_plugin/setopt.cpp +++ b/dnf5-plugins/config-manager_plugin/setopt.cpp @@ -79,7 +79,8 @@ void ConfigManagerSetOptCommand::set_argument_parser() { auto value = argv[i]; auto val = strchr(value + 1, '='); if (!val) { - throw cli::ArgumentParserError(M_("optval: Badly formatted argument value \"{}\""), std::string{value}); + throw cli::ArgumentParserError( + M_("{}: Badly formatted argument value \"{}\""), std::string{"optval"}, std::string{value}); } std::string key{value, val}; std::string key_value{val + 1}; @@ -87,15 +88,16 @@ void ConfigManagerSetOptCommand::set_argument_parser() { if (dot_pos != std::string::npos) { if (dot_pos == key.size() - 1) { throw cli::ArgumentParserError( - M_("optval: Badly formatted argument value: Last key character cannot be '.': {}"), + M_("{}: Badly formatted argument value: Last key character cannot be '.': {}"), + std::string{"optval"}, std::string{value}); } - // Save the repository option for later processing (solving glob patter, writing to file). + // Save the repository option for later processing (solving glob pattern, writing to file). auto repo_id = key.substr(0, dot_pos); if (repo_id.empty()) { throw cli::ArgumentParserError( - M_("optval: Empty repository id is not allowed: {}"), std::string{value}); + M_("{}: Empty repository id is not allowed: {}"), std::string{"optval"}, std::string{value}); } auto repo_key = key.substr(dot_pos + 1); diff --git a/dnf5-plugins/config-manager_plugin/setvar.cpp b/dnf5-plugins/config-manager_plugin/setvar.cpp index 8002d3253..2f9911cb1 100644 --- a/dnf5-plugins/config-manager_plugin/setvar.cpp +++ b/dnf5-plugins/config-manager_plugin/setvar.cpp @@ -46,7 +46,7 @@ void ConfigManagerSetVarCommand::set_argument_parser() { auto val = strchr(value + 1, '='); if (!val) { throw cli::ArgumentParserError( - M_("varval: Badly formatted argument value \"{}\""), std::string{value}); + M_("{}: Badly formatted argument value \"{}\""), std::string{"varval"}, std::string{value}); } std::string var_name{value, val}; std::string var_value{val + 1}; diff --git a/dnf5-plugins/config-manager_plugin/unsetopt.cpp b/dnf5-plugins/config-manager_plugin/unsetopt.cpp index 9a8e560de..316008625 100644 --- a/dnf5-plugins/config-manager_plugin/unsetopt.cpp +++ b/dnf5-plugins/config-manager_plugin/unsetopt.cpp @@ -62,15 +62,18 @@ void ConfigManagerUnsetOptCommand::set_argument_parser() { if (dot_pos != std::string::npos) { if (dot_pos == key.size() - 1) { throw cli::ArgumentParserError( - M_("remove-opt: Badly formatted argument value: Last key character cannot be '.': {}"), + M_("{}: Badly formatted argument value: Last key character cannot be '.': {}"), + std::string{"remove-opt"}, std::string{value}); } - // Save the repository option for later processing (solving glob patter, writing to file). + // Save the repository option for later processing (solving glob pattern, writing to file). auto repo_id = key.substr(0, dot_pos); if (repo_id.empty()) { throw cli::ArgumentParserError( - M_("remove-opt: Empty repository id is not allowed: {}"), std::string{value}); + M_("{}: Empty repository id is not allowed: {}"), + std::string{"remove-opt"}, + std::string{value}); } auto repo_key = key.substr(dot_pos + 1); diff --git a/dnf5-plugins/copr_plugin/copr.cpp b/dnf5-plugins/copr_plugin/copr.cpp index 47280f0d1..ce6efd37c 100644 --- a/dnf5-plugins/copr_plugin/copr.cpp +++ b/dnf5-plugins/copr_plugin/copr.cpp @@ -62,7 +62,7 @@ void CoprCommand::register_subcommands() { std::string CoprSubCommandWithID::get_project_spec() { - // The HUB specified in the COPR SPEC arguement has precedence + // The HUB specified in the COPR SPEC argument has precedence // over the --hub argument. std::string hubspec = opt_hub; if (hubspec.empty()) diff --git a/dnf5.spec b/dnf5.spec index 4dc8b0597..4d210cade 100644 --- a/dnf5.spec +++ b/dnf5.spec @@ -287,6 +287,7 @@ It supports RPM packages, modulemd modules, and comps groups & environments. %{_mandir}/man8/dnf5-search.8.* %{_mandir}/man8/dnf5-swap.8.* %{_mandir}/man8/dnf5-upgrade.8.* +%{_mandir}/man7/dnf5-aliases.7.* %{_mandir}/man7/dnf5-caching.7.* %{_mandir}/man7/dnf5-comps.7.* # TODO(jkolarik): filtering is not ready yet @@ -362,7 +363,7 @@ Requires: libdnf5-devel%{?_isa} = %{version}-%{release} Requires: libdnf5-cli-devel%{?_isa} = %{version}-%{release} %description -n dnf5-devel -Develpment files for dnf5. +Development files for dnf5. %files -n dnf5-devel %{_includedir}/dnf5/ diff --git a/dnf5/cmdline_aliases.cpp b/dnf5/cmdline_aliases.cpp index 286e1b5d0..cd974ce95 100644 --- a/dnf5/cmdline_aliases.cpp +++ b/dnf5/cmdline_aliases.cpp @@ -82,7 +82,7 @@ bool attach_named_args( } if (!attached_arg_id_path) { auto msg = fmt::format( - "Mising attribute \"id_path\" for alias \"{}\" in file \"{}\"", alias_id_path, path.native()); + "Missing attribute \"id_path\" for alias \"{}\" in file \"{}\"", alias_id_path, path.native()); logger.error("{}", msg); std::cerr << msg << std::endl; return false; @@ -124,7 +124,7 @@ void load_aliases_from_toml_file(Context & context, const fs::path & config_file std::cerr << msg << std::endl; return; } catch (const std::out_of_range & e) { - auto msg = fmt::format("Mising attribute \"version\" in file \"{}\"", config_file_path.native()); + auto msg = fmt::format("Missing attribute \"version\" in file \"{}\"", config_file_path.native()); logger->error("{}", msg); std::cerr << msg << std::endl; return; @@ -173,7 +173,7 @@ void load_aliases_from_toml_file(Context & context, const fs::path & config_file } catch (const libdnf5::cli::ArgumentParserNotFoundError & e) { auto location = element_options.location(); auto msg = fmt::format( - "Parent commant \"{}\" not found: {}: Requested in file \"{}\" on line {}: {}", + "Parent command \"{}\" not found: {}: Requested in file \"{}\" on line {}: {}", element_parent_id_path, e.what(), config_file_path.native(), @@ -211,7 +211,7 @@ void load_aliases_from_toml_file(Context & context, const fs::path & config_file } } catch (const std::out_of_range & e) { auto msg = fmt::format( - "Mising attribute \"type\" for element \"{}\" in file \"{}\"", + "Missing attribute \"type\" for element \"{}\" in file \"{}\"", element_id_path, config_file_path.native()); logger->error("{}", msg); @@ -288,7 +288,7 @@ void load_aliases_from_toml_file(Context & context, const fs::path & config_file if (!header) { auto msg = fmt::format( - "Mising attribute \"header\" for element \"{}\" in file \"{}\"", + "Missing attribute \"header\" for element \"{}\" in file \"{}\"", element_id_path, config_file_path.native()); logger->error("{}", msg); @@ -391,7 +391,7 @@ void load_aliases_from_toml_file(Context & context, const fs::path & config_file if (!source) { auto msg = fmt::format( - "Mising attribute \"source\" for named argument \"{}\" in file \"{}\"", + "Missing attribute \"source\" for named argument \"{}\" in file \"{}\"", element_id_path, config_file_path.native()); logger->error("{}", msg); @@ -604,7 +604,7 @@ void load_aliases_from_toml_file(Context & context, const fs::path & config_file if (!attached_command) { auto msg = fmt::format( - "Mising attribute \"attached_command\" for command \"{}\" in file \"{}\"", + "Missing attribute \"attached_command\" for command \"{}\" in file \"{}\"", element_id_path, config_file_path.native()); logger->error("{}", msg); diff --git a/dnf5/commands/download/download.cpp b/dnf5/commands/download/download.cpp index e84e2b66e..5a65ce3ca 100644 --- a/dnf5/commands/download/download.cpp +++ b/dnf5/commands/download/download.cpp @@ -66,6 +66,9 @@ void DownloadCommand::set_argument_parser() { alldeps_option = dynamic_cast( parser.add_init_value(std::unique_ptr(new libdnf5::OptionBool(false)))); + url_option = dynamic_cast( + parser.add_init_value(std::unique_ptr(new libdnf5::OptionBool(false)))); + auto resolve = parser.add_new_named_arg("resolve"); resolve->set_long_name("resolve"); resolve->set_description("Resolve and download needed dependencies"); @@ -85,7 +88,6 @@ void DownloadCommand::set_argument_parser() { url->set_const_value("true"); url->link_value(url_option); - urlprotocol_valid_options = {"http", "https", "rsync", "ftp"}; urlprotocol_option = {}; auto urlprotocol = parser.add_new_named_arg("urlprotocol"); @@ -104,6 +106,7 @@ void DownloadCommand::set_argument_parser() { urlprotocol_option.emplace(value); return true; }); + cmd.register_named_arg(alldeps); create_destdir_option(*this); cmd.register_named_arg(resolve); @@ -175,40 +178,37 @@ void DownloadCommand::run() { } } - if (!download_pkgs.empty()) { - libdnf5::repo::PackageDownloader downloader(ctx.base); - - // for download command, we don't want to mark the packages for removal - downloader.force_keep_packages(true); - - for (auto & [nevra, pkg] : download_pkgs) { - downloader.add(pkg); - if (url_option->get_value()) { - // If no urlprotocols are specified, then any urlprotocol is acceptable - if (urlprotocol_option.empty()) { - urlprotocol_option = urlprotocol_valid_options; - } - for (auto & [nerva, pkg] : download_pkgs) { - auto urls = pkg.get_remote_locations(); - libdnf_assert(!urls.empty(), "Failed to get mirror for package: \"{}\"", pkg.get_name()); - auto valid_url = std::find_if(urls.begin(), urls.end(), [this](std::string url) { - for (auto protocol : urlprotocol_option) { - if (url.starts_with(protocol)) { - return true; - } + if (download_pkgs.empty()) { + return; + } + for (auto & [nevra, pkg] : download_pkgs) { + downloader.add(pkg); + if (url_option->get_value()) { + // If no urlprotocols are specified, then any urlprotocol is acceptable + if (urlprotocol_option.empty()) { + urlprotocol_option = urlprotocol_valid_options; + } + for (auto & [nerva, pkg] : download_pkgs) { + auto urls = pkg.get_remote_locations(); + libdnf_assert(!urls.empty(), "Failed to get mirror for package: \"{}\"", pkg.get_name()); + auto valid_url = std::find_if(urls.begin(), urls.end(), [this](std::string url) { + for (auto protocol : urlprotocol_option) { + if (url.starts_with(protocol)) { + return true; } - return false; - }); - if (valid_url == urls.end()) { - libdnf_assert(true, "Failed to get mirror for package: \"{}\"", pkg.get_name()); } - std::cout << *valid_url << std::endl; + return false; + }); + if (valid_url == urls.end()) { + libdnf_assert(true, "Failed to get mirror for package: \"{}\"", pkg.get_name()); } - - std::cout << "Downloading Packages:" << std::endl; - downloader.download(); - std::cout << std::endl; + std::cout << *valid_url << std::endl; } + + std::cout << "Downloading Packages:" << std::endl; + downloader.download(); + std::cout << std::endl; } + } } // namespace dnf5 diff --git a/dnf5/commands/download/download.hpp b/dnf5/commands/download/download.hpp index e74e85b1f..9c787587f 100644 --- a/dnf5/commands/download/download.hpp +++ b/dnf5/commands/download/download.hpp @@ -45,6 +45,7 @@ class DownloadCommand : public Command { std::set urlprotocol_option; libdnf5::OptionBool * resolve_option{nullptr}; libdnf5::OptionBool * alldeps_option{nullptr}; + libdnf5::OptionBool * url_option{nullptr}; std::vector> * patterns_to_download_options{nullptr}; }; diff --git a/dnf5/commands/group/group_install.cpp b/dnf5/commands/group/group_install.cpp index 0c14c787b..a8cfd0383 100644 --- a/dnf5/commands/group/group_install.cpp +++ b/dnf5/commands/group/group_install.cpp @@ -39,6 +39,7 @@ void GroupInstallCommand::set_argument_parser() { no_packages = std::make_unique(*this); group_specs = std::make_unique(*this, ArgumentParser::PositionalArg::AT_LEAST_ONE); + allow_erasing = std::make_unique(*this); auto skip_unavailable = std::make_unique(*this); auto skip_broken = std::make_unique(*this); create_allow_downgrade_options(*this); @@ -56,6 +57,7 @@ void GroupInstallCommand::configure() { void GroupInstallCommand::run() { auto & ctx = get_context(); auto goal = ctx.get_goal(); + goal->set_allow_erasing(allow_erasing->get_value()); libdnf5::GoalJobSettings settings; if (no_packages->get_value()) { diff --git a/dnf5/commands/group/group_install.hpp b/dnf5/commands/group/group_install.hpp index d09d17c3a..a93c6ef80 100644 --- a/dnf5/commands/group/group_install.hpp +++ b/dnf5/commands/group/group_install.hpp @@ -23,6 +23,7 @@ along with libdnf. If not, see . #include "arguments.hpp" #include +#include #include #include @@ -38,6 +39,8 @@ class GroupInstallCommand : public Command { void configure() override; void run() override; + std::unique_ptr allow_erasing; + std::unique_ptr with_optional{nullptr}; std::unique_ptr no_packages{nullptr}; std::unique_ptr group_specs{nullptr}; diff --git a/dnf5/commands/group/group_remove.cpp b/dnf5/commands/group/group_remove.cpp index 2b2bf569f..5938ca0b3 100644 --- a/dnf5/commands/group/group_remove.cpp +++ b/dnf5/commands/group/group_remove.cpp @@ -57,6 +57,9 @@ void GroupRemoveCommand::run() { for (const auto & spec : group_specs->get_value()) { goal->add_group_remove(spec, libdnf5::transaction::TransactionItemReason::USER, settings); } + + // To enable removal of dependency packages it requires to use allow_erasing + goal->set_allow_erasing(true); } } // namespace dnf5 diff --git a/dnf5/commands/group/group_upgrade.cpp b/dnf5/commands/group/group_upgrade.cpp index 93f6c275b..940f3f31e 100644 --- a/dnf5/commands/group/group_upgrade.cpp +++ b/dnf5/commands/group/group_upgrade.cpp @@ -37,6 +37,7 @@ void GroupUpgradeCommand::set_argument_parser() { group_specs = std::make_unique(*this, ArgumentParser::PositionalArg::AT_LEAST_ONE); + allow_erasing = std::make_unique(*this); auto skip_unavailable = std::make_unique(*this); create_allow_downgrade_options(*this); } @@ -52,7 +53,7 @@ void GroupUpgradeCommand::configure() { void GroupUpgradeCommand::run() { auto & ctx = get_context(); auto goal = ctx.get_goal(); - goal->set_allow_erasing(true); + goal->set_allow_erasing(allow_erasing->get_value()); libdnf5::GoalJobSettings settings; for (const auto & spec : group_specs->get_value()) { diff --git a/dnf5/commands/group/group_upgrade.hpp b/dnf5/commands/group/group_upgrade.hpp index 5506e02a5..dd1a1c3f4 100644 --- a/dnf5/commands/group/group_upgrade.hpp +++ b/dnf5/commands/group/group_upgrade.hpp @@ -23,6 +23,7 @@ along with libdnf. If not, see . #include "arguments.hpp" #include +#include #include #include @@ -38,6 +39,8 @@ class GroupUpgradeCommand : public Command { void configure() override; void run() override; + std::unique_ptr allow_erasing; + std::unique_ptr group_specs{nullptr}; }; diff --git a/dnf5/commands/history/history_store.cpp b/dnf5/commands/history/history_store.cpp index 0d3019f92..9cba0f036 100644 --- a/dnf5/commands/history/history_store.cpp +++ b/dnf5/commands/history/history_store.cpp @@ -60,7 +60,7 @@ void HistoryStoreCommand::run() { if (std::filesystem::exists(tmp_path)) { std::cout << libdnf5::utils::sformat( _("File \"{}\" already exists, it will be overwritten.\n"), tmp_path.string()); - // ask user for the file overwride confirmation + // ask user for the file overwrite confirmation if (!libdnf5::cli::utils::userconfirm::userconfirm(get_context().base.get_config())) { throw libdnf5::cli::AbortedByUserError(); } diff --git a/dnf5/commands/list/list.cpp b/dnf5/commands/list/list.cpp index cb8db2cd2..524afd7b9 100644 --- a/dnf5/commands/list/list.cpp +++ b/dnf5/commands/list/list.cpp @@ -109,7 +109,7 @@ void ListCommand::set_argument_parser() { } void ListCommand::configure() { - // TODO(mblaha): do not force expired metadata sync if not explicitely required + // TODO(mblaha): do not force expired metadata sync if not explicitly required pkg_narrow = PkgNarrow::ALL; Context::LoadAvailableRepos load_available = Context::LoadAvailableRepos::ENABLED; bool load_system = true; diff --git a/dnf5/commands/repoquery/repoquery.cpp b/dnf5/commands/repoquery/repoquery.cpp index 8c1d2dc6a..fa3f11176 100644 --- a/dnf5/commands/repoquery/repoquery.cpp +++ b/dnf5/commands/repoquery/repoquery.cpp @@ -43,7 +43,7 @@ libdnf5::rpm::PackageQuery repeat_filter( libdnf5::rpm::PackageQuery & candidates, const std::vector & arches) { // Create source query of all considered packages. - // To match dnf4 take arch filter into acccount. + // To match dnf4 take arch filter into account. // (filtering by repo and available/installed is done implicitly by loading only the required metadata) libdnf5::rpm::PackageQuery all_considered(candidates.get_base()); if (!arches.empty()) { diff --git a/dnf5/library.cpp b/dnf5/library.cpp index 978e576e1..fdf652b74 100644 --- a/dnf5/library.cpp +++ b/dnf5/library.cpp @@ -28,7 +28,7 @@ namespace dnf5::utils { Library::Library(const std::string & path) : path(path) { handle = dlopen(path.c_str(), RTLD_LAZY); if (!handle) { - const char * err_msg = dlerror(); // returns localized mesage, problem with later translation + const char * err_msg = dlerror(); // returns localized message, problem with later translation throw std::runtime_error( libdnf5::utils::sformat(_("Cannot load shared library \"{}\": {}"), path, std::string(err_msg))); } @@ -42,7 +42,7 @@ void * Library::get_address(const char * symbol) const { dlerror(); // Clear any existing error void * address = dlsym(handle, symbol); if (!address) { - const char * err_msg = dlerror(); // returns localized mesage, problem with later translation + const char * err_msg = dlerror(); // returns localized message, problem with later translation if (err_msg) { throw std::runtime_error(libdnf5::utils::sformat( _("Cannot obtain address of symbol \"{}\": {}"), std::string(symbol), std::string(err_msg))); diff --git a/dnf5/main.cpp b/dnf5/main.cpp index ab1b87022..d8c57abe3 100644 --- a/dnf5/main.cpp +++ b/dnf5/main.cpp @@ -224,14 +224,15 @@ void RootCommand::set_argument_parser() { auto val = strchr(value + 1, '='); if (!val) { throw libdnf5::cli::ArgumentParserError( - M_("setopt: Badly formatted argument value \"{}\""), std::string(value)); + M_("{}: Badly formatted argument value \"{}\""), std::string{"setopt"}, std::string(value)); } auto key = std::string(value, val); auto dot_pos = key.rfind('.'); if (dot_pos != std::string::npos) { if (dot_pos == key.size() - 1) { throw libdnf5::cli::ArgumentParserError( - M_("setopt: Badly formatted argument value: Last key character cannot be '.': {}"), + M_("{}: Badly formatted argument value: Last key character cannot be '.': {}"), + std::string{"setopt"}, std::string(value)); } // Store repository option to vector. Use it later when repositories configuration will be loaded. @@ -262,7 +263,7 @@ void RootCommand::set_argument_parser() { auto val = strchr(value + 1, '='); if (!val) { throw libdnf5::cli::ArgumentParserError( - M_("setvar: Badly formatted argument value \"{}\""), std::string(value)); + M_("{}: Badly formatted argument value \"{}\""), std::string{"setvar"}, std::string(value)); } auto name = std::string(value, val); try { diff --git a/dnf5daemon-client/CMakeLists.txt b/dnf5daemon-client/CMakeLists.txt index 0cd14221f..bf32c1aee 100644 --- a/dnf5daemon-client/CMakeLists.txt +++ b/dnf5daemon-client/CMakeLists.txt @@ -10,7 +10,7 @@ set(GETTEXT_DOMAIN dnf5daemon-client) add_definitions(-DGETTEXT_DOMAIN=\"${GETTEXT_DOMAIN}\") include_directories(.) -# TODO(mblaha) workround for dnf5daemon-client using server's headers, fix +# TODO(mblaha) workaround for dnf5daemon-client using server's headers, fix include_directories(..) pkg_check_modules(SDBUS_CPP REQUIRED sdbus-c++) diff --git a/dnf5daemon-client/callbacks.cpp b/dnf5daemon-client/callbacks.cpp index a8a692f4d..32d525548 100644 --- a/dnf5daemon-client/callbacks.cpp +++ b/dnf5daemon-client/callbacks.cpp @@ -35,7 +35,7 @@ namespace dnfdaemon::client { bool DbusCallback::signature_valid(sdbus::Signal & signal) { - // check that signal is emited by the correct session object + // check that signal is emitted by the correct session object std::string object_path; signal >> object_path; return object_path == context.get_session_object_path(); diff --git a/dnf5daemon-client/commands/advisory/arguments.hpp b/dnf5daemon-client/commands/advisory/arguments.hpp index 9aeb07f2d..f53424158 100644 --- a/dnf5daemon-client/commands/advisory/arguments.hpp +++ b/dnf5daemon-client/commands/advisory/arguments.hpp @@ -150,6 +150,8 @@ class AdvisorySeverityOption : public libdnf5::cli::session::AppendStringListOpt command, "advisory-severities", '\0', + /* Note for translators: "critical" etc. quoted words are + literals that should not be translated. */ _("Limit to packages in advisories with specified severity. List option. Can be " "\"critical\", \"important\", \"moderate\", \"low\", \"none\"."), _("ADVISORY_SEVERITY,..."), diff --git a/dnf5daemon-client/commands/remove/remove.cpp b/dnf5daemon-client/commands/remove/remove.cpp index b327f771c..41c3826bb 100644 --- a/dnf5daemon-client/commands/remove/remove.cpp +++ b/dnf5daemon-client/commands/remove/remove.cpp @@ -51,7 +51,7 @@ void RemoveCommand::set_argument_parser() { specs_arg->set_description("List of packages to remove"); cmd.register_positional_arg(specs_arg); - // run remove command allways with allow_erasing on + // run remove command always with allow_erasing on context.allow_erasing.set(libdnf5::Option::Priority::RUNTIME, true); } diff --git a/dnf5daemon-client/main.cpp b/dnf5daemon-client/main.cpp index 366011fa9..a839c7fe7 100644 --- a/dnf5daemon-client/main.cpp +++ b/dnf5daemon-client/main.cpp @@ -38,6 +38,7 @@ along with libdnf. If not, see . #include #include #include +#include #include #include @@ -149,8 +150,10 @@ void RootCommand::set_argument_parser() { auto dot_pos = key.rfind('.'); if (dot_pos != std::string::npos) { if (dot_pos == key.size() - 1) { - throw std::runtime_error( - std::string("setopt: Badly formatted argument value: Last key character cannot be '.': ") + value); + throw libdnf5::cli::ArgumentParserError( + M_("{}: Badly formatted argument value: Last key character cannot be '.': {}"), + std::string{"setopt"}, + std::string(value)); } } // Store option to vector for later use diff --git a/dnf5daemon-server/dbus/interfaces/org.rpm.dnf.v0.Advisory.xml b/dnf5daemon-server/dbus/interfaces/org.rpm.dnf.v0.Advisory.xml index f07d6faab..2f618e3a9 100644 --- a/dnf5daemon-server/dbus/interfaces/org.rpm.dnf.v0.Advisory.xml +++ b/dnf5daemon-server/dbus/interfaces/org.rpm.dnf.v0.Advisory.xml @@ -47,7 +47,7 @@ along with libdnf. If not, see . - severity: list of strings Consider only advisories of given severity. Possible values are "critical", "important", "moderate", "low", and "none". - reference_bz: list of strings - Consider only advisories referencing given Bugzilla ticket ID. Exepcted values are numeric IDs, e.g. 123456. + Consider only advisories referencing given Bugzilla ticket ID. Expected values are numeric IDs, e.g. 123456. - reference_cve: list of strings Consider only advisoried referencing given CVE ID. Expected values are strings IDs in CVE format, e.g. CVE-2201-0123. - with_bz: boolean diff --git a/dnf5daemon-server/dbus/interfaces/org.rpm.dnf.v0.Base.xml b/dnf5daemon-server/dbus/interfaces/org.rpm.dnf.v0.Base.xml index fc10568e9..259424f8c 100644 --- a/dnf5daemon-server/dbus/interfaces/org.rpm.dnf.v0.Base.xml +++ b/dnf5daemon-server/dbus/interfaces/org.rpm.dnf.v0.Base.xml @@ -27,9 +27,9 @@ along with libdnf. If not, see . diff --git a/dnf5daemon-server/services/advisory/advisory.cpp b/dnf5daemon-server/services/advisory/advisory.cpp index 36120c001..a7faa1c86 100644 --- a/dnf5daemon-server/services/advisory/advisory.cpp +++ b/dnf5daemon-server/services/advisory/advisory.cpp @@ -104,7 +104,7 @@ libdnf5::advisory::AdvisoryQuery Advisory::advisory_query_from_options( auto advisories_not_installed(advisories); advisories.filter_packages(package_query, libdnf5::sack::QueryCmp::LTE); // TODO(mblaha): add advisories.filter_packages(package_query), without cmp, - // to filter advisories with matching name.arch? Insted of unioning LTE + // to filter advisories with matching name.arch? Instead of unioning LTE // and GT results. advisories_not_installed.filter_packages(package_query, libdnf5::sack::QueryCmp::GT); advisories |= advisories_not_installed; diff --git a/dnf5daemon-server/services/goal/goal.cpp b/dnf5daemon-server/services/goal/goal.cpp index a093ea443..1cf5dac16 100644 --- a/dnf5daemon-server/services/goal/goal.cpp +++ b/dnf5daemon-server/services/goal/goal.cpp @@ -45,7 +45,7 @@ along with libdnf. If not, see . void Goal::dbus_register() { auto dbus_object = session.get_dbus_object(); - // TODO(mblaha) Adjust resolve method to accomodate also groups, environments, + // TODO(mblaha) Adjust resolve method to accommodate also groups, environments, // and modules as part of the transaction dbus_object->registerMethod( dnfdaemon::INTERFACE_GOAL, "resolve", "a{sv}", "a(sssa{sv}a{sv})u", [this](sdbus::MethodCall call) -> void { @@ -135,7 +135,7 @@ sdbus::MethodReply Goal::resolve(sdbus::MethodCall & call) { environment_to_map(tsenv.get_environment(), grp_attrs))); } // there are transactions resolved without problems but still resolve_logs - // may contain some warnings / informations + // may contain some warnings / information if (transaction.get_resolve_logs().size() > 0) { overall_result = dnfdaemon::ResolveResult::WARNING; } else { @@ -254,7 +254,7 @@ sdbus::MethodReply Goal::do_transaction(sdbus::MethodCall & call) { static_cast>(rpm_result))); } - // TODO(mblaha): clean up downloaded packages after successfull transaction + // TODO(mblaha): clean up downloaded packages after successful transaction auto reply = call.createReply(); return reply; diff --git a/dnf5daemon-server/services/repo/repo.cpp b/dnf5daemon-server/services/repo/repo.cpp index 8e662251d..db299133c 100644 --- a/dnf5daemon-server/services/repo/repo.cpp +++ b/dnf5daemon-server/services/repo/repo.cpp @@ -209,7 +209,7 @@ dnfdaemon::KeyValueMap repo_to_map( dbus_repo.emplace(attr, libdnf_repo->get_content_tags()); break; case RepoAttribute::distro_tags: { - // sdbus::Variant cannot accomodate a std::pair + // sdbus::Variant cannot accommodate a std::pair std::vector distro_tags{}; for (auto & dt : libdnf_repo->get_distro_tags()) { distro_tags.emplace_back(dt.first); diff --git a/doc/CMakeLists.txt b/doc/CMakeLists.txt index 5fdec1202..aa15d89b8 100644 --- a/doc/CMakeLists.txt +++ b/doc/CMakeLists.txt @@ -80,6 +80,7 @@ if(WITH_MAN) install(FILES ${CMAKE_CURRENT_BINARY_DIR}/man/dnf5-search.8 DESTINATION share/man/man8) install(FILES ${CMAKE_CURRENT_BINARY_DIR}/man/dnf5-swap.8 DESTINATION share/man/man8) install(FILES ${CMAKE_CURRENT_BINARY_DIR}/man/dnf5-upgrade.8 DESTINATION share/man/man8) + install(FILES ${CMAKE_CURRENT_BINARY_DIR}/man/dnf5-aliases.7 DESTINATION share/man/man7) install(FILES ${CMAKE_CURRENT_BINARY_DIR}/man/dnf5-caching.7 DESTINATION share/man/man7) install(FILES ${CMAKE_CURRENT_BINARY_DIR}/man/dnf5-comps.7 DESTINATION share/man/man7) # TODO(jkolarik): filtering is not ready yet diff --git a/doc/best_practices/documentation_strings.rst b/doc/best_practices/documentation_strings.rst index 880208c34..25f7b3d0f 100644 --- a/doc/best_practices/documentation_strings.rst +++ b/doc/best_practices/documentation_strings.rst @@ -25,7 +25,7 @@ Example:: /// @param text Input text. /// @param delimiter A delimiter we're using to split the text. /// @param max_items Limit number of splits to produce a vector containing up to `max_items` items. - /// @return Splitted text. + /// @return Split text. /// A continuation line for the return value description. /// @exception std::out_of_range Value of the `max_items` argument is out of expected range. /// @since 5.0 diff --git a/doc/commands/group.8.rst b/doc/commands/group.8.rst index 05668b8b4..fec217814 100644 --- a/doc/commands/group.8.rst +++ b/doc/commands/group.8.rst @@ -102,6 +102,9 @@ Options ``--contains-pkgs`` | Show only groups containing packages with specified names. List option, supports globs. +``--allowerasing`` + | Used with ``install`` and ``upgrade`` to allow erasing of installed packages to resolve any potential dependency problems. + ``--skip-broken`` | Used with ``install`` command to resolve any dependency problems by removing packages that are causing problems from the transaction. diff --git a/doc/commands/repoquery.8.rst b/doc/commands/repoquery.8.rst index 2ec792a50..737aeceac 100644 --- a/doc/commands/repoquery.8.rst +++ b/doc/commands/repoquery.8.rst @@ -260,11 +260,11 @@ Set what information is displayed about each package. The following are mutually | * ``provides`` - Display capabilities provided by the package. Separated by new lines. | * ``reason`` - Display reason why the packages was installed. | * ``recommends`` - Display capabilities recommended by the package. Separated by new lines. - | * ``regular_requires`` - Display capabilities requried by the package without its ``%pre``, ``%post``, ``%preun`` and ``%postun`` requirements. Separated by new lines. + | * ``regular_requires`` - Display capabilities required by the package without its ``%pre``, ``%post``, ``%preun`` and ``%postun`` requirements. Separated by new lines. | * ``release`` - Display release of the package. | * ``repoid`` - Display id of repository the package is in. | * ``reponame`` - Display name of repository the package is in. - | * ``requires`` - Display capabilities requried by the package (combines regular_requires and requires_pre). + | * ``requires`` - Display capabilities required by the package (combines regular_requires and requires_pre). | * ``requires_pre`` - For an installed package display capabilities that it depends on to run its ``%pre``, ``%post``, ``%preun`` and ``%postun`` scripts. For not installed package display just ``%pre`` and ``$post`` requirements. Separated by new lines. | * ``source_debug_name`` - Display name of debuginfo package for source package of the package. | * ``source_name`` - Display source RPM name of the package. diff --git a/doc/conf.py.in b/doc/conf.py.in index 695b41466..e4c334cd3 100644 --- a/doc/conf.py.in +++ b/doc/conf.py.in @@ -140,6 +140,7 @@ man_pages = [ ('dnf5_plugins/needs_restarting.8', 'dnf5-needs-restarting', 'Needs-restarting Command', AUTHORS, 8), ('dnf5_plugins/repoclosure.8', 'dnf5-repoclosure', 'Repoclosure Command', AUTHORS, 8), ('libdnf5_plugins/actions.8', 'libdnf5-actions', 'Actions plugin', AUTHORS, 8), + ('misc/aliases.7', 'dnf5-aliases', 'Aliases for command line arguments', AUTHORS, 7), ('misc/caching.7', 'dnf5-caching', 'Caching', AUTHORS, 7), ('misc/comps.7', 'dnf5-comps', 'Comps Groups And Environments', AUTHORS, 7), ('misc/filtering.7', 'dnf5-filtering', 'Packages Filtering', AUTHORS, 7), diff --git a/doc/dnf5.conf-todo.5.rst b/doc/dnf5.conf-todo.5.rst index bf86557b2..530fec96e 100644 --- a/doc/dnf5.conf-todo.5.rst +++ b/doc/dnf5.conf-todo.5.rst @@ -100,7 +100,7 @@ This section does not track any deprecated option. For such options see :ref:`De ``diskspacecheck`` :ref:`boolean ` - If enabled, controls wheather rpm shoud check available disk space during the transaction. + If enabled, controls whether rpm should check available disk space during the transaction. Default: ``True``. diff --git a/doc/dnf5.conf.5.rst b/doc/dnf5.conf.5.rst index 321102f28..c60938a43 100644 --- a/doc/dnf5.conf.5.rst +++ b/doc/dnf5.conf.5.rst @@ -207,7 +207,7 @@ repository configuration file should aside from repo ID consists of baseurl, met Number of :ref:`installonly packages ` allowed to be installed concurrently. - ``1`` is explicitely not allowed since it complicates kernel upgrades due to protection of + ``1`` is explicitly not allowed since it complicates kernel upgrades due to protection of the running kernel from removal. Minimum is ``2``. @@ -373,7 +373,7 @@ repository configuration file should aside from repo ID consists of baseurl, met ``protected_packages`` :ref:`list ` - List of packages that DNF5 should never completely remove. + This append list option contains names of packages that DNF5 should never completely remove. They are protected via Obsoletes as well as user/plugin removals. @@ -389,9 +389,9 @@ repository configuration file should aside from repo ID consists of baseurl, met .. _protect_running_kernel_options-label: ``protect_running_kernel`` - :ref:`boolean ` + :ref:`boolean ` - Controls whether the package corresponding to the running version of kernel is protected from removal. + Controls whether the package corresponding to the running version of kernel is protected from removal. Default: ``True``. @@ -718,7 +718,7 @@ configuration. Inverse of :ref:`excludepkgs `, DNF5 will exclude any package in the repository that doesn't match this list. - This works in conjunction with ref:`excludepkgs ` and doesn't override it, + This works in conjunction with :ref:`excludepkgs ` and doesn't override it, so if you 'excludepkgs=*.i386' and 'includepkgs=python*' then only packages starting with python that do not have an i386 arch will be seen by DNF5 in this repo. @@ -1048,7 +1048,7 @@ Types of Options .. _ip_address_type-label: ``ip address type`` - String describing ip addresss types. + String describing ip address types. One of the following options can be used: ``4``, ``IPv4``, ``6``, ``IPv6``. @@ -1117,7 +1117,7 @@ Users can define custom config options in this way. a file with the same name is present in both directories, only the file from the user configuration directory is added to the list. The distribution file is then masked by the user file. -2. Options are retreived in order from the list The configuration from the next +2. Options are retrieved in order from the list The configuration from the next file overrides the previous one. The last option wins. .. _user_configuration_dir-label: diff --git a/doc/libdnf5_plugins/actions.8.rst b/doc/libdnf5_plugins/actions.8.rst index 312bdec32..b2be069a8 100644 --- a/doc/libdnf5_plugins/actions.8.rst +++ b/doc/libdnf5_plugins/actions.8.rst @@ -25,7 +25,7 @@ Actions Plugin Description =========== -This plugin allows defining actions to be executed throught libdnf5 callbacks hooks. +This plugin allows defining actions to be executed through libdnf5 callbacks hooks. Each action is hooked to one specific callback. Actions for ``pre_transaction`` and ``post_transaction`` callbacks may define a (glob-like) filtering rule on the package NEVRA or package files, as well as whether the package is incoming or outgoing. @@ -55,7 +55,7 @@ Each non-comment line defines an action and consists of five items separated by * ``post_transaction`` ``package_filter`` - A (glob-like) filtering rule aplied on the package NEVRA (also in the shortened forms) or package files. + A (glob-like) filtering rule applied on the package NEVRA (also in the shortened forms) or package files. Empty filter means executing the command once with no information about the package. The "*" filter means executing the command for each package in the transaction that matches the ``direction`` filter. diff --git a/doc/misc/index.rst b/doc/misc/index.rst index acb93b560..8bc2138c6 100644 --- a/doc/misc/index.rst +++ b/doc/misc/index.rst @@ -6,6 +6,7 @@ Miscellaneous .. toctree:: :maxdepth: 1 + aliases.7 caching.7 comps.7 forcearch.7 diff --git a/doc/templates/command/template.hpp b/doc/templates/command/template.hpp index 62e205f25..233b29bbd 100644 --- a/doc/templates/command/template.hpp +++ b/doc/templates/command/template.hpp @@ -24,7 +24,7 @@ class TemplateCommand : public Command { // command such as description, options or sub-commands. void set_argument_parser() override; - // This method needs to be overriden to run the command. + // This method needs to be overridden to run the command. void run() override; private: diff --git a/include/libdnf5-cli/argument_parser.hpp b/include/libdnf5-cli/argument_parser.hpp index 194df19d6..18f1ea0ce 100644 --- a/include/libdnf5-cli/argument_parser.hpp +++ b/include/libdnf5-cli/argument_parser.hpp @@ -246,7 +246,7 @@ class ArgumentParser { /// Sets a pointer to user data in the argument. void set_user_data(ArgumentParserUserData * user_data) noexcept { this->user_data = user_data; } - /// Gets a pointer to the user data attached to the argment. + /// Gets a pointer to the user data attached to the argument. ArgumentParserUserData * get_user_data() const noexcept { return user_data; } private: @@ -768,7 +768,7 @@ class ArgumentParser { /// it will be searched in the parent command. E.g. "installroot" is global option -> instead /// of "repoquery.installroot" returns "installroot". /// @param id_path named argument ID path, e.g. "installroot", "repoquery.installed" - /// @param search_in_parent true - enable search in parrent command, false - disable + /// @param search_in_parent true - enable search in parent command, false - disable /// @exception AssertionError if root command is not set /// @exception ArgumentParser::Command::CommandNotFound if command is not found. /// @exception ArgumentParser::Command::PositionalArgNotFound if argument is not found. @@ -780,7 +780,7 @@ class ArgumentParser { /// it will be searched in the parent command. E.g. "installroot" is global option -> instead /// of "repoquery.installroot" returns "installroot". /// @param id_path positional argument ID path, e.g. "repoquery.keys" - /// @param search_in_parent true - enable search in parrent command, false - disable + /// @param search_in_parent true - enable search in parent command, false - disable /// @exception AssertionError if root command is not set /// @exception ArgumentParser::Command::CommandNotFound if command is not found. /// @exception ArgumentParser::Command::NamedArgNotFound if argument is not found. diff --git a/include/libdnf5-cli/output/repo_info.hpp b/include/libdnf5-cli/output/repo_info.hpp index 4fdbde8c8..9654c5872 100644 --- a/include/libdnf5-cli/output/repo_info.hpp +++ b/include/libdnf5-cli/output/repo_info.hpp @@ -139,7 +139,7 @@ void RepoInfo::add_repo(Repo & repo) { // add_line("SSL client key", "", nullptr, group_proxy); // add_line("Verify SSL certificate", "", nullptr, group_proxy); - // auto group_misc = add_line("Miscelaneous", ""); + // auto group_misc = add_line("Miscellaneous", ""); // add_line("Load comps groups", "", nullptr, group_misc); // add_line("Report \"countme\" statistics", "", nullptr, group_misc); // add_line("Enable DeltaRPM", "", nullptr, group_misc); diff --git a/include/libdnf5-cli/output/search.hpp b/include/libdnf5-cli/output/search.hpp index ffe672d7e..94bee324b 100644 --- a/include/libdnf5-cli/output/search.hpp +++ b/include/libdnf5-cli/output/search.hpp @@ -45,7 +45,7 @@ struct SearchOptions { bool show_duplicates; ///< If multiple versions of the same package are allowed in the output. }; -/// Auxilliary structure for holding the set of result packages together with their comparator. +/// Auxiliary structure for holding the set of result packages together with their comparator. struct SearchPackages { std::set)> packages{ &libdnf5::rpm::cmp_nevra}; diff --git a/include/libdnf5-cli/output/transaction_table.hpp b/include/libdnf5-cli/output/transaction_table.hpp index 523269304..fb19715a2 100644 --- a/include/libdnf5-cli/output/transaction_table.hpp +++ b/include/libdnf5-cli/output/transaction_table.hpp @@ -71,7 +71,7 @@ class ActionHeaderPrinter { // would be better if the Transaction template type of // print_transaction_table() was required to have a TransactionItem type // defined inside, so that the ActionHeaderPrinter class could be templated - // instad of this method, and we could do (in print_transaction_table(), + // instead of this method, and we could do (in print_transaction_table(), // where this class is instantiated): // ActionHeaderPrinter action_header_printer(...); template @@ -198,7 +198,7 @@ class ActionHeaderPrinterGroup { // would be better if the Transaction template type of // print_transaction_table() was required to have a TransactionItem type // defined inside, so that the ActionHeaderPrinter class could be templated - // instad of this method, and we could do (in print_transaction_table(), + // instead of this method, and we could do (in print_transaction_table(), // where this class is instantiated): // ActionHeaderPrinter action_header_printer(...); template @@ -471,7 +471,7 @@ bool print_transaction_table(Transaction & transaction) { ActionHeaderPrinter action_header_printer(tb); for (auto & tspkg : tspkgs) { - // TODO(lukash) handle OBSOLETED correctly throught the transaction table output + // TODO(lukash) handle OBSOLETED correctly through the transaction table output if (tspkg.get_action() == libdnf5::transaction::TransactionItemAction::REPLACED) { ts_summary.add(tspkg.get_action()); continue; diff --git a/include/libdnf5/advisory/advisory_query.hpp b/include/libdnf5/advisory/advisory_query.hpp index fe0a688bc..06a4d5c27 100644 --- a/include/libdnf5/advisory/advisory_query.hpp +++ b/include/libdnf5/advisory/advisory_query.hpp @@ -34,7 +34,7 @@ along with libdnf. If not, see . namespace libdnf5::advisory { -/// AdvisoryQuery is the only way how to acess advisories. +/// AdvisoryQuery is the only way how to access advisories. /// It is constructed using Base and filled with advisories from enabled repositories in its RepoSack. class AdvisoryQuery : public AdvisorySet { public: @@ -58,7 +58,7 @@ class AdvisoryQuery : public AdvisorySet { /// Filter Advisories by name. /// - /// @param pattern Pattern used when matching agains advisory names. + /// @param pattern Pattern used when matching against advisory names. /// @param cmp_type What comparator to use with pattern, allows: EQ, GLOB, IGLOB. void filter_name(const std::string & pattern, sack::QueryCmp cmp_type = libdnf5::sack::QueryCmp::EQ); void filter_name(const std::vector & patterns, sack::QueryCmp cmp_type = libdnf5::sack::QueryCmp::EQ); diff --git a/include/libdnf5/base/base.hpp b/include/libdnf5/base/base.hpp index 5222c70f5..29f2da263 100644 --- a/include/libdnf5/base/base.hpp +++ b/include/libdnf5/base/base.hpp @@ -97,7 +97,8 @@ class Base { repo::RepoSackWeakPtr get_repo_sack() { return repo_sack.get_weak_ptr(); } rpm::PackageSackWeakPtr get_rpm_package_sack() { return rpm_package_sack.get_weak_ptr(); } - /// Loads libdnf plugins, vars from environment, varsdirs and installroot (releasever, arch). + /// Loads libdnf plugins, vars from environment, varsdirs and installroot (releasever, arch) and resolves + /// configuration of protected_packages (glob:). /// To prevent differences between configuration and internal Base settings, following configurations /// will be locked: installroot, varsdir. /// The method is supposed to be called after configuration is updated, application plugins applied @@ -106,7 +107,7 @@ class Base { /// Calling the method for the second time result in throwing an exception void setup(); - /// Returns true when setup() (mandatory method in many workflows) was alredy called + /// Returns true when setup() (mandatory method in many workflows) was already called bool is_initialized(); // TODO(jmracek) Remove from public API due to unstability of the code diff --git a/include/libdnf5/base/goal.hpp b/include/libdnf5/base/goal.hpp index cf88fc43c..dc484730f 100644 --- a/include/libdnf5/base/goal.hpp +++ b/include/libdnf5/base/goal.hpp @@ -113,7 +113,7 @@ class Goal { /// Add install request to the goal. The operation will not result in a reinstall when requested package /// with the same NEVRA is already installed. By default uses `clean_requirements_on_remove` set to `false`. /// - /// @param package_set A package_set containig candidates for the install action. + /// @param package_set A package_set containing candidates for the install action. /// @param settings A structure to override default goal settings. Only `strict`, `best`, and `clean_requirements_on_remove` are used. void add_rpm_install( const libdnf5::rpm::PackageSet & package_set, @@ -131,7 +131,7 @@ class Goal { /// Add install or reinstall request to the goal. By default uses `clean_requirements_on_remove` set to `false`. /// - /// @param package_set A package_set containig candidates for the install or reinstall action. + /// @param package_set A package_set containing candidates for the install or reinstall action. /// @param settings A structure to override default goal settings. Only `strict`, `best`, and `clean_requirements_on_remove` are used. // @replaces libdnf/hy-goal.h:function:hy_goal_install_selector(HyGoal goal, HySelector sltr, GError **error) // @replaces libdnf/hy-goal.h:function:hy_goal_install_selector_optional(HyGoal goal, HySelector sltr, GError **error) @@ -202,7 +202,7 @@ class Goal { const libdnf5::GoalJobSettings & settings = libdnf5::GoalJobSettings(), bool minimal = false); - // TODO(jmracek) Add suport `to_repo_ids` + // TODO(jmracek) Add support `to_repo_ids` /// Add upgrade job of all installed packages to the goal if not limited in `settings`. By default uses /// `clean_requirements_on_remove` set to `false`, which can be overridden in `settings`. /// @@ -268,7 +268,7 @@ class Goal { void add_rpm_distro_sync( const std::string & spec, const libdnf5::GoalJobSettings & settings = libdnf5::GoalJobSettings()); - // TODO(jmracek) Add suport `to_repo_ids` + // TODO(jmracek) Add support `to_repo_ids` /// Add distrosync job of all installed packages to the goal if not limited in `settings`. By default uses /// `clean_requirements_on_remove` set to `false`, which can be overridden in `settings`. /// @@ -302,7 +302,7 @@ class Goal { /// @param spec A string describing the requested package /// @param reason New reason for the package /// @param group_id Id of group the package belongs to (only relevant in case the reason is GROUP) - /// @param settings A sructure to overrice default goal settings. Only ResolveSpecSettings values are used + /// @param settings A structure to override default goal settings. Only ResolveSpecSettings values are used void add_rpm_reason_change( const std::string & spec, const libdnf5::transaction::TransactionItemReason reason, @@ -368,7 +368,7 @@ class Goal { bool get_allow_erasing() const; // TODO(jmracek) Move transaction reports to Transaction class - /// Resolve all jobs and return a transaction object. Everytime it resolves specs (strings) to packages + /// Resolve all jobs and return a transaction object. Every time it resolves specs (strings) to packages /// /// @return transaction object // @replaces libdnf/hy-goal.h:function:hy_goal_run_flags(HyGoal goal, DnfGoalActions flags) diff --git a/include/libdnf5/base/transaction_environment.hpp b/include/libdnf5/base/transaction_environment.hpp index 3f943bea2..d5f0db3b6 100644 --- a/include/libdnf5/base/transaction_environment.hpp +++ b/include/libdnf5/base/transaction_environment.hpp @@ -41,7 +41,7 @@ class TransactionEnvironment { /// @return the underlying environment. libdnf5::comps::Environment get_environment() const { return environment; } - /// @return the action being preformed on the transaction environment. + /// @return the action being performed on the transaction environment. // // @replaces libdnf:transaction/TransactionItem.hpp:method:TransactionItemBase.getAction() Action get_action() const noexcept { return action; } diff --git a/include/libdnf5/base/transaction_group.hpp b/include/libdnf5/base/transaction_group.hpp index c30dce363..4c332ef39 100644 --- a/include/libdnf5/base/transaction_group.hpp +++ b/include/libdnf5/base/transaction_group.hpp @@ -45,7 +45,7 @@ class TransactionGroup { /// @return the underlying group. libdnf5::comps::Group get_group() const { return group; } - /// @return the action being preformed on the transaction group. + /// @return the action being performed on the transaction group. // // @replaces libdnf:transaction/TransactionItem.hpp:method:TransactionItemBase.getAction() Action get_action() const noexcept { return action; } diff --git a/include/libdnf5/base/transaction_module.hpp b/include/libdnf5/base/transaction_module.hpp index 74922ba3d..e66ea062b 100644 --- a/include/libdnf5/base/transaction_module.hpp +++ b/include/libdnf5/base/transaction_module.hpp @@ -45,7 +45,7 @@ class TransactionModule { /// @return the module stream. std::string get_module_stream() const { return module_stream; } - /// @return the action being preformed on the transaction module. + /// @return the action being performed on the transaction module. // // @replaces libdnf:transaction/TransactionItem.hpp:method:TransactionItemBase.getAction() Action get_action() const noexcept { return action; } diff --git a/include/libdnf5/base/transaction_package.hpp b/include/libdnf5/base/transaction_package.hpp index b35d998a3..9d317b305 100644 --- a/include/libdnf5/base/transaction_package.hpp +++ b/include/libdnf5/base/transaction_package.hpp @@ -45,7 +45,7 @@ class TransactionPackage { /// @return the underlying package. libdnf5::rpm::Package get_package() const { return package; } - /// @return the action being preformed on the transaction package. + /// @return the action being performed on the transaction package. // // @replaces libdnf:transaction/TransactionItem.hpp:method:TransactionItemBase.getAction() Action get_action() const noexcept { return action; } diff --git a/include/libdnf5/conf/config_parser.hpp b/include/libdnf5/conf/config_parser.hpp index eb7057af9..e8e8c0e53 100644 --- a/include/libdnf5/conf/config_parser.hpp +++ b/include/libdnf5/conf/config_parser.hpp @@ -78,7 +78,7 @@ class ConfigParserOptionNotFoundError : public ConfigParserError { * @brief Class for parsing dnf/yum .ini configuration files. * * ConfigParser is used for parsing files. -* User can get both substituded and original parsed values. +* User can get both substituted and original parsed values. * The parsed items are stored into the PreserveOrderMap. * ConfigParser preserve order of items. Comments and empty lines are kept. */ diff --git a/include/libdnf5/conf/option_binds.hpp b/include/libdnf5/conf/option_binds.hpp index d8e5c56e5..0c5f7bbd2 100644 --- a/include/libdnf5/conf/option_binds.hpp +++ b/include/libdnf5/conf/option_binds.hpp @@ -46,12 +46,12 @@ class OptionBindsOptionAlreadyExistsError : public OptionBindsError { const char * get_name() const noexcept override { return "OptionBindsOptionAlreadyExistsError"; } }; -/// Maps the options names (text names readed from config file, command line, ...) to options objects. +/// Maps the options names (text names read from config file, command line, ...) to options objects. /// Supports user defined functions for processing new value and converting value to string. class OptionBinds { public: /// Extends the option with user-defined functions for processing a new value and converting value to a string. - /// It is used as additional level of processing when the option is accesed by its text name. + /// It is used as additional level of processing when the option is accessed by its text name. class Item final { public: using NewStringFunc = std::function; diff --git a/include/libdnf5/conf/option_path.hpp b/include/libdnf5/conf/option_path.hpp index 035e44824..381a4bf83 100644 --- a/include/libdnf5/conf/option_path.hpp +++ b/include/libdnf5/conf/option_path.hpp @@ -38,15 +38,15 @@ class OptionPathNotFoundError : public OptionValueNotAllowedError { // @replaces libdnf:conf/OptionPath.hpp:class:OptionPath class OptionPath : public OptionString { public: - /// Constructor sets default value and conditons. + /// Constructor sets default value and conditions. // @replaces libdnf:conf/OptionPath.hpp:ctor:OptionPath.OptionPath(const std::string & defaultValue, bool exists = false, bool absPath = false) explicit OptionPath(const std::string & default_value, bool exists = false, bool abs_path = false); - /// Constructor sets default value and conditons. + /// Constructor sets default value and conditions. // @replaces libdnf:conf/OptionPath.hpp:ctor:OptionPath.OptionPath(const char * defaultValue, bool exists = false, bool absPath = false) explicit OptionPath(const char * default_value, bool exists = false, bool abs_path = false); - /// Constructor sets default value and conditons. + /// Constructor sets default value and conditions. // @replaces libdnf:conf/OptionPath.hpp:ctor:OptionPath.OptionPath(const std::string & defaultValue, const std::string & regex, bool icase, bool exists = false, bool absPath = false) OptionPath( const std::string & default_value, @@ -55,7 +55,7 @@ class OptionPath : public OptionString { bool exists = false, bool abs_path = false); - /// Constructor sets default value and conditons. + /// Constructor sets default value and conditions. // @replaces libdnf:conf/OptionPath.hpp:ctor:OptionPath.OptionPath(const char * defaultValue, const std::string & regex, bool icase, bool exists = false, bool absPath = false) OptionPath( const char * default_value, const std::string & regex, bool icase, bool exists = false, bool abs_path = false); diff --git a/include/libdnf5/module/module_query.hpp b/include/libdnf5/module/module_query.hpp index e90602a68..cf28b4907 100644 --- a/include/libdnf5/module/module_query.hpp +++ b/include/libdnf5/module/module_query.hpp @@ -165,7 +165,7 @@ class ModuleQuery : public libdnf5::sack::Query { /// Filter ModuleItems by module_spec. /// /// @param module_spec A module_spec the filter is matched against. - /// @return `true` and matched Nsvcap if the module_spec was parsed sucessfully, + /// @return `true` and matched Nsvcap if the module_spec was parsed successfully, /// `false` and empty Nsvcap otherwise. /// @since 5.0.6 std::pair resolve_module_spec(const std::string & module_spec); diff --git a/include/libdnf5/repo/config_repo.hpp b/include/libdnf5/repo/config_repo.hpp index 1582c4bce..eabcf2c92 100644 --- a/include/libdnf5/repo/config_repo.hpp +++ b/include/libdnf5/repo/config_repo.hpp @@ -153,7 +153,7 @@ class ConfigRepo : public Config { /// cached metadata are stored. std::string get_cachedir() const; - /// @return The path to the repository's perisistent directory, where its + /// @return The path to the repository's persistent directory, where its /// persistent data are stored. std::string get_persistdir() const; diff --git a/include/libdnf5/repo/download_callbacks.hpp b/include/libdnf5/repo/download_callbacks.hpp index 700ba9008..f33e42f0a 100644 --- a/include/libdnf5/repo/download_callbacks.hpp +++ b/include/libdnf5/repo/download_callbacks.hpp @@ -47,7 +47,7 @@ class DownloadCallbacks { CACHELOADINGSTATUS, /// Detection (pinging) in progress. If all data was loaded from cache, - /// this stage is skiped. `ptr` is a pointer to `long`, the number of + /// this stage is skipped. `ptr` is a pointer to `long`, the number of /// mirrors which will be tested. DETECTION, diff --git a/include/libdnf5/repo/repo.hpp b/include/libdnf5/repo/repo.hpp index 0375ffc11..259c8c305 100644 --- a/include/libdnf5/repo/repo.hpp +++ b/include/libdnf5/repo/repo.hpp @@ -220,7 +220,7 @@ class Repo { std::string get_metadata_path(const std::string & metadata_type); /// Mark whatever is in the current cache expired. - /// This repo instance will alway try to fetch a fresh metadata after this + /// This repo instance will always try to fetch a fresh metadata after this /// method is called. // @replaces libdnf:repo/Repo.hpp:method:Repo.expire() void expire(); diff --git a/include/libdnf5/repo/repo_callbacks.hpp b/include/libdnf5/repo/repo_callbacks.hpp index 34d7762cc..b7d14b782 100644 --- a/include/libdnf5/repo/repo_callbacks.hpp +++ b/include/libdnf5/repo/repo_callbacks.hpp @@ -48,7 +48,7 @@ class RepoCallbacks { /// @param key_info The key that is about to be imported /// @return `true` to import the key, `false` to not import virtual bool repokey_import(const libdnf5::rpm::KeyInfo & key_info) { return true; } - /// Called on successfull repo key import. + /// Called on successful repo key import. /// @param key_info The key that was successfully imported virtual void repokey_imported(const libdnf5::rpm::KeyInfo & key_info) {} diff --git a/include/libdnf5/repo/repo_sack.hpp b/include/libdnf5/repo/repo_sack.hpp index d6383357e..417412684 100644 --- a/include/libdnf5/repo/repo_sack.hpp +++ b/include/libdnf5/repo/repo_sack.hpp @@ -161,7 +161,7 @@ class RepoSack : public sack::Sack { explicit RepoSack(libdnf5::Base & base); /// Loads repositories configuration overrides from drop-in directories. No new repositories are created. - /// Only the configuration of the coresponding existing repositories is modified. + /// Only the configuration of the corresponding existing repositories is modified. void load_repos_configuration_overrides(); WeakPtrGuard sack_guard; diff --git a/include/libdnf5/rpm/nevra.hpp b/include/libdnf5/rpm/nevra.hpp index ab9a17ac1..218274d7c 100644 --- a/include/libdnf5/rpm/nevra.hpp +++ b/include/libdnf5/rpm/nevra.hpp @@ -70,7 +70,7 @@ struct Nevra { // NOTE: required by cppunit asserts friend std::ostringstream & operator<<(std::ostringstream & out, const Nevra & nevra); - /// Returns false when parsing failed and stored data are in inconsistance state. + /// Returns false when parsing failed and stored data are in inconsistency state. void clear() noexcept; diff --git a/include/libdnf5/rpm/package.hpp b/include/libdnf5/rpm/package.hpp index 7b434fba9..6fe0a1355 100644 --- a/include/libdnf5/rpm/package.hpp +++ b/include/libdnf5/rpm/package.hpp @@ -340,7 +340,7 @@ class Package { // @replaces libdnf:libdnf/hy-package.h:function:dnf_package_get_supplements(DnfPackage * pkg) ReldepList get_supplements() const; - /// @return List of RPM package dependencies (requries + enhances + suggests + supplements + recommends). + /// @return List of RPM package dependencies (requires + enhances + suggests + supplements + recommends). /// @since 5.0.10 ReldepList get_depends() const; @@ -515,6 +515,15 @@ class Package { /// @since 5.0.5 libdnf5::BaseWeakPtr get_base() const; + /// Return NEVRA -> 0 epoch is not shown in string + std::string to_string() const { return get_nevra(); }; + + /// Provide descriptive information about instance including NEVRA and ID + std::string to_string_description() const; + + /// Return unique ID representing Package + int get_hash() const { return get_id().id; }; + protected: // @replaces libdnf:libdnf/dnf-package.h:function:dnf_package_new(DnfSack *sack, Id id) Package(const BaseWeakPtr & base, PackageId id); diff --git a/include/libdnf5/rpm/package_query.hpp b/include/libdnf5/rpm/package_query.hpp index bc1a086be..a0ac087db 100644 --- a/include/libdnf5/rpm/package_query.hpp +++ b/include/libdnf5/rpm/package_query.hpp @@ -661,7 +661,7 @@ class PackageQuery : public PackageSet { void filter_unneeded(); /// Resolve spec according to provided settings. It tests whether spec is NEVRA type, provide, file or binary. - /// It retuns only the first mach type. If spec has a mathes as NEVRA and provide type it only keeps matches with + /// It returns only the first match type. If spec has a match as NEVRA and provide type it only keeps matches with /// the first tested type (NEVRA). // TODO(jmracek) return std::pair> // @replaces libdnf/sack/query.hpp:method:std::pair> filterSubject(const char * subject, HyForm * forms, bool icase, bool with_nevra, bool with_provides, bool with_filenames); diff --git a/include/libdnf5/rpm/reldep.hpp b/include/libdnf5/rpm/reldep.hpp index c039e5d86..7db86ec59 100644 --- a/include/libdnf5/rpm/reldep.hpp +++ b/include/libdnf5/rpm/reldep.hpp @@ -83,6 +83,9 @@ class Reldep { // @replaces libdnf/dnf-reldep.h:function:dnf_reldep_to_string(DnfReldep *reldep) std::string to_string() const; + /// Provide descriptive information about instance including string value and ID + std::string to_string_description() const; + // @replaces libdnf/repo/solvable/Dependency.hpp:method:getId() // @replaces libdnf/dnf-reldep.h:function:dnf_reldep_to_string(DnfReldep *reldep) ReldepId get_id() const noexcept { return id; }; @@ -92,7 +95,10 @@ class Reldep { /// @brief Test if pattern is rich dependency /// Return true if pattern start with "(" - static bool is_rich_dependency(const std::string & pattern) { return pattern[0] == '('; } + static bool is_rich_dependency(const std::string & pattern) { return pattern[0] == '('; }; + + /// Return unique ID representing Reldep + int get_hash() const { return get_id().id; }; protected: /// @brief Creates a reldep from Id diff --git a/include/libdnf5/rpm/reldep_list.hpp b/include/libdnf5/rpm/reldep_list.hpp index e3af9ea59..61af5ee62 100644 --- a/include/libdnf5/rpm/reldep_list.hpp +++ b/include/libdnf5/rpm/reldep_list.hpp @@ -65,7 +65,7 @@ class ReldepList { // @replaces libdnf/repo/solvable/DependencyContainer.hpp:method:add(Id id)) void add(ReldepId id); - /// @brief Adds a reldep from Char*. Only globs in name are proccessed. The proccess is slow + /// @brief Adds a reldep from Char*. Only globs in name are processed. The process is slow /// therefore if reldepStr is not a glob please use addReldep() instead. /// /// @param reldep_str p_reldepStr: Char* diff --git a/include/libdnf5/transaction/transaction_item_action.hpp b/include/libdnf5/transaction/transaction_item_action.hpp index 875cbc1d6..ab15a08a9 100644 --- a/include/libdnf5/transaction/transaction_item_action.hpp +++ b/include/libdnf5/transaction/transaction_item_action.hpp @@ -137,7 +137,7 @@ Reason Change Reasons: * new = a brand new reason why a package was installed or removed -* inherited = a package was installed in the past, re-use it's reason in existing transaction +* inherited = a package was installed in the past, reuse it's reason in existing transaction */ #endif // LIBDNF5_TRANSACTION_TYPES_HPP diff --git a/include/libdnf5/utils/bgettext/README.md b/include/libdnf5/utils/bgettext/README.md index 85f3dc8f1..064ea566c 100644 --- a/include/libdnf5/utils/bgettext/README.md +++ b/include/libdnf5/utils/bgettext/README.md @@ -4,7 +4,7 @@ This is an extension of the GNU gettext. At first I tried to use the glib extension of gettext. But glib is incomplete. * There are macros `_()`, `C_()`. But there are missing macros for plural forms. And there is not support of plural forms with context. -* There are macros `N_()`, `NC_()` witch only marks string for translation. There is the same problem with plural. Moreover these macros are not useable as I needed. +* There are macros `N_()`, `NC_()` witch only marks string for translation. There is the same problem with plural. Moreover these macros are not usable as I needed. * I do not want to depend on glib just for translation. ## So, I wrote my extension that offers everything I need. @@ -54,7 +54,7 @@ If a translation was found in one of the specified catalogs, it is converted to `label2 = C_("Insects", "Bug");` #### `CP_(context, msgId, msgIdPlural, n)` -This is the most powerfull macro. It supports translation of message with context and plural forms. The macro encodes context and msgId and a dngettext is used internaly. See `P_()` and `C_()` macros for more informations about plural forms and context. +This is the most powerful macro. It supports translation of message with context and plural forms. The macro encodes context and msgId and a dngettext is used internally. See `P_()` and `C_()` macros for more information about plural forms and context. If you are using the `CP_()` macro, you need to make sure that you pass `--keyword=CP_:1c,2,3` to xgettext when extracting messages. Note that this only works with GNU gettext >= 0.15. ##### Parameters `context` - a message context, must be a string literal diff --git a/include/libdnf5/utils/bgettext/bgettext-common.h b/include/libdnf5/utils/bgettext/bgettext-common.h index 1560b4fcf..d6f686b31 100644 --- a/include/libdnf5/utils/bgettext/bgettext-common.h +++ b/include/libdnf5/utils/bgettext/bgettext-common.h @@ -29,8 +29,8 @@ along with libdnf. If not, see . extern "C" { #endif -/// Attemps to translate the 'msgId' into the user's language by searching for the translation in a message catalog. -/// The use of C_() macro is prefered. But this macro don't support non-string-literals as 'context' and 'msgId' arguments. +/// Attempts to translate the 'msgId' into the user's language by searching for the translation in a message catalog. +/// The use of C_() macro is preferred. But this macro don't support non-string-literals as 'context' and 'msgId' arguments. /// This function is intended for this case. /// /// @param domain message domain used for translation, non-empty string or NULL @@ -40,8 +40,8 @@ extern "C" { /// @return translated message (or msgId if translation was not found) const char * b_dpgettext(const char * domain, const char * context, const char * msgId); -/// Attemps to translate the 'msgId' into the user's language by searching for the translation in a message catalog. -/// The use of CP_() macro is prefered. But this macro don't support non-string-literals as 'context' and 'msgId' arguments. +/// Attempts to translate the 'msgId' into the user's language by searching for the translation in a message catalog. +/// The use of CP_() macro is preferred. But this macro don't support non-string-literals as 'context' and 'msgId' arguments. /// This function is intended for this case. /// /// @param domain message domain used for translation, non-empty string or NULL diff --git a/include/libdnf5/utils/bgettext/bgettext-mark-common.h b/include/libdnf5/utils/bgettext/bgettext-mark-common.h index 7788a01c7..dc0496822 100644 --- a/include/libdnf5/utils/bgettext/bgettext-mark-common.h +++ b/include/libdnf5/utils/bgettext/bgettext-mark-common.h @@ -38,7 +38,7 @@ const char * b_gettextmsg_get_domain(struct BgettextMessage message); /// @return message id const char * b_gettextmsg_get_id(struct BgettextMessage message); -/// Attemps to translate the 'message' into the user's language by searching for the translation in a message catalog. +/// Attempts to translate the 'message' into the user's language by searching for the translation in a message catalog. /// @param domain message domain used for translation, argument is used only if the domain is not present in encoded message /// @param message message encoded for translation /// @param n defines plural form to be use (returns the base form if encoded message does not define plural form) diff --git a/include/libdnf5/utils/to_underlying.hpp b/include/libdnf5/utils/to_underlying.hpp index 4dcba788c..2ca45c940 100644 --- a/include/libdnf5/utils/to_underlying.hpp +++ b/include/libdnf5/utils/to_underlying.hpp @@ -27,7 +27,7 @@ along with libdnf. If not, see . namespace libdnf5::utils { /// Converts an enumeration to its underlying type. -/// `std::to_underlying` is planed for C++23. +/// `std::to_underlying` is planned for C++23. template constexpr std::underlying_type_t to_underlying(Enum e) noexcept { return static_cast>(e); diff --git a/libdnf5-cli/output/repoqueryformat.cpp b/libdnf5-cli/output/repoqueryformat.cpp index 06ee48727..6b2e4923c 100644 --- a/libdnf5-cli/output/repoqueryformat.cpp +++ b/libdnf5-cli/output/repoqueryformat.cpp @@ -190,7 +190,7 @@ std::pair, std::string> parse_queryformat(const std::string tag_name_start = format_size; } else if (qf_char == '}' && state == IN_TAG_NAME) { // end of tag state = OUTSIDE; - // To get the name we add/subtract 2 becasue each tag name (after brace expansion) starts with "{{". + // To get the name we add/subtract 2 because each tag name (after brace expansion) starts with "{{". auto getter_name = format.substr(tag_name_start + 2, format_size - tag_name_start - 2); auto getter = NAME_TO_GETTER.find(libdnf5::utils::string::tolower(getter_name)); if (getter != NAME_TO_GETTER.end()) { diff --git a/libdnf5-cli/output/search.cpp b/libdnf5-cli/output/search.cpp index 51a99f65d..f727228f0 100644 --- a/libdnf5-cli/output/search.cpp +++ b/libdnf5-cli/output/search.cpp @@ -43,7 +43,7 @@ static std::string key_to_string(const matched_key_pair & key_pair) { } } -/// Auxilliary method for aggregating a list of matched keys into a string. +/// Auxiliary method for aggregating a list of matched keys into a string. static std::string concat_keys(const std::string & acc, const matched_key_pair & pair) { return acc.empty() ? key_to_string(pair) : acc + ", " + key_to_string(pair); } @@ -53,7 +53,7 @@ static std::string construct_keys_string(const std::vector & k return std::accumulate(key_pairs.begin(), key_pairs.end(), std::string{}, concat_keys); } -/// Auxilliary method for aggregating a pattern matching expression into a string. +/// Auxiliary method for aggregating a pattern matching expression into a string. static std::string concat_patterns(const std::string & acc, const std::string & pattern) { return acc.empty() ? pattern : acc + "|" + pattern; } diff --git a/libdnf5-cli/progressbar/download_progress_bar.cpp b/libdnf5-cli/progressbar/download_progress_bar.cpp index 4cc002491..03416ee59 100644 --- a/libdnf5-cli/progressbar/download_progress_bar.cpp +++ b/libdnf5-cli/progressbar/download_progress_bar.cpp @@ -206,7 +206,7 @@ void DownloadProgressBar::to_stream(std::ostream & stream) { } // print only part of the message that fits the terminal width - // substracted '4' relates to the '>>> ' prefix + // subtracted '4' relates to the '>>> ' prefix stream << message.substr(0, terminal_width - 4); if (color_used) { diff --git a/libdnf5-cli/progressbar/widgets/speed.cpp b/libdnf5-cli/progressbar/widgets/speed.cpp index 4947d9b0e..d83f9fd31 100644 --- a/libdnf5-cli/progressbar/widgets/speed.cpp +++ b/libdnf5-cli/progressbar/widgets/speed.cpp @@ -38,7 +38,7 @@ std::string SpeedWidget::to_string() const { return ""; } if (get_bar()->is_finished() || get_bar()->get_total_ticks() < 0) { - // finshed -> display average speed + // finished -> display average speed return get_delimiter_before() + format_size(get_bar()->get_average_speed()) + "/s"; } else { // in progress -> display current speed diff --git a/libdnf5-cli/progressbar/widgets/time.cpp b/libdnf5-cli/progressbar/widgets/time.cpp index 81bca210a..f825f605a 100644 --- a/libdnf5-cli/progressbar/widgets/time.cpp +++ b/libdnf5-cli/progressbar/widgets/time.cpp @@ -44,7 +44,7 @@ std::string TimeWidget::to_string() const { std::ostringstream ss; ss << get_delimiter_before(); if (get_bar()->is_finished() || get_bar()->get_total_ticks() < 0) { - // finshed or unknown total ticks -> display elapsed time + // finished or unknown total ticks -> display elapsed time ss << format_time(get_bar()->get_elapsed_seconds(), false); } else { // in progress -> display remaining time diff --git a/libdnf5-plugins/python_plugins_loader/python_plugins_loader.cpp b/libdnf5-plugins/python_plugins_loader/python_plugins_loader.cpp index eb5cab0d7..3965ba5a0 100644 --- a/libdnf5-plugins/python_plugins_loader/python_plugins_loader.cpp +++ b/libdnf5-plugins/python_plugins_loader/python_plugins_loader.cpp @@ -185,7 +185,7 @@ void PythonPluginLoader::load_plugin_file(const fs::path & file_path) { // python_code += "locked_base.add_plugin(plug)"; // PyRun_SimpleString(python_code.c_str()); - // Similar but Pure Embeding + // Similar but Pure Embedding auto * module_name = file_path.stem().c_str(); PyObject * plugin_module = PyImport_ImportModule(module_name); if (!plugin_module) { diff --git a/libdnf5/base/base.cpp b/libdnf5/base/base.cpp index a43545e33..73edd1b83 100644 --- a/libdnf5/base/base.cpp +++ b/libdnf5/base/base.cpp @@ -19,6 +19,7 @@ along with libdnf. If not, see . #include "libdnf5/base/base.hpp" +#include "../conf/config_utils.hpp" #include "base_impl.hpp" #include "conf/config.h" #include "module/module_sack_impl.hpp" @@ -183,6 +184,13 @@ void Base::setup() { config.get_system_cachedir_option().set(Option::Priority::INSTALLROOT, full_path.string()); } + // Add protected packages from files from installroot + { + auto & protected_option = config.get_protected_packages_option(); + auto resolved_protected_packages = resolve_path_globs(protected_option.get_value_string(), installroot_path); + protected_option.set(protected_option.get_priority(), resolved_protected_packages); + } + load_plugins(); p_impl->plugins.init(); @@ -230,7 +238,7 @@ void Base::setup() { config.get_varsdir_option().lock("Locked by Base::setup()"); pool_setdisttype(**pool, DISTTYPE_RPM); - // TODO(jmracek) - architecture variable is changable therefore architecture in vars must be synchronized with RpmPool + // TODO(jmracek) - architecture variable is changeable therefore architecture in vars must be synchronized with RpmPool // (and force to recompute provides) or locked const char * arch = vars->get_value("arch").c_str(); pool_setarch(**pool, arch); diff --git a/libdnf5/base/goal.cpp b/libdnf5/base/goal.cpp index 80ad38276..c88dd5b99 100644 --- a/libdnf5/base/goal.cpp +++ b/libdnf5/base/goal.cpp @@ -879,7 +879,7 @@ std::pair Goal::Impl::add_install_to_goal( } // The correct evaluation of rich dependencies can be only performed by solver. - // There are some limitations - solver is unable to handle whan operation is limited to packages from the + // There are some limitations - solver is unable to handle when operation is limited to packages from the // particular repository and multilib_policy `all`. if (libdnf5::rpm::Reldep::is_rich_dependency(spec) && settings.to_repo_ids.empty()) { add_provide_install_to_goal(spec, settings); @@ -1198,7 +1198,7 @@ GoalProblem Goal::Impl::add_reinstall_to_goal( } } - // TODO(jmracek) Implement fitering from_repo_ids + // TODO(jmracek) Implement filtering from_repo_ids if (!settings.to_repo_ids.empty()) { relevant_available.filter_repo_id(settings.to_repo_ids, sack::QueryCmp::GLOB); @@ -1273,7 +1273,7 @@ void Goal::Impl::add_rpms_to_goal(base::Transaction & transaction) { } rpm::PackageQuery query(installed); query.filter_nevra(nevras); - // report aready installed packages with the same NEVRA + // report already installed packages with the same NEVRA for (auto package_id : *query.p_impl) { transaction.p_impl->add_resolve_log( action, @@ -2316,7 +2316,7 @@ base::Transaction Goal::resolve() { // 2. group removal needs a list of all groups being removed to correctly remove packages ret |= p_impl->resolve_group_specs(p_impl->group_specs, transaction); - // Handle environments befor groups because they will add/remove groups + // Handle environments before groups because they will add/remove groups p_impl->add_resolved_environment_specs_to_goal(transaction); // Then handle groups diff --git a/libdnf5/base/log_event.cpp b/libdnf5/base/log_event.cpp index 0d64d9da9..62273c4b3 100644 --- a/libdnf5/base/log_event.cpp +++ b/libdnf5/base/log_event.cpp @@ -46,7 +46,7 @@ LogEvent::LogEvent( problem == libdnf5::GoalProblem::SOLVER_PROBLEM_STRICT_RESOLVEMENT), "LogEvent::LogEvent() called with incorrect problem, the constructor does not allow" "libdnf5::GoalProblem::SOLVER_ERROR or libdnf5::GoalProblem::SOLVER_PROBLEM_STRICT_RESOLVEMENT. With those " - "problems it is necesarry to provide SolverProblems in constructor"); + "problems it is necessary to provide SolverProblems in constructor"); } LogEvent::LogEvent(libdnf5::GoalProblem problem, const SolverProblems & solver_problems) diff --git a/libdnf5/base/transaction.cpp b/libdnf5/base/transaction.cpp index 5ff77408c..94a693c97 100644 --- a/libdnf5/base/transaction.cpp +++ b/libdnf5/base/transaction.cpp @@ -354,7 +354,7 @@ void Transaction::Impl::set_transaction( if (!solver_problems.empty()) { add_resolve_log(GoalProblem::SOLVER_ERROR, solver_problems); } else { - // TODO(jmracek) To improve performance add a test whether it make sence to resolve transaction in strict mode + // TODO(jmracek) To improve performance add a test whether it make sense to resolve transaction in strict mode // Test whether there were skipped jobs or used not the best candidates due to broken dependencies rpm::solv::GoalPrivate solved_goal_copy(solved_goal); solved_goal_copy.set_run_in_strict_mode(true); @@ -456,7 +456,7 @@ void Transaction::Impl::set_transaction( const auto reason_override = rpm_reason_overrides.find(pkg.get_package().get_nevra()); if (reason_override != rpm_reason_overrides.end()) { // For UPGRADE, DOWNGRADE and REINSTALL change the reason only if it stronger. - // This is requierd because we don't want to for example mark some user installed + // This is required because we don't want to for example mark some user installed // package as a dependency (except when the user specifically asks for it - action REASON_CHANGE). if (pkg.get_action() == transaction::TransactionItemAction::INSTALL || pkg.get_action() == transaction::TransactionItemAction::REMOVE || @@ -827,7 +827,7 @@ Transaction::TransactionRunResult Transaction::Impl::_run( state.packages.emplace_back(pkg_name); } else { // also group packages that were installed before this transaction - // system state consideres as installed by group + // system state considered as installed by group rpm::PackageQuery query(installed_query); query.filter_name({pkg_name}); if (!query.empty()) { @@ -1087,7 +1087,7 @@ std::string Transaction::serialize() { group_replay.repo_id = *(group.get_group().get_repos().begin()); //TODO(amatej): add package types... if they are actually needed though... which I am not sure now. - // -> becuase if I plan to store the group jsons separately it will contain all information, so the pkg types shoudn't be here + // -> because if I plan to store the group jsons separately it will contain all information, so the pkg types shouldn't be here transaction_replay.groups.push_back(group_replay); } diff --git a/libdnf5/common/exception.cpp b/libdnf5/common/exception.cpp index 2f1628a75..fc23e71ff 100644 --- a/libdnf5/common/exception.cpp +++ b/libdnf5/common/exception.cpp @@ -135,7 +135,7 @@ Error & Error::operator=(const Error & e) noexcept { const char * Error::what() const noexcept { if (!formatter) { - // formatter not set means copy constructor or assigment operator failed + // formatter not set means copy constructor or assignment operator failed return TM_(format, 1); } diff --git a/libdnf5/comps/environment/environment.cpp b/libdnf5/comps/environment/environment.cpp index b18b15c7b..94fd24c66 100644 --- a/libdnf5/comps/environment/environment.cpp +++ b/libdnf5/comps/environment/environment.cpp @@ -213,7 +213,7 @@ void Environment::serialize(const std::string & path) { if (keyname.rfind(summary_prefix, 0) == 0) { lang = keyname.substr(summary_prefix.length()); // Add the lang into the set - // If it's succesful (wasn't already present), create an XML node for this translation + // If it's successful (wasn't already present), create an XML node for this translation if (name_langs.insert(lang).second) { node = utils::xml::add_subnode_with_text(node_environment, "name", std::string(di.kv.str)); xmlNewProp(node, BAD_CAST "xml:lang", BAD_CAST lang.c_str()); @@ -223,7 +223,7 @@ void Environment::serialize(const std::string & path) { else if (keyname.rfind(description_prefix, 0) == 0) { lang = keyname.substr(description_prefix.length()); // Add the lang into the set - // If it's succesful (wasn't already present), create an XML node for this translation + // If it's successful (wasn't already present), create an XML node for this translation if (description_langs.insert(lang).second) { node = utils::xml::add_subnode_with_text(node_environment, "description", std::string(di.kv.str)); xmlNewProp(node, BAD_CAST "xml:lang", BAD_CAST lang.c_str()); diff --git a/libdnf5/comps/group/group.cpp b/libdnf5/comps/group/group.cpp index bf70626b8..6826e3f9a 100644 --- a/libdnf5/comps/group/group.cpp +++ b/libdnf5/comps/group/group.cpp @@ -242,7 +242,7 @@ void Group::serialize(const std::string & path) { if (keyname.rfind(summary_prefix, 0) == 0) { lang = keyname.substr(summary_prefix.length()); // Add the lang into the set - // If it's succesful (wasn't already present), create an XML node for this translation + // If it's successful (wasn't already present), create an XML node for this translation if (name_langs.insert(lang).second) { node = utils::xml::add_subnode_with_text(node_group, "name", std::string(di.kv.str)); xmlNewProp(node, BAD_CAST "xml:lang", BAD_CAST lang.c_str()); @@ -252,7 +252,7 @@ void Group::serialize(const std::string & path) { else if (keyname.rfind(description_prefix, 0) == 0) { lang = keyname.substr(description_prefix.length()); // Add the lang into the set - // If it's succesful (wasn't already present), create an XML node for this translation + // If it's successful (wasn't already present), create an XML node for this translation if (description_langs.insert(lang).second) { node = utils::xml::add_subnode_with_text(node_group, "description", std::string(di.kv.str)); xmlNewProp(node, BAD_CAST "xml:lang", BAD_CAST lang.c_str()); diff --git a/libdnf5/conf/config_main.cpp b/libdnf5/conf/config_main.cpp index 379cfe27b..78a8c0eff 100644 --- a/libdnf5/conf/config_main.cpp +++ b/libdnf5/conf/config_main.cpp @@ -84,75 +84,6 @@ static int str_to_bytes(const std::string & str) { return static_cast(res); } -static void add_from_file(std::ostream & out, const std::string & file_path) { - utils::fs::File file(file_path, "r"); - - std::string line; - while (file.read_line(line)) { - auto start = line.find_first_not_of(" \t\r"); - if (start == std::string::npos) { - continue; - } - if (line[start] == '#') { - continue; - } - auto end = line.find_last_not_of(" \t\r"); - - out.write(line.c_str() + start, static_cast(end - start + 1)); - out.put(' '); - } -} - -static void add_from_files(std::ostream & out, const std::string & glob_path) { - glob_t glob_buf; - glob(glob_path.c_str(), GLOB_MARK | GLOB_NOSORT, nullptr, &glob_buf); - for (size_t i = 0; i < glob_buf.gl_pathc; ++i) { - auto path = glob_buf.gl_pathv[i]; - if (path[strlen(path) - 1] != '/') { - add_from_file(out, path); - } - } - globfree(&glob_buf); -} - -/// @brief Replaces globs (like /etc/foo.d/\\*.foo) by content of matching files. -/// -/// Ignores comment lines (start with '#') and blank lines in files. -/// Result: -/// Words delimited by spaces. Characters ',' and '\n' are replaced by spaces. -/// Extra spaces are removed. -/// @param strWithGlobs Input string with globs -/// @return Words delimited by space -static std::string resolve_globs(const std::string & str_with_globs) { - std::ostringstream res; - std::string::size_type start{0}; - while (start < str_with_globs.length()) { - auto end = str_with_globs.find_first_of(" ,\n", start); - if (str_with_globs.compare(start, 5, "glob:") == 0) { - start += 5; - if (start >= str_with_globs.length()) { - break; - } - if (end == std::string::npos) { - add_from_files(res, str_with_globs.substr(start)); - break; - } - if ((end - start) != 0) { - add_from_files(res, str_with_globs.substr(start, end - start)); - } - } else { - if (end == std::string::npos) { - res << str_with_globs.substr(start); - break; - } - if ((end - start) != 0) { - res << str_with_globs.substr(start, end - start) << " "; - } - } - start = end + 1; - } - return res.str(); -} class ConfigMain::Impl { friend class ConfigMain; @@ -293,7 +224,7 @@ class ConfigMain::Impl { OptionString proxy_username{nullptr}; OptionString proxy_password{nullptr}; OptionStringSet proxy_auth_method{"any", "any|none|basic|digest|negotiate|ntlm|digest_ie|ntlm_wb", false}; - OptionStringList protected_packages{resolve_globs("dnf5 glob:/etc/dnf/protected.d/*.conf")}; + OptionStringList protected_packages{std::vector{"dnf5", "glob:/etc/dnf/protected.d/*.conf"}}; OptionString username{""}; OptionString password{""}; OptionBool gpgcheck{false}; @@ -534,9 +465,7 @@ ConfigMain::Impl::Impl(Config & owner) : owner(owner) { "protected_packages", protected_packages, [&](Option::Priority priority, const std::string & value) { - if (priority >= protected_packages.get_priority()) { - protected_packages.set(priority, resolve_globs(value)); - } + option_T_list_append(protected_packages, priority, value); }, nullptr, false); diff --git a/libdnf5/conf/config_utils.cpp b/libdnf5/conf/config_utils.cpp new file mode 100644 index 000000000..68037ab40 --- /dev/null +++ b/libdnf5/conf/config_utils.cpp @@ -0,0 +1,98 @@ +/* +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 . +*/ + +#include "config_utils.hpp" + +#include "libdnf5/utils/fs/file.hpp" + +#include + + +namespace libdnf5 { + + +static void add_from_file(std::ostream & out, const std::string & file_path) { + utils::fs::File file(file_path, "r"); + + std::string line; + while (file.read_line(line)) { + auto start = line.find_first_not_of(" \t\r"); + if (start == std::string::npos) { + continue; + } + if (line[start] == '#') { + continue; + } + auto end = line.find_last_not_of(" \t\r"); + + out.write(line.c_str() + start, static_cast(end - start + 1)); + out.put(' '); + } +} + + +static void add_from_files( + std::ostream & out, const std::string & glob_path, const std::filesystem::path & installroot) { + // Extend path by installroot + const auto full_path = (installroot / std::filesystem::path(glob_path).relative_path()).string(); + glob_t glob_buf; + glob(full_path.c_str(), GLOB_MARK | GLOB_NOSORT, nullptr, &glob_buf); + for (size_t i = 0; i < glob_buf.gl_pathc; ++i) { + auto path = glob_buf.gl_pathv[i]; + if (path[strlen(path) - 1] != '/') { + add_from_file(out, path); + } + } + globfree(&glob_buf); +} + + +std::string resolve_path_globs(const std::string & str_with_globs, const std::filesystem::path & installroot) { + std::ostringstream res; + std::string::size_type start{0}; + while (start < str_with_globs.length()) { + auto end = str_with_globs.find_first_of(" ,\n", start); + if (str_with_globs.compare(start, 5, "glob:") == 0) { + start += 5; + if (start >= str_with_globs.length()) { + break; + } + if (end == std::string::npos) { + add_from_files(res, str_with_globs.substr(start), installroot); + break; + } + if ((end - start) != 0) { + add_from_files(res, str_with_globs.substr(start, end - start), installroot); + } + } else { + if (end == std::string::npos) { + res << str_with_globs.substr(start); + break; + } + if ((end - start) != 0) { + res << str_with_globs.substr(start, end - start) << " "; + } + } + start = end + 1; + } + return res.str(); +} + + +} // namespace libdnf5 diff --git a/libdnf5/conf/config_utils.hpp b/libdnf5/conf/config_utils.hpp index dc610835c..9f85b426c 100644 --- a/libdnf5/conf/config_utils.hpp +++ b/libdnf5/conf/config_utils.hpp @@ -22,8 +22,10 @@ along with libdnf. If not, see . #include "libdnf5/conf/option.hpp" + namespace libdnf5 { + template static void option_T_list_append(T & option, Option::Priority priority, const std::string & value) { if (value.empty()) { @@ -47,6 +49,18 @@ static void option_T_list_append(T & option, Option::Priority priority, const st } } + +/// @brief Replaces globs (like /etc/foo.d/\\*.foo) by content of matching files. +/// +/// Ignores comment lines (start with '#') and blank lines in files. +/// Result: +/// Words delimited by spaces. Characters ',' and '\n' are replaced by spaces. +/// Extra spaces are removed. +/// @param strWithGlobs Input string with globs +/// @return Words delimited by space +std::string resolve_path_globs(const std::string & str_with_globs, const std::filesystem::path & installroot); + + } // namespace libdnf5 #endif diff --git a/libdnf5/conf/vars.cpp b/libdnf5/conf/vars.cpp index a017e2000..4e58e9763 100644 --- a/libdnf5/conf/vars.cpp +++ b/libdnf5/conf/vars.cpp @@ -94,7 +94,7 @@ static std::string detect_arch() { /* un.machine is armvXE, where X is version number and E is * endianness (b or l); we need to add modifiers such as * h (hardfloat), n (neon). Neon is a requirement of armv8 so - * as far as rpm is concerned armv8l is the equivilent of armv7hnl + * as far as rpm is concerned armv8l is the equivalent of armv7hnl * (or 7hnb) so we don't explicitly add 'n' for 8+ as it's expected. */ char endian = un.machine[strlen(un.machine) - 1]; char * modifier = un.machine + 5; diff --git a/libdnf5/module/module_sack.cpp b/libdnf5/module/module_sack.cpp index e2af5429d..2176a2944 100644 --- a/libdnf5/module/module_sack.cpp +++ b/libdnf5/module/module_sack.cpp @@ -281,7 +281,7 @@ void ModuleSack::Impl::module_filtering() { auto [include_NEVRAs, exclude_NEVRAs, names, src_names, reldep_name_list] = collect_data_for_modular_filtering(); - // Packages from system, commandline, and hotfix repositories are not targets for modular filterring + // Packages from system, commandline, and hotfix repositories are not targets for modular filtering libdnf5::rpm::PackageQuery target_packages(base); // TODO(replace) "@System", "@commandline" by defined variables like in dnf4 @@ -319,7 +319,7 @@ void ModuleSack::Impl::module_filtering() { exclude_provides_query.filter_provides(reldep_name_list); exclude_provides_query.difference(include_query); - // Search for source packages with same names as included source artifacts. Handling of sorce packages differently + // Search for source packages with same names as included source artifacts. Handling of source packages differently // prevent filtering out of binary packages that has the same name as source package but binary package is not // in module (it prevents creation of broken dependenciers in the distribution) exclude_src_names_query.filter_name(src_names); @@ -535,7 +535,7 @@ std::pair>, ModuleSack::ModuleErrorType> Mo return make_pair(problems, ModuleSack::ModuleErrorType::ERROR_IN_LATEST); } - // Conflicting modules has to be removed otherwice it could result than one of them will be active + // Conflicting modules has to be removed otherwise it could result than one of them will be active for (auto conflicting_module_id : goal.list_conflicting()) { excludes->add(conflicting_module_id); } diff --git a/libdnf5/module/module_sack_impl.hpp b/libdnf5/module/module_sack_impl.hpp index d16406276..eb423f284 100644 --- a/libdnf5/module/module_sack_impl.hpp +++ b/libdnf5/module/module_sack_impl.hpp @@ -121,7 +121,7 @@ class ModuleSack::Impl { /// @param name module name to be enabled. /// @param stream module stream to be enabled. /// @param count if `true`, count the change towards the limit of module status modifications. - /// @return `true` if requested change realy triggers a change in the ModuleDB, `false` otherwise. + /// @return `true` if requested change really triggers a change in the ModuleDB, `false` otherwise. /// @throw EnableMultipleStreamsError in case of conflicting enable requests. /// @throw NoModuleError if the module doesn't exist. /// @since 5.0.14 @@ -129,7 +129,7 @@ class ModuleSack::Impl { /// Enable module stream. /// @param module_spec module to be enabled. /// @param count if `true`, count the change towards the limit of module status modifications. - /// @return `true` if requested change realy triggers a change in the ModuleDB, `false` otherwise. + /// @return `true` if requested change really triggers a change in the ModuleDB, `false` otherwise. /// @throw EnableMultipleStreamsError in case of conflicting enable requests. /// @throw NoModuleError if the module doesn't exist. /// @since 5.0.14 diff --git a/libdnf5/repo/repo_sack.cpp b/libdnf5/repo/repo_sack.cpp index 1e9b4caa4..a0208b28e 100644 --- a/libdnf5/repo/repo_sack.cpp +++ b/libdnf5/repo/repo_sack.cpp @@ -515,7 +515,7 @@ void RepoSack::update_and_load_enabled_repos(bool load_system) { update_and_load_repos(repos); - // TODO(jmracek) Replace by call that will resolve active modules and apply modular filterring + // TODO(jmracek) Replace by call that will resolve active modules and apply modular filtering base->get_module_sack()->p_impl->module_filtering(); repos_updated_and_loaded = true; diff --git a/libdnf5/rpm/nevra.cpp b/libdnf5/rpm/nevra.cpp index aa09d88ee..da27b0adc 100644 --- a/libdnf5/rpm/nevra.cpp +++ b/libdnf5/rpm/nevra.cpp @@ -48,7 +48,7 @@ std::vector Nevra::parse(const std::string & nevra_str, const std::vector // detect whether string contains a glob range [a-z] bool start_range = false; for (end = nevra_pattern; *end != '\0'; ++end) { - // skip all characteres before glob range is closed + // skip all characters before glob range is closed if (start_range) { if (*end == ']') { start_range = false; diff --git a/libdnf5/rpm/package.cpp b/libdnf5/rpm/package.cpp index 66a9e8e8b..f6ecd2db6 100644 --- a/libdnf5/rpm/package.cpp +++ b/libdnf5/rpm/package.cpp @@ -511,4 +511,8 @@ BaseWeakPtr Package::get_base() const { return base; } +std::string Package::to_string_description() const { + return fmt::format("", to_string(), get_id().id); +} + } // namespace libdnf5::rpm diff --git a/libdnf5/rpm/package_query.cpp b/libdnf5/rpm/package_query.cpp index ce9a90df3..e9cd7ee70 100644 --- a/libdnf5/rpm/package_query.cpp +++ b/libdnf5/rpm/package_query.cpp @@ -746,7 +746,7 @@ struct NevraID { /// bool create_evr_id - when `false` it will store evr as std::string (evr_str), when `true` it sets Id evr. When string is unknown to pool it returns false /// evr is stored only as Id (create_evr_id==true, evr), or a string (evr_str) but not both. /// - /// @return bool Returns true if parsing succesful and all elements is known to pool but related to create_evr_id + /// @return bool Returns true if parsing successful and all elements is known to pool but related to create_evr_id bool parse(libdnf5::solv::RpmPool & pool, const char * nevra_pattern, bool create_evr_id); }; @@ -982,7 +982,7 @@ inline static void filter_version_internal( std::string vr(pool.split_evr(pool.get_evr(candidate_id)).v); vr.append("-0"); int cmp = pool.evrcmp_str(vr.c_str(), formatted_c_pattern, EVRCMP_COMPARE); - if (cmp_eq(cmp)) { + if (cmp_fnc(cmp)) { filter_result.add_unsafe(candidate_id); } } @@ -1050,7 +1050,7 @@ inline static void filter_release_internal( std::string vr("0-"); vr.append(pool.split_evr(pool.get_evr(candidate_id)).r); int cmp = pool.evrcmp_str(vr.c_str(), formatted_c_pattern, EVRCMP_COMPARE); - if (cmp_eq(cmp)) { + if (cmp_fnc(cmp)) { filter_result.add_unsafe(candidate_id); } } @@ -1683,7 +1683,7 @@ void PackageQuery::PQImpl::filter_reldep( selection_make_matchsolvable(*pool, &out.get_queue(), package_id, flags, libsolv_key, 0); // Queue from selection_make_matchsolvable is a selection, which means - // it conntains pairs , flags refers to how was the Id + // it contains pairs , flags refers to how was the Id // matched, that is not important here, so skip it and iterate just // over the Ids. for (int j = 1; j < out.size(); j += 2) { @@ -2633,7 +2633,7 @@ std::pair PackageQuery::resolve_pkg_spec( return {true, libdnf5::rpm::Nevra()}; } } - // Seach for file provides - more expensive + // Search for file provides - more expensive for (auto & path : binary_paths_string) { filter_dataiterator( *pool, diff --git a/libdnf5/rpm/reldep.cpp b/libdnf5/rpm/reldep.cpp index 320e9ab4e..c300cf485 100644 --- a/libdnf5/rpm/reldep.cpp +++ b/libdnf5/rpm/reldep.cpp @@ -64,6 +64,10 @@ std::string Reldep::to_string() const { return cstring ? std::string(cstring) : std::string(); } +std::string Reldep::to_string_description() const { + return fmt::format("", to_string(), get_id().id); +} + ReldepId Reldep::get_reldep_id( const BaseWeakPtr & base, const char * name, const char * version, CmpType cmp_type, int create) { static_assert( diff --git a/libdnf5/rpm/rpm_signature.cpp b/libdnf5/rpm/rpm_signature.cpp index d9373510a..cb3efa572 100644 --- a/libdnf5/rpm/rpm_signature.cpp +++ b/libdnf5/rpm/rpm_signature.cpp @@ -119,7 +119,7 @@ RpmSignature::CheckResult RpmSignature::check_package_signature(rpm::Package pkg } // rpmcliVerifySignatures is the only API rpm provides for signature verification. - // Unfortunatelly to distinguish key_missing/not_signed/verification_failed cases + // Unfortunately to distinguish key_missing/not_signed/verification_failed cases // we need to temporarily increase log level to RPMLOG_INFO, collect the log // messages and parse them. // This code is only slightly better than running `rpmkeys --checksig` tool diff --git a/libdnf5/rpm/solv/goal_private.cpp b/libdnf5/rpm/solv/goal_private.cpp index facf25cb8..78477b3f2 100644 --- a/libdnf5/rpm/solv/goal_private.cpp +++ b/libdnf5/rpm/solv/goal_private.cpp @@ -254,7 +254,7 @@ bool GoalPrivate::limit_installonly_packages(libdnf5::solv::IdQueue & job, Id ru // to `q` IdQueue those that are not marked for install and are not already // installed are added to available_unused_providers. FOR_PROVIDES(p, pp, installonly[i]) { - // TODO(jmracek) Replase the test by cached data from sack.p_impl->get_solvables() + // TODO(jmracek) Replace the test by cached data from sack.p_impl->get_solvables() if (!spool.is_package(p)) { continue; } @@ -378,7 +378,7 @@ libdnf5::GoalProblem GoalPrivate::resolve() { /* apply the excludes */ //dnf_sack_recompute_considered(sack); - // TODO make_provides_ready remove temporrary Ids for One_OF => what about to lock it? + // TODO make_provides_ready remove temporary Ids for One_OF => what about to lock it? //dnf_sack_make_provides_ready(sack); if (libsolv_transaction) { transaction_free(libsolv_transaction); @@ -388,7 +388,7 @@ libdnf5::GoalProblem GoalPrivate::resolve() { init_solver(pool, libsolv_solver); // Remove SOLVER_WEAK and add SOLVER_BEST to all transactions to allow report skipped packages and best candidates - // with broken dependenies + // with broken dependencies if (run_in_strict_mode) { for (int i = 0; i < job.size(); i += 2) { job[i] &= ~SOLVER_WEAK; @@ -715,11 +715,11 @@ transaction::TransactionItemReason GoalPrivate::get_reason(Id id) { if ((reason == SOLVER_REASON_UNIT_RULE || reason == SOLVER_REASON_RESOLVE_JOB) && (libsolv_solver.ruleclass(info) == SOLVER_RULE_JOB || libsolv_solver.ruleclass(info) == SOLVER_RULE_BEST)) { - // explicitely user-installed + // explicitly user-installed if (transaction_user_installed && transaction_user_installed->contains(id)) { return transaction::TransactionItemReason::USER; } - // explicitely group-installed + // explicitly group-installed if (transaction_group_installed && transaction_group_installed->contains(id)) { return transaction::TransactionItemReason::GROUP; } diff --git a/libdnf5/rpm/solv/goal_private.hpp b/libdnf5/rpm/solv/goal_private.hpp index 410dd87f5..760016450 100644 --- a/libdnf5/rpm/solv/goal_private.hpp +++ b/libdnf5/rpm/solv/goal_private.hpp @@ -72,7 +72,7 @@ class GoalPrivate { /// Remember group action in the transaction /// @param group Group to be added - /// @param action Action to be commited - INSTALL, REMOVE, UPGRADE + /// @param action Action to be committed - INSTALL, REMOVE, UPGRADE /// @param reason Reason for the group action - USER, DEPENDENCY /// @param package_types Types of group packages requested to be installed along with the group. Used only for INSTALL action void add_group( @@ -153,7 +153,7 @@ class GoalPrivate { void set_allow_vendor_change(bool value) { allow_vendor_change = value; } void set_install_weak_deps(bool value) { install_weak_deps = value; } /// Remove SOLVER_WEAK and add SOLVER_BEST to all jobs to allow report skipped packages and best candidates - /// with broken dependenies + /// with broken dependencies void set_run_in_strict_mode(bool value) { run_in_strict_mode = value; } // TODO(jmracek) // PackageSet listUnneeded(); @@ -189,7 +189,7 @@ class GoalPrivate { // packages potentially installed by any group in this transaction std::unique_ptr transaction_group_installed; - // packages explicitely user-installed in this transaction + // packages explicitly user-installed in this transaction std::unique_ptr transaction_user_installed; // packages that should be not included to satisfy weak dependencies diff --git a/libdnf5/rpm/transaction.cpp b/libdnf5/rpm/transaction.cpp index d8eec7f7d..485924aa8 100644 --- a/libdnf5/rpm/transaction.cpp +++ b/libdnf5/rpm/transaction.cpp @@ -142,7 +142,7 @@ std::string Transaction::get_db_cookie() const { void Transaction::fill(const base::Transaction & transaction) { transaction_items = transaction.get_transaction_packages(); - // Auxilliary map name->package with the latest versions of currently + // Auxiliary map name->package with the latest versions of currently // installed installonly packages. // Used to detect installation of a installonly package with lower version // that is currently installed. diff --git a/libdnf5/solv/reldep_parser.hpp b/libdnf5/solv/reldep_parser.hpp index 2eeba0759..fb1ca760a 100644 --- a/libdnf5/solv/reldep_parser.hpp +++ b/libdnf5/solv/reldep_parser.hpp @@ -30,10 +30,10 @@ namespace libdnf5::solv { struct ReldepParser { public: /// Parses `reldep` into three elements: name, evr, and comparison type. - /// If parsing is not succesful, the object contains garbage (tm). + /// If parsing is not successful, the object contains garbage (tm). /// /// @param reldep The reldep string to parse. - /// @return `true` if parsing was succesful. + /// @return `true` if parsing was successful. bool parse(const std::string & reldep); const std::string & get_name() const noexcept { return name; } diff --git a/libdnf5/system/state.cpp b/libdnf5/system/state.cpp index 6d1426d78..a9096f016 100644 --- a/libdnf5/system/state.cpp +++ b/libdnf5/system/state.cpp @@ -610,7 +610,7 @@ void State::reset_packages_states( this->environment_states = std::move(environment_states); // Try to save the new system state. - // dnf can be used without root priviledges or with read-only system state location. + // dnf can be used without root privileges or with read-only system state location. // In that case ignore the filesystem errors and only keep new system state in memory. try { save(); diff --git a/libdnf5/transaction/db/repo.hpp b/libdnf5/transaction/db/repo.hpp index 906d350b9..5e4b484d7 100644 --- a/libdnf5/transaction/db/repo.hpp +++ b/libdnf5/transaction/db/repo.hpp @@ -43,7 +43,7 @@ int64_t repo_insert(libdnf5::utils::SQLite3::Statement & query, const std::strin std::unique_ptr repo_select_pk_new_query(libdnf5::utils::SQLite3 & conn); -/// Find a primary key of a recod in table 'repo' that matches the Package. +/// Find a primary key of a record in table 'repo' that matches the Package. /// Return an existing primary key or 0 if the record was not found. int64_t repo_select_pk(libdnf5::utils::SQLite3::Statement & query, const std::string & repoid); diff --git a/libdnf5/transaction/db/rpm.hpp b/libdnf5/transaction/db/rpm.hpp index 98d66c24b..55051f888 100644 --- a/libdnf5/transaction/db/rpm.hpp +++ b/libdnf5/transaction/db/rpm.hpp @@ -44,7 +44,7 @@ class RpmDbUtils { static int64_t rpm_insert(libdnf5::utils::SQLite3::Statement & query, const Package & rpm); - /// Find a primary key of a recod in table 'rpm' that matches the Package. + /// Find a primary key of a record in table 'rpm' that matches the Package. /// Return an existing primary key or 0 if the record was not found. static int64_t rpm_select_pk(libdnf5::utils::SQLite3::Statement & query, const Package & rpm); diff --git a/libdnf5/utils/dnf4convert/dnf4convert.cpp b/libdnf5/utils/dnf4convert/dnf4convert.cpp index 4739d4c1b..56e761739 100644 --- a/libdnf5/utils/dnf4convert/dnf4convert.cpp +++ b/libdnf5/utils/dnf4convert/dnf4convert.cpp @@ -34,7 +34,7 @@ namespace libdnf5::dnf4convert { // each NEVRA. Only REINSTALLED (10) action is skipped because it can be ordered // after respective REINSTALL action overwriting potential repoid change. // Packages with the latest action 3 (DOWNGRADED), 5 (OBSOLETED), 7 (UPGRADED), and -// 8 (REMOVE) are eventually skiped as removed from the system. +// 8 (REMOVE) are eventually skipped as removed from the system. static constexpr const char * SQL_CURRENTLY_INSTALLED_PACKAGES = R"**( SELECT "ti"."item_id", diff --git a/libdnf5/utils/library.cpp b/libdnf5/utils/library.cpp index 90bd92807..49bfb0c4b 100644 --- a/libdnf5/utils/library.cpp +++ b/libdnf5/utils/library.cpp @@ -28,7 +28,7 @@ namespace libdnf5::utils { Library::Library(const std::string & path) : path(path) { handle = dlopen(path.c_str(), RTLD_LAZY); if (!handle) { - const char * err_msg = dlerror(); // returns localized mesage, problem with later translation + const char * err_msg = dlerror(); // returns localized message, problem with later translation throw LibraryLoadingError(M_("Cannot load shared library \"{}\": {}"), path, std::string(err_msg)); } } @@ -41,7 +41,7 @@ void * Library::get_address(const char * symbol) const { dlerror(); // Clear any existing error void * address = dlsym(handle, symbol); if (!address) { - const char * err_msg = dlerror(); // returns localized mesage, problem with later translation + const char * err_msg = dlerror(); // returns localized message, problem with later translation if (err_msg) { throw LibrarySymbolNotFoundError( M_("Cannot obtain address of symbol \"{}\": {}"), std::string(symbol), std::string(err_msg)); diff --git a/libdnf5/utils/sqlite3/sqlite3.cpp b/libdnf5/utils/sqlite3/sqlite3.cpp index 0ef2d126a..374c299a8 100644 --- a/libdnf5/utils/sqlite3/sqlite3.cpp +++ b/libdnf5/utils/sqlite3/sqlite3.cpp @@ -155,7 +155,7 @@ void SQLite3::restore(const std::string & input_file) { sqlite3_close(backup_db); if (result != SQLITE_OK) { - throw SQLite3SQLError(result, M_("Failed to restored database \"{}\""), input_file); + throw SQLite3SQLError(result, M_("Failed to restore database \"{}\""), input_file); } } diff --git a/test/data/repos-solv/solv-humongous.repo b/test/data/repos-solv/solv-humongous.repo index 604e0c9f2..dfa6884cd 100644 --- a/test/data/repos-solv/solv-humongous.repo +++ b/test/data/repos-solv/solv-humongous.repo @@ -1,6 +1,6 @@ =Ver: 3.0 -# a repo with 1000 packages for performace tests +# a repo with 1000 packages for performance tests =Pkg: pkg-a 1 1 noarch =Prv: prv-a-1-1 diff --git a/test/libdnf5/conf/test_config_parser.cpp b/test/libdnf5/conf/test_config_parser.cpp index e0730bef8..91d0fae4f 100644 --- a/test/libdnf5/conf/test_config_parser.cpp +++ b/test/libdnf5/conf/test_config_parser.cpp @@ -321,8 +321,8 @@ void ConfigParserTest::test_create_with_comments_header() { create(items_with_comments_header, with_comments_header_content, false); } -// Creates crazy (crazy custom formating) ini file. -// Uses raw texts, ini file uses custom formating. +// Creates crazy (crazy custom formatting) ini file. +// Uses raw texts, ini file uses custom formatting. void ConfigParserTest::test_create_crazy() { create(crazy_items, crazy_ini_content, true); } diff --git a/test/libdnf5/impl_ptr/test_impl_ptr.cpp b/test/libdnf5/impl_ptr/test_impl_ptr.cpp index dac0f5740..1ee24e172 100644 --- a/test/libdnf5/impl_ptr/test_impl_ptr.cpp +++ b/test/libdnf5/impl_ptr/test_impl_ptr.cpp @@ -46,7 +46,7 @@ class CTest { ~CTest() { --instance_counter; } - // Returns the nuber of existing class instances. + // Returns the number of existing class instances. static int get_instance_counter() noexcept { return instance_counter; } int get_a() const noexcept { return a; } diff --git a/test/libdnf5/rpm/test_package_query.cpp b/test/libdnf5/rpm/test_package_query.cpp index f53d4d81c..edbb2bdbe 100644 --- a/test/libdnf5/rpm/test_package_query.cpp +++ b/test/libdnf5/rpm/test_package_query.cpp @@ -501,6 +501,29 @@ void RpmPackageQueryTest::test_filter_version() { expected = {get_pkg("pkg-libs-1:1.3-4.x86_64")}; CPPUNIT_ASSERT_EQUAL(expected, to_vector(query2)); + + // packages with version < "1.3" + PackageQuery query3(base); + query3.filter_version({"1.3"}, libdnf5::sack::QueryCmp::LT); + + expected = { + get_pkg("pkg-0:1.2-3.src"), + get_pkg("pkg-0:1.2-3.x86_64"), + get_pkg("pkg-libs-0:1.2-3.x86_64"), + get_pkg("pkg-libs-1:1.2-4.x86_64")}; + CPPUNIT_ASSERT_EQUAL(expected, to_vector(query3)); + + // packages with version <= "1.3" + PackageQuery query4(base); + query4.filter_version({"1.3"}, libdnf5::sack::QueryCmp::LTE); + + expected = { + get_pkg("pkg-0:1.2-3.src"), + get_pkg("pkg-0:1.2-3.x86_64"), + get_pkg("pkg-libs-0:1.2-3.x86_64"), + get_pkg("pkg-libs-1:1.2-4.x86_64"), + get_pkg("pkg-libs-1:1.3-4.x86_64")}; + CPPUNIT_ASSERT_EQUAL(expected, to_vector(query4)); } @@ -523,6 +546,25 @@ void RpmPackageQueryTest::test_filter_release() { expected = {get_pkg("pkg-libs-1:1.2-4.x86_64"), get_pkg("pkg-libs-1:1.3-4.x86_64")}; CPPUNIT_ASSERT_EQUAL(expected, to_vector(query2)); + + // packages with release > "3" + PackageQuery query3(base); + query3.filter_release({"3"}, libdnf5::sack::QueryCmp::GT); + + expected = {get_pkg("pkg-libs-1:1.2-4.x86_64"), get_pkg("pkg-libs-1:1.3-4.x86_64")}; + CPPUNIT_ASSERT_EQUAL(expected, to_vector(query3)); + + // packages with release >= "3" + PackageQuery query4(base); + query4.filter_release({"3"}, libdnf5::sack::QueryCmp::GTE); + + expected = { + get_pkg("pkg-0:1.2-3.src"), + get_pkg("pkg-0:1.2-3.x86_64"), + get_pkg("pkg-libs-0:1.2-3.x86_64"), + get_pkg("pkg-libs-1:1.2-4.x86_64"), + get_pkg("pkg-libs-1:1.3-4.x86_64")}; + CPPUNIT_ASSERT_EQUAL(expected, to_vector(query4)); } void RpmPackageQueryTest::test_filter_priority() { diff --git a/test/libdnf5/solv/test_id_queue.cpp b/test/libdnf5/solv/test_id_queue.cpp index 8515128e9..c64de1f05 100644 --- a/test/libdnf5/solv/test_id_queue.cpp +++ b/test/libdnf5/solv/test_id_queue.cpp @@ -44,7 +44,7 @@ void IdQueueTest::test_push_back() { id_queue.push_back(3, 2); CPPUNIT_ASSERT(id_queue.size() == 3); - // insert same valule like it is in queue will result in increase of elements + // insert same value like it is in queue will result in increase of elements id_queue.push_back(3); CPPUNIT_ASSERT(id_queue.size() == 4); @@ -74,12 +74,12 @@ void IdQueueTest::test_operators() { CPPUNIT_ASSERT(id_queue_different4 != id_queue_different3); CPPUNIT_ASSERT(id_queue_different3 != id_queue_different4); - // test copy costructor + // test copy constructor auto copy = id_queue_same1; CPPUNIT_ASSERT(id_queue_same1 == copy); CPPUNIT_ASSERT(id_queue_same1.size() == 2); - // test move costructor + // test move constructor auto move = std::move(id_queue_same1); CPPUNIT_ASSERT(id_queue_same1 != move); CPPUNIT_ASSERT(id_queue_same1.size() == 0); diff --git a/test/libdnf5/transaction/test_transaction.cpp b/test/libdnf5/transaction/test_transaction.cpp index 3a9b26220..c3201f1e0 100644 --- a/test/libdnf5/transaction/test_transaction.cpp +++ b/test/libdnf5/transaction/test_transaction.cpp @@ -127,7 +127,7 @@ void TransactionTest::test_update() { (trans.*get(set_state{}))(TransactionState::ERROR); (trans.*get(finish{}))(TransactionState::OK); - // load the transction from the database + // load the transaction from the database auto base2 = new_base(); auto ts_list = base2->get_transaction_history()->list_transactions({trans.get_id()}); CPPUNIT_ASSERT_EQUAL((size_t)1, ts_list.size()); diff --git a/test/libdnf5/weak_ptr/test_weak_ptr.cpp b/test/libdnf5/weak_ptr/test_weak_ptr.cpp index 5eb587ce5..d296b389a 100644 --- a/test/libdnf5/weak_ptr/test_weak_ptr.cpp +++ b/test/libdnf5/weak_ptr/test_weak_ptr.cpp @@ -80,7 +80,7 @@ void WeakPtrTest::test_weak_ptr() { // delete sack2 sack2.reset(); - // data from sack1 must be still accesible, but access to data from sack2 must throw exception + // data from sack1 must be still accessible, but access to data from sack2 must throw exception CPPUNIT_ASSERT(*item1_weak_ptr.get() == "sack1_item1"); CPPUNIT_ASSERT(item2_weak_ptr->compare("sack1_item2") == 0); CPPUNIT_ASSERT_THROW(static_cast(*item3_weak_ptr.get() == "sack2_item1"), libdnf5::AssertionError); @@ -197,7 +197,7 @@ void WeakPtrTest::test_weak_ptr_is_owner() { // delete sack2 sack2.reset(); - // data from sack1 must be still accesible, but access to data from sack2 must throw exception + // data from sack1 must be still accessible, but access to data from sack2 must throw exception CPPUNIT_ASSERT(*item1_weak_ptr.get()->remote_data == "sack1_item1"); CPPUNIT_ASSERT(*item2_weak_ptr->remote_data == "sack1_item2"); CPPUNIT_ASSERT_THROW( diff --git a/test/python3/libdnf5/rpm/test_package_query.py b/test/python3/libdnf5/rpm/test_package_query.py index 048ef9608..d6eb2edcc 100644 --- a/test/python3/libdnf5/rpm/test_package_query.py +++ b/test/python3/libdnf5/rpm/test_package_query.py @@ -147,7 +147,7 @@ def test_pkg_query_without_setup(self): # Create a new Base object base = libdnf5.base.Base() - # Try to create a packge query without running base.setup() + # Try to create a package query without running base.setup() self.assertRaises(RuntimeError, libdnf5.rpm.PackageQuery, base) def test_pkg_get_changelogs(self): diff --git a/test/python3/libdnf5/tutorial/session/create_base.py b/test/python3/libdnf5/tutorial/session/create_base.py index 24f33ca06..e1d26009c 100644 --- a/test/python3/libdnf5/tutorial/session/create_base.py +++ b/test/python3/libdnf5/tutorial/session/create_base.py @@ -19,7 +19,7 @@ # is loaded. Function also loads configuration files from distribution and # user ("/etc/dnf/libdnf5.conf.d") drop-in directories. # Optionally set a custom value to "config_file_path" before calling this method -# to load configuration from a anoher configuration file. +# to load configuration from a another configuration file. base.load_config() # Optionally you can set and get vars diff --git a/test/python3/libdnf5/tutorial/transaction/transaction.py b/test/python3/libdnf5/tutorial/transaction/transaction.py index d06927607..5089559a3 100644 --- a/test/python3/libdnf5/tutorial/transaction/transaction.py +++ b/test/python3/libdnf5/tutorial/transaction/transaction.py @@ -7,11 +7,11 @@ # Resolve the goal, create a transaction object. # -# The argument is `allow_erasing`, a flag indicating wheter to allow removing +# The argument is `allow_erasing`, a flag indicating whether to allow removing # packages in the resolved transaction. transaction = goal.resolve() -# We can iterate over the resolved transction and inspect the packages. +# We can iterate over the resolved transaction and inspect the packages. print("Resolved transaction:") for tspkg in transaction.get_transaction_packages(): print(tspkg.get_package().get_nevra(), ": ", diff --git a/test/tutorial/session/create_base.cpp b/test/tutorial/session/create_base.cpp index 2555c811a..feb016f59 100644 --- a/test/tutorial/session/create_base.cpp +++ b/test/tutorial/session/create_base.cpp @@ -20,7 +20,7 @@ base.get_config().get_installroot_option().set(installroot); // is loaded. Function also loads configuration files from distribution and // user ("/etc/dnf/libdnf5.conf.d") drop-in directories. // Optionally set a custom value to "config_file_path" before calling this method -// to load configuration from a anoher configuration file. +// to load configuration from a another configuration file. base.load_config(); // Load vars and do other initialization (of libsolv pool, etc.) based on the diff --git a/test/tutorial/transaction/transaction.cpp b/test/tutorial/transaction/transaction.cpp index 24960c520..5f3690d5f 100644 --- a/test/tutorial/transaction/transaction.cpp +++ b/test/tutorial/transaction/transaction.cpp @@ -12,11 +12,11 @@ goal.add_rpm_install("one"); // Resolve the goal, create a transaction object. // -// The argument is `allow_erasing`, a flag indicating wheter to allow removing +// The argument is `allow_erasing`, a flag indicating whether to allow removing // packages in the resolved transaction. auto transaction = goal.resolve(); -// We can iterate over the resolved transction and inspect the packages. +// We can iterate over the resolved transaction and inspect the packages. std::cout << "Resolved transaction:" << std::endl; for (const auto & tspkg : transaction.get_transaction_packages()) { std::cout << tspkg.get_package().get_nevra() << ": " << transaction_item_action_to_string(tspkg.get_action())