Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add pImpl to ResolveSpecSettings and GoalJobSettings #1176

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 7 additions & 6 deletions dnf5-plugins/builddep_plugin/builddep.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -188,10 +188,11 @@ bool BuildDepCommand::add_from_pkg(
auto & ctx = get_context();

libdnf5::rpm::PackageQuery pkg_query(ctx.base);
pkg_query.resolve_pkg_spec(
pkg_spec,
libdnf5::ResolveSpecSettings{.with_provides = false, .with_filenames = false, .with_binaries = false},
false);
libdnf5::ResolveSpecSettings settings;
settings.set_with_provides(false);
settings.set_with_filenames(false);
settings.set_with_binaries(false);
pkg_query.resolve_pkg_spec(pkg_spec, settings, false);

std::vector<std::string> source_names{pkg_spec};
for (const auto & pkg : pkg_query) {
Expand Down Expand Up @@ -273,8 +274,8 @@ void BuildDepCommand::run() {
// 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;
settings.with_binaries = false;
settings.set_with_nevra(false);
settings.set_with_binaries(false);

for (const auto & spec : install_specs) {
if (libdnf5::rpm::Reldep::is_rich_dependency(spec)) {
Expand Down
12 changes: 6 additions & 6 deletions dnf5-plugins/changelog_plugin/changelog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -141,12 +141,12 @@ void ChangelogCommand::run() {

//query
libdnf5::rpm::PackageQuery query(ctx.base, libdnf5::sack::ExcludeFlags::APPLY_EXCLUDES, true);
libdnf5::ResolveSpecSettings settings{
.ignore_case = true,
.with_nevra = true,
.with_provides = false,
.with_filenames = false,
.with_binaries = false};
libdnf5::ResolveSpecSettings settings;
settings.set_ignore_case(true);
settings.set_with_nevra(true);
settings.set_with_provides(false);
settings.set_with_filenames(false);
settings.set_with_binaries(false);
if (pkgs_spec_to_show_options->size() > 0) {
for (auto & pattern : *pkgs_spec_to_show_options) {
libdnf5::rpm::PackageQuery package_query(full_package_query);
Expand Down
7 changes: 5 additions & 2 deletions dnf5-plugins/repoclosure_plugin/repoclosure.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -139,8 +139,11 @@ void RepoclosureCommand::run() {

if (!pkg_specs.empty()) {
libdnf5::rpm::PackageQuery to_check_pkgs(ctx.base, libdnf5::sack::ExcludeFlags::APPLY_EXCLUDES, true);
libdnf5::ResolveSpecSettings settings{
.with_nevra = true, .with_provides = false, .with_filenames = false, .with_binaries = false};
libdnf5::ResolveSpecSettings settings;
settings.set_with_nevra(true);
settings.set_with_provides(false);
settings.set_with_filenames(false);
settings.set_with_binaries(false);
bool specs_resolved = true;
for (const auto & spec : pkg_specs) {
libdnf5::rpm::PackageQuery package_query(to_check_query);
Expand Down
7 changes: 5 additions & 2 deletions dnf5/commands/check-upgrade/check-upgrade.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -113,8 +113,11 @@ void CheckUpgradeCommand::run() {
// filter by provided specs, for `check-upgrade <pkg1> <pkg2> ...`
if (!pkg_specs.empty()) {
upgrades_query = libdnf5::rpm::PackageQuery(ctx.base, libdnf5::sack::ExcludeFlags::APPLY_EXCLUDES, true);
libdnf5::ResolveSpecSettings settings{
.with_nevra = true, .with_provides = false, .with_filenames = false, .with_binaries = false};
libdnf5::ResolveSpecSettings settings;
settings.set_with_nevra(true);
settings.set_with_provides(false);
settings.set_with_filenames(false);
kontura marked this conversation as resolved.
Show resolved Hide resolved
settings.set_with_binaries(false);
for (const auto & spec : pkg_specs) {
libdnf5::rpm::PackageQuery package_query(ctx.base);
package_query.resolve_pkg_spec(spec, settings, true);
Expand Down
2 changes: 1 addition & 1 deletion dnf5/commands/group/group_install.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ void GroupInstallCommand::run() {

libdnf5::GoalJobSettings settings;
if (no_packages->get_value()) {
settings.group_no_packages = true;
settings.set_group_no_packages(true);
}
if (with_optional->get_value()) {
auto group_package_types = libdnf5::comps::package_type_from_string(
Expand Down
2 changes: 1 addition & 1 deletion dnf5/commands/group/group_remove.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ void GroupRemoveCommand::run() {

libdnf5::GoalJobSettings settings;
if (no_packages->get_value()) {
settings.group_no_packages = true;
settings.set_group_no_packages(true);
}
for (const auto & spec : group_specs->get_value()) {
goal->add_group_remove(spec, libdnf5::transaction::TransactionItemReason::USER, settings);
Expand Down
7 changes: 5 additions & 2 deletions dnf5/commands/list/list.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -151,8 +151,11 @@ void ListCommand::run() {
// pre-select by patterns
if (!pkg_specs.empty()) {
base_query = libdnf5::rpm::PackageQuery(ctx.base, libdnf5::sack::ExcludeFlags::APPLY_EXCLUDES, true);
libdnf5::ResolveSpecSettings settings{
.with_nevra = true, .with_provides = false, .with_filenames = false, .with_binaries = false};
libdnf5::ResolveSpecSettings settings;
settings.set_with_nevra(true);
settings.set_with_provides(false);
settings.set_with_filenames(false);
settings.set_with_binaries(false);
for (const auto & spec : pkg_specs) {
libdnf5::rpm::PackageQuery pkg_query(full_package_query);
pkg_query.resolve_pkg_spec(spec, settings, true);
Expand Down
8 changes: 4 additions & 4 deletions dnf5/commands/remove/remove.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -69,10 +69,10 @@ void RemoveCommand::run() {
// Limit remove spec capabity to prevent multiple matches. Remove command should not match anything after performing
// a remove action with the same spec. NEVRA and filenames are the only types that have no overlaps.
libdnf5::GoalJobSettings settings;
settings.with_nevra = true;
settings.with_provides = false;
settings.with_filenames = true;
settings.with_binaries = false;
settings.set_with_nevra(true);
settings.set_with_provides(false);
settings.set_with_filenames(true);
settings.set_with_binaries(false);
for (const auto & spec : pkg_specs) {
goal->add_remove(spec, settings);
}
Expand Down
12 changes: 7 additions & 5 deletions dnf5/commands/repoquery/repoquery.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -534,9 +534,9 @@ static libdnf5::rpm::PackageSet resolve_nevras_to_packges(
libdnf5::Base & base, const std::vector<std::string> & nevra_globs, const libdnf5::rpm::PackageQuery & base_query) {
auto resolved_nevras_set = libdnf5::rpm::PackageSet(base);
auto settings = libdnf5::ResolveSpecSettings();
settings.with_provides = false;
settings.with_filenames = false;
settings.with_binaries = false;
settings.set_with_provides(false);
settings.set_with_filenames(false);
settings.set_with_binaries(false);
for (const auto & nevra : nevra_globs) {
auto tmp_query = base_query;
tmp_query.resolve_pkg_spec(nevra, settings, true);
Expand Down Expand Up @@ -566,8 +566,10 @@ void RepoqueryCommand::run() {
}
}

const libdnf5::ResolveSpecSettings settings{
.ignore_case = true, .with_provides = false, .with_binaries = false};
libdnf5::ResolveSpecSettings settings;
settings.set_ignore_case(true);
settings.set_with_provides(false);
settings.set_with_binaries(false);
for (const auto & spec : pkg_specs) {
libdnf5::rpm::PackageQuery package_query(base_query);
package_query.resolve_pkg_spec(spec, settings, true);
Expand Down
10 changes: 6 additions & 4 deletions dnf5/context.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -601,10 +601,12 @@ std::vector<std::string> match_specs(
std::set<std::string> result_set;
{
libdnf5::rpm::PackageQuery matched_pkgs_query(base);
matched_pkgs_query.resolve_pkg_spec(
pattern + '*',
{.ignore_case = false, .with_provides = false, .with_filenames = false, .with_binaries = false},
true);
libdnf5::ResolveSpecSettings settings;
settings.set_ignore_case(false);
settings.set_with_provides(false);
settings.set_with_filenames(false);
kontura marked this conversation as resolved.
Show resolved Hide resolved
settings.set_with_binaries(false);
matched_pkgs_query.resolve_pkg_spec(pattern + '*', settings, true);

for (const auto & package : matched_pkgs_query) {
auto [it, inserted] = result_set.insert(package.get_name());
Expand Down
2 changes: 1 addition & 1 deletion dnf5daemon-server/services/goal/goal.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ sdbus::MethodReply Goal::get_transaction_problems(sdbus::MethodCall & call) {
goal_resolve_log_item["problem"] = static_cast<uint32_t>(log.get_problem());
if (log.get_job_settings()) {
dnfdaemon::KeyValueMap goal_job_settings;
goal_job_settings["to_repo_ids"] = log.get_job_settings()->to_repo_ids;
goal_job_settings["to_repo_ids"] = log.get_job_settings()->get_to_repo_ids();
goal_resolve_log_item["goal_job_settings"] = goal_job_settings;
}
if (log.get_spec()) {
Expand Down
37 changes: 20 additions & 17 deletions dnf5daemon-server/services/rpm/rpm.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,10 @@ std::vector<std::string> get_filter_patterns(dnfdaemon::KeyValueMap options, con

libdnf5::rpm::PackageQuery resolve_nevras(libdnf5::rpm::PackageQuery base_query, std::vector<std::string> nevras) {
libdnf5::rpm::PackageQuery result(base_query.get_base(), libdnf5::sack::ExcludeFlags::APPLY_EXCLUDES, true);
libdnf5::ResolveSpecSettings settings{.with_provides = false, .with_filenames = false, .with_binaries = false};
libdnf5::ResolveSpecSettings settings;
settings.set_with_provides(false);
settings.set_with_filenames(false);
settings.set_with_binaries(false);
for (const auto & nevra : nevras) {
libdnf5::rpm::PackageQuery nevra_query(base_query);
nevra_query.resolve_pkg_spec(nevra, settings, false);
Expand Down Expand Up @@ -120,12 +123,12 @@ sdbus::MethodReply Rpm::list(sdbus::MethodCall & call) {
libdnf5::rpm::PackageQuery result(*base, libdnf5::sack::ExcludeFlags::APPLY_EXCLUDES, true);
// packages matching flags
bool with_src = key_value_map_get<bool>(options, "with_src", true);
libdnf5::ResolveSpecSettings settings{
.ignore_case = key_value_map_get<bool>(options, "icase", true),
.with_nevra = key_value_map_get<bool>(options, "with_nevra", true),
.with_provides = key_value_map_get<bool>(options, "with_provides", true),
.with_filenames = key_value_map_get<bool>(options, "with_filenames", true),
.with_binaries = key_value_map_get<bool>(options, "with_binaries", true)};
libdnf5::ResolveSpecSettings settings;
settings.set_ignore_case(key_value_map_get<bool>(options, "icase", true));
settings.set_with_nevra(key_value_map_get<bool>(options, "with_nevra", true));
settings.set_with_provides(key_value_map_get<bool>(options, "with_provides", true));
settings.set_with_filenames(key_value_map_get<bool>(options, "with_filenames", true));
settings.set_with_binaries(key_value_map_get<bool>(options, "with_binaries", true));
for (auto & pattern : patterns) {
libdnf5::rpm::PackageQuery package_query(query);
package_query.resolve_pkg_spec(pattern, settings, with_src);
Expand Down Expand Up @@ -308,7 +311,7 @@ sdbus::MethodReply Rpm::downgrade(sdbus::MethodCall & call) {
// fill the goal
auto & goal = session.get_goal();
libdnf5::GoalJobSettings setting;
setting.to_repo_ids = repo_ids;
setting.set_to_repo_ids(repo_ids);
for (const auto & spec : specs) {
goal.add_downgrade(spec, setting);
}
Expand Down Expand Up @@ -344,9 +347,9 @@ sdbus::MethodReply Rpm::install(sdbus::MethodCall & call) {
// fill the goal
auto & goal = session.get_goal();
libdnf5::GoalJobSettings setting;
setting.skip_broken = skip_broken;
setting.skip_unavailable = skip_unavailable;
setting.to_repo_ids = repo_ids;
setting.set_skip_broken(skip_broken);
setting.set_skip_unavailable(skip_unavailable);
setting.set_to_repo_ids(repo_ids);

for (const auto & spec : specs) {
goal.add_install(spec, setting);
Expand All @@ -368,7 +371,7 @@ sdbus::MethodReply Rpm::upgrade(sdbus::MethodCall & call) {
// fill the goal
auto & goal = session.get_goal();
libdnf5::GoalJobSettings setting;
setting.to_repo_ids = repo_ids;
setting.set_to_repo_ids(repo_ids);
if (specs.empty()) {
goal.add_rpm_upgrade(setting);
} else {
Expand All @@ -393,7 +396,7 @@ sdbus::MethodReply Rpm::reinstall(sdbus::MethodCall & call) {
// fill the goal
auto & goal = session.get_goal();
libdnf5::GoalJobSettings setting;
setting.to_repo_ids = repo_ids;
setting.set_to_repo_ids(repo_ids);
for (const auto & spec : specs) {
goal.add_reinstall(spec, setting);
}
Expand All @@ -416,10 +419,10 @@ sdbus::MethodReply Rpm::remove(sdbus::MethodCall & call) {
// Limit remove spec capabity to prevent multiple matches. Remove command should not match anything after performing
// a remove action with the same spec. NEVRA and filenames are the only types that have no overlaps.
libdnf5::GoalJobSettings setting;
setting.with_nevra = true;
setting.with_provides = false;
setting.with_filenames = true;
setting.with_binaries = false;
setting.set_with_nevra(true);
setting.set_with_provides(false);
setting.set_with_filenames(true);
setting.set_with_binaries(false);
for (const auto & spec : specs) {
goal.add_remove(spec, setting);
}
Expand Down
Loading
Loading