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 reports when corresponding debug package is not available #1572

Merged
merged 1 commit into from
Jul 2, 2024
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
4 changes: 3 additions & 1 deletion include/libdnf5/base/goal_elements.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,9 @@ enum class GoalProblem : uint32_t {
/// Error when transaction contains additional unexpected elements.
/// Used when replaying transactions.
EXTRA = (1 << 22),
MALFORMED = (1 << 23)
MALFORMED = (1 << 23),
NOT_FOUND_DEBUGINFO = (1 << 24),
NOT_FOUND_DEBUGSOURCE = (1 << 25)
};

/// Types of Goal actions
Expand Down
39 changes: 35 additions & 4 deletions libdnf5/base/goal.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1613,6 +1613,9 @@ std::pair<GoalProblem, libdnf5::solv::IdQueue> Goal::Impl::add_install_debug_to_
}
++iter;
}

std::set<std::string> no_debuginfo_for_packages;
std::set<std::string> no_debugsource_for_packages;
for (auto & item : candidate_map) {
auto & first_pkg = *item.second.begin();
auto debug_name = first_pkg.get_debuginfo_name();
Expand Down Expand Up @@ -1644,7 +1647,9 @@ std::pair<GoalProblem, libdnf5::solv::IdQueue> Goal::Impl::add_install_debug_to_
skip_broken,
best,
clean_requirements_on_remove)) {
// TODO(jmracek) report when proper debug RPM is not found
for (auto & package : arch_item.second) {
no_debuginfo_for_packages.emplace(package.get_full_nevra());
}
}
}
if (!install_debug_from_packages(
Expand All @@ -1656,7 +1661,9 @@ std::pair<GoalProblem, libdnf5::solv::IdQueue> Goal::Impl::add_install_debug_to_
skip_broken,
best,
clean_requirements_on_remove)) {
// TODO(jmracek) report when proper debug RPM is not found
for (auto & package : arch_item.second) {
no_debugsource_for_packages.emplace(package.get_full_nevra());
}
}
}
continue;
Expand All @@ -1680,7 +1687,9 @@ std::pair<GoalProblem, libdnf5::solv::IdQueue> Goal::Impl::add_install_debug_to_
skip_broken,
best,
clean_requirements_on_remove)) {
// TODO(jmracek) report when proper debug RPM is not found
for (auto & package : item.second) {
no_debuginfo_for_packages.emplace(package.get_full_nevra());
}
}
}
if (!install_debug_from_packages(
Expand All @@ -1692,9 +1701,31 @@ std::pair<GoalProblem, libdnf5::solv::IdQueue> Goal::Impl::add_install_debug_to_
skip_broken,
best,
clean_requirements_on_remove)) {
// TODO(jmracek) report when proper debug RPM is not found
for (auto & package : item.second) {
no_debugsource_for_packages.emplace(package.get_full_nevra());
}
}
}
if (!no_debuginfo_for_packages.empty()) {
transaction.p_impl->add_resolve_log(
GoalAction::INSTALL_DEBUG,
GoalProblem::NOT_FOUND_DEBUGINFO,
settings,
libdnf5::transaction::TransactionItemType::PACKAGE,
spec,
no_debuginfo_for_packages,
libdnf5::Logger::Level::WARNING);
}
if (!no_debugsource_for_packages.empty()) {
transaction.p_impl->add_resolve_log(
GoalAction::INSTALL_DEBUG,
GoalProblem::NOT_FOUND_DEBUGSOURCE,
settings,
libdnf5::transaction::TransactionItemType::PACKAGE,
spec,
no_debugsource_for_packages,
libdnf5::Logger::Level::WARNING);
}
return {GoalProblem::NO_PROBLEM, result_queue};
}

Expand Down
21 changes: 21 additions & 0 deletions libdnf5/base/log_event.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -340,6 +340,27 @@ std::string LogEvent::to_string(
case GoalProblem::MALFORMED: {
return ret.append(utils::sformat(_("Cannot parse file: '{0}': {1}.\n"), *spec, *additional_data.begin()));
}
case GoalProblem::NOT_FOUND_DEBUGINFO: {
if (additional_data.empty()) {
throw std::invalid_argument("Missing description of missing debuginfo packages");
}
return ret.append(utils::sformat(
_("Could not find debuginfo package for the following packages resolved from the argument '{0}': {1}"),
*spec,
utils::string::join(
additional_data, C_("String for joining NEVRAs - e.g. `foo-4-4.noarch, bar-5-5.noarch`", ", "))));
}
case GoalProblem::NOT_FOUND_DEBUGSOURCE: {
if (additional_data.empty()) {
throw std::invalid_argument("Missing description of missing debugsource packages");
}
return ret.append(utils::sformat(
_("Could not find debugsource package for the following packages resolved from the argument '{0}': "
"{1}"),
*spec,
utils::string::join(
additional_data, C_("String for joining NEVRAs - e.g. `foo-4-4.noarch, bar-5-5.noarch`", ", "))));
}
}
return ret;
}
Expand Down
Loading