Skip to content

Commit

Permalink
Rename namespace using vscode-cpptools
Browse files Browse the repository at this point in the history
  • Loading branch information
evan-goode authored and m-blaha committed Jun 21, 2023
1 parent 425e520 commit 04c073f
Show file tree
Hide file tree
Showing 557 changed files with 3,834 additions and 3,779 deletions.
4 changes: 2 additions & 2 deletions common/utils/string.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ along with libdnf. If not, see <https://www.gnu.org/licenses/>.
#include "string.hpp"


namespace libdnf::utils::string {
namespace libdnf5::utils::string {


static std::vector<std::string> split_impl(
Expand Down Expand Up @@ -87,4 +87,4 @@ std::vector<std::string> split(const std::string & str, const std::string & deli
}


} // namespace libdnf::utils::string
} // namespace libdnf5::utils::string
4 changes: 2 additions & 2 deletions common/utils/string.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ along with libdnf. If not, see <https://www.gnu.org/licenses/>.
#include <vector>


namespace libdnf::utils::string {
namespace libdnf5::utils::string {

inline std::string c_to_str(const char * c_str) {
if (c_str == nullptr) {
Expand Down Expand Up @@ -115,6 +115,6 @@ inline std::string format_epoch(unsigned long long epoch_num) {
return std::string(buffer);
}

} // namespace libdnf::utils::string
} // namespace libdnf5::utils::string

#endif // LIBDNF_UTILS_STRING_HPP
4 changes: 2 additions & 2 deletions common/utils/url.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ along with libdnf. If not, see <https://www.gnu.org/licenses/>.
#include "url.hpp"


namespace libdnf::utils::url {
namespace libdnf5::utils::url {

bool is_url(std::string path) {
for (auto & ch : path) {
Expand All @@ -34,4 +34,4 @@ bool is_url(std::string path) {
path.starts_with("https://");
}

} // namespace libdnf::utils::url
} // namespace libdnf5::utils::url
4 changes: 2 additions & 2 deletions common/utils/url.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,10 @@ along with libdnf. If not, see <https://www.gnu.org/licenses/>.
#include <string>


namespace libdnf::utils::url {
namespace libdnf5::utils::url {

bool is_url(std::string path);

} // namespace libdnf::utils::url
} // namespace libdnf5::utils::url

#endif // LIBDNF_UTILS_URL_HPP
26 changes: 13 additions & 13 deletions dnf5-plugins/builddep_plugin/builddep.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ along with libdnf. If not, see <https://www.gnu.org/licenses/>.

namespace dnf5 {

using namespace libdnf::cli;
using namespace libdnf5::cli;

void BuildDepCommand::set_parent_command() {
auto * arg_parser_parent_cmd = get_session().get_argument_parser().get_root_command();
Expand Down Expand Up @@ -74,9 +74,9 @@ void BuildDepCommand::set_argument_parser() {
defs->set_parse_hook_func(
[this](
[[maybe_unused]] ArgumentParser::NamedArg * arg, [[maybe_unused]] const char * option, const char * value) {
auto split = libdnf::utils::string::split(value, " ", 2);
auto split = libdnf5::utils::string::split(value, " ", 2);
if (split.size() != 2) {
throw libdnf::cli::ArgumentParserError(
throw libdnf5::cli::ArgumentParserError(
M_("Invalid value for macro definition \"{}\". \"macro expr\" format expected."), value);
}
rpm_macros.emplace_back(std::move(split[0]), std::move(split[1]));
Expand Down Expand Up @@ -182,16 +182,16 @@ bool BuildDepCommand::add_from_pkg(
std::set<std::string> & install_specs, std::set<std::string> & conflicts_specs, const std::string & pkg_spec) {
auto & ctx = get_context();

libdnf::rpm::PackageQuery pkg_query(ctx.base);
libdnf5::rpm::PackageQuery pkg_query(ctx.base);
pkg_query.resolve_pkg_spec(
pkg_spec, libdnf::ResolveSpecSettings{.with_provides = false, .with_filenames = false}, false);
pkg_spec, libdnf5::ResolveSpecSettings{.with_provides = false, .with_filenames = false}, false);

std::vector<std::string> source_names{pkg_spec};
for (const auto & pkg : pkg_query) {
source_names.emplace_back(pkg.get_source_name());
}

libdnf::rpm::PackageQuery source_pkgs(ctx.base);
libdnf5::rpm::PackageQuery source_pkgs(ctx.base);
source_pkgs.filter_arch({"src"});
source_pkgs.filter_name(source_names);
if (source_pkgs.empty()) {
Expand Down Expand Up @@ -244,15 +244,15 @@ void BuildDepCommand::run() {

if (!parse_ok) {
// failed to parse some of inputs (invalid spec, no package matched...)
throw libdnf::cli::Error(M_("Failed to parse some inputs."));
throw libdnf5::cli::Error(M_("Failed to parse some inputs."));
}

// fill the goal with build dependencies
auto goal = get_context().get_goal();
goal->set_allow_erasing(allow_erasing->get_value());

for (const auto & spec : install_specs) {
if (libdnf::rpm::Reldep::is_rich_dependency(spec)) {
if (libdnf5::rpm::Reldep::is_rich_dependency(spec)) {
goal->add_provide_install(spec);
} else {
goal->add_rpm_install(spec);
Expand All @@ -264,10 +264,10 @@ void BuildDepCommand::run() {
// exclude available (not installed) conflicting packages
auto system_repo = ctx.base.get_repo_sack()->get_system_repo();
auto rpm_package_sack = ctx.base.get_rpm_package_sack();
libdnf::rpm::PackageQuery conflicts_query_available(ctx.base);
libdnf5::rpm::PackageQuery conflicts_query_available(ctx.base);
conflicts_query_available.filter_name({conflicts_specs.begin(), conflicts_specs.end()});
libdnf::rpm::PackageQuery conflicts_query_installed(conflicts_query_available);
conflicts_query_available.filter_repo_id({system_repo->get_id()}, libdnf::sack::QueryCmp::NEQ);
libdnf5::rpm::PackageQuery conflicts_query_installed(conflicts_query_available);
conflicts_query_available.filter_repo_id({system_repo->get_id()}, libdnf5::sack::QueryCmp::NEQ);
rpm_package_sack->add_user_excludes(conflicts_query_available);

// remove already installed conflicting packages
Expand All @@ -280,9 +280,9 @@ void BuildDepCommand::goal_resolved() {
auto & ctx = get_context();
auto & transaction = *ctx.get_transaction();
auto transaction_problems = transaction.get_problems();
if (transaction_problems != libdnf::GoalProblem::NO_PROBLEM) {
if (transaction_problems != libdnf5::GoalProblem::NO_PROBLEM) {
auto skip_unavailable = ctx.base.get_config().get_skip_unavailable_option().get_value();
if (transaction_problems != libdnf::GoalProblem::NOT_FOUND || !skip_unavailable) {
if (transaction_problems != libdnf5::GoalProblem::NOT_FOUND || !skip_unavailable) {
throw GoalResolveError(transaction);
}
}
Expand Down
32 changes: 16 additions & 16 deletions dnf5-plugins/changelog_plugin/changelog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ along with libdnf. If not, see <https://www.gnu.org/licenses/>.

namespace dnf5 {

using namespace libdnf::cli;
using namespace libdnf5::cli;

void ChangelogCommand::set_parent_command() {
auto * arg_parser_parent_cmd = get_session().get_argument_parser().get_root_command();
Expand All @@ -47,9 +47,9 @@ void ChangelogCommand::set_argument_parser() {
auto & cmd = *get_argument_parser_command();
cmd.set_description("Show package changelogs");

since_option = dynamic_cast<libdnf::OptionNumber<std::int64_t> *>(
parser.add_init_value(std::unique_ptr<libdnf::OptionNumber<std::int64_t>>(
new libdnf::OptionNumber<int64_t>(0, [](const std::string & value) {
since_option = dynamic_cast<libdnf5::OptionNumber<std::int64_t> *>(
parser.add_init_value(std::unique_ptr<libdnf5::OptionNumber<std::int64_t>>(
new libdnf5::OptionNumber<int64_t>(0, [](const std::string & value) {
struct tm time_m;
std::istringstream ss(value);
ss >> std::get_time(&time_m, "%Y-%m-%d");
Expand All @@ -59,11 +59,11 @@ void ChangelogCommand::set_argument_parser() {
return static_cast<int64_t>(mktime(&time_m));
}))));

count_option = dynamic_cast<libdnf::OptionNumber<std::int32_t> *>(
parser.add_init_value(std::unique_ptr<libdnf::OptionNumber<std::int32_t>>(new libdnf::OptionNumber<int>(0))));
count_option = dynamic_cast<libdnf5::OptionNumber<std::int32_t> *>(
parser.add_init_value(std::unique_ptr<libdnf5::OptionNumber<std::int32_t>>(new libdnf5::OptionNumber<int>(0))));

upgrades_option = dynamic_cast<libdnf::OptionBool *>(
parser.add_init_value(std::unique_ptr<libdnf::OptionBool>(new libdnf::OptionBool(false))));
upgrades_option = dynamic_cast<libdnf5::OptionBool *>(
parser.add_init_value(std::unique_ptr<libdnf5::OptionBool>(new libdnf5::OptionBool(false))));

auto since = parser.add_new_named_arg("since");
since->set_long_name("since");
Expand All @@ -88,7 +88,7 @@ void ChangelogCommand::set_argument_parser() {
auto keys = parser.add_new_positional_arg(
"pkg_spec",
ArgumentParser::PositionalArg::UNLIMITED,
parser.add_init_value(std::unique_ptr<libdnf::Option>(new libdnf::OptionString(nullptr))),
parser.add_init_value(std::unique_ptr<libdnf5::Option>(new libdnf5::OptionString(nullptr))),
pkgs_spec_to_show_options);
keys->set_description("List of packages specifiers");
keys->set_complete_hook_func([&ctx](const char * arg) { return match_specs(ctx, arg, false, true, false, false); });
Expand All @@ -108,7 +108,7 @@ void ChangelogCommand::configure() {
context.set_load_system_repo(true);
context.set_load_available_repos(Context::LoadAvailableRepos::ENABLED);
context.base.get_config().get_optional_metadata_types_option().add(
libdnf::Option::Priority::RUNTIME, libdnf::OPTIONAL_METADATA_TYPES);
libdnf5::Option::Priority::RUNTIME, libdnf5::OPTIONAL_METADATA_TYPES);
}

void ChangelogCommand::run() {
Expand All @@ -130,14 +130,14 @@ void ChangelogCommand::run() {
}

//query
libdnf::rpm::PackageQuery query(ctx.base, libdnf::sack::ExcludeFlags::APPLY_EXCLUDES, true);
libdnf::rpm::PackageQuery full_package_query(ctx.base, libdnf::sack::ExcludeFlags::APPLY_EXCLUDES, false);
libdnf::ResolveSpecSettings settings{
libdnf5::rpm::PackageQuery query(ctx.base, libdnf5::sack::ExcludeFlags::APPLY_EXCLUDES, true);
libdnf5::rpm::PackageQuery full_package_query(ctx.base, libdnf5::sack::ExcludeFlags::APPLY_EXCLUDES, false);
libdnf5::ResolveSpecSettings settings{
.ignore_case = true, .with_nevra = true, .with_provides = false, .with_filenames = false};
if (pkgs_spec_to_show_options->size() > 0) {
for (auto & pattern : *pkgs_spec_to_show_options) {
libdnf::rpm::PackageQuery package_query(full_package_query);
auto option = dynamic_cast<libdnf::OptionString *>(pattern.get());
libdnf5::rpm::PackageQuery package_query(full_package_query);
auto option = dynamic_cast<libdnf5::OptionString *>(pattern.get());
package_query.resolve_pkg_spec(option->get_value(), settings, true);
package_query.filter_latest_evr();
query |= package_query;
Expand All @@ -151,7 +151,7 @@ void ChangelogCommand::run() {
query.filter_available();
}

libdnf::cli::output::print_changelogs(query, full_package_query, upgrades, count, since);
libdnf5::cli::output::print_changelogs(query, full_package_query, upgrades, count, since);
}

} // namespace dnf5
8 changes: 4 additions & 4 deletions dnf5-plugins/changelog_plugin/changelog.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -38,10 +38,10 @@ class ChangelogCommand : public Command {
void run() override;

private:
libdnf::OptionNumber<std::int32_t> * count_option{nullptr};
libdnf::OptionNumber<std::int64_t> * since_option{nullptr};
libdnf::OptionBool * upgrades_option{nullptr};
std::vector<std::unique_ptr<libdnf::Option>> * pkgs_spec_to_show_options{nullptr};
libdnf5::OptionNumber<std::int32_t> * count_option{nullptr};
libdnf5::OptionNumber<std::int64_t> * since_option{nullptr};
libdnf5::OptionBool * upgrades_option{nullptr};
std::vector<std::unique_ptr<libdnf5::Option>> * pkgs_spec_to_show_options{nullptr};
};

} // namespace dnf5
Expand Down
4 changes: 2 additions & 2 deletions dnf5-plugins/copr_plugin/copr.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ along with libdnf. If not, see <https://www.gnu.org/licenses/>.

namespace dnf5 {

using namespace libdnf::cli;
using namespace libdnf5::cli;

CoprCommand * CoprSubCommand::copr_cmd() {
return static_cast<CoprCommand *>(this->get_parent_command());
Expand Down Expand Up @@ -84,7 +84,7 @@ void CoprSubCommandWithID::set_argument_parser() {
auto & cmd = *get_argument_parser_command();
auto & parser = ctx.get_argument_parser();
auto project = parser.add_new_positional_arg("PROJECT_SPEC", 1, nullptr, nullptr);
project->set_description(libdnf::utils::sformat(
project->set_description(libdnf5::utils::sformat(
_("Copr project ID to {}. Use either a format OWNER/PROJECT "
"or HUB/OWNER/PROJECT (if HUB is not specified, the default one, "
"or --hub <ARG>, is used. OWNER is either a username, or "
Expand Down
4 changes: 2 additions & 2 deletions dnf5-plugins/copr_plugin/copr.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ along with libdnf. If not, see <https://www.gnu.org/licenses/>.

namespace dnf5 {

using bool_opt_t = std::unique_ptr<libdnf::cli::session::BoolOption>;
using bool_opt_t = std::unique_ptr<libdnf5::cli::session::BoolOption>;
using str_map_t = std::map<std::string, std::string>;

class CoprCommand;
Expand Down Expand Up @@ -132,7 +132,7 @@ class CoprCommand : public Command {
const std::string & hub() { return this->hub_option.get_value(); }

private:
libdnf::OptionString hub_option{""};
libdnf5::OptionString hub_option{""};
};


Expand Down
6 changes: 3 additions & 3 deletions dnf5-plugins/copr_plugin/copr_config.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,16 +28,16 @@ along with libdnf. If not, see <https://www.gnu.org/licenses/>.

namespace dnf5 {

class CoprConfig : public libdnf::ConfigParser {
class CoprConfig : public libdnf5::ConfigParser {
private:
libdnf::Base & base;
libdnf5::Base & base;
OSRelease os_release;

void load_copr_config_file(const std::string & filename);
void load_all_configuration();

public:
explicit CoprConfig(libdnf::Base & base);
explicit CoprConfig(libdnf5::Base & base);
std::string get_hub_hostname(const std::string & hubspec);
std::string get_hub_url(const std::string & hubspec);
std::string get_repo_url(
Expand Down
4 changes: 2 additions & 2 deletions dnf5-plugins/copr_plugin/copr_disable.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,15 +22,15 @@ along with libdnf. If not, see <https://www.gnu.org/licenses/>.

#include <libdnf/conf/const.hpp>

using namespace libdnf::cli;
using namespace libdnf5::cli;

namespace dnf5 {


void CoprDisableCommand::set_argument_parser() {
CoprSubCommandWithID::set_argument_parser();
auto & cmd = *get_argument_parser_command();
std::string desc = libdnf::utils::sformat(
std::string desc = libdnf5::utils::sformat(
_("disable specified Copr repository (if exists), keep {}/*.repo file - just mark enabled=0"),
copr_repo_directory().native());
cmd.set_description(desc);
Expand Down
4 changes: 2 additions & 2 deletions dnf5-plugins/copr_plugin/copr_enable.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ along with libdnf. If not, see <https://www.gnu.org/licenses/>.

#include <libdnf/conf/const.hpp>

using namespace libdnf::cli;
using namespace libdnf5::cli;

namespace dnf5 {

Expand All @@ -33,7 +33,7 @@ void CoprEnableCommand::set_argument_parser() {
auto & cmd = *get_argument_parser_command();
auto & parser = ctx.get_argument_parser();

std::string desc = libdnf::utils::sformat(
std::string desc = libdnf5::utils::sformat(
_("download the repository info from a Copr server and install it as a {}/*.repo file"),
copr_repo_directory().native());

Expand Down
4 changes: 2 additions & 2 deletions dnf5-plugins/copr_plugin/copr_remove.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,15 +22,15 @@ along with libdnf. If not, see <https://www.gnu.org/licenses/>.

#include <libdnf/conf/const.hpp>

using namespace libdnf::cli;
using namespace libdnf5::cli;

namespace dnf5 {


void CoprRemoveCommand::set_argument_parser() {
CoprSubCommandWithID::set_argument_parser();
auto & cmd = *get_argument_parser_command();
std::string desc = libdnf::utils::sformat(
std::string desc = libdnf5::utils::sformat(
_("remove specified Copr repository from the system (removes the {}/*.repo file)"),
copr_repo_directory().native());
cmd.set_description(desc);
Expand Down
Loading

0 comments on commit 04c073f

Please sign in to comment.