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/fix documentation for rpm::PackageQuery methods #1475

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
30 changes: 28 additions & 2 deletions include/libdnf5/rpm/package_query.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -360,7 +360,7 @@ class PackageQuery : public PackageSet {
void filter_summary(
const std::vector<std::string> & patterns, libdnf5::sack::QueryCmp cmp_type = libdnf5::sack::QueryCmp::EQ);

/// Filter packages by their `summary`.
/// Filter packages by their `description`.
///
/// @param pattern A string the filter is matched against.
/// @param cmp_type A comparison (match) operator, defaults to `QueryCmp::EQ`.
Expand All @@ -373,7 +373,7 @@ class PackageQuery : public PackageSet {
filter_description(std::vector<std::string>{pattern}, cmp_type);
};

/// Filter packages by their `summary`.
/// Filter packages by their `description`.
///
/// @param patterns A vector of strings the filter is matched against.
/// @param cmp_type A comparison (match) operator, defaults to `QueryCmp::EQ`.
Expand Down Expand Up @@ -847,19 +847,45 @@ class PackageQuery : public PackageSet {
PackageQuery & installed,
libdnf5::sack::QueryCmp cmp_type = libdnf5::sack::QueryCmp::GTE);

/// Filter installed packages.
///
/// Removes from the query all packages that are not installed.
/// @since 5.0
// @replaces libdnf/sack/query.hpp:method:installed()
void filter_installed();

/// Filter available packages.
///
/// Removes from the query all packages that are installed.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice, I like the way how you dealt with definition of what "available package" actually means.

/// @since 5.0
// @replaces libdnf/sack/query.hpp:method:available()
void filter_available();

/// Filter available packages that are upgrades to installed packages.
///
/// Removes from the query all packages that are not upgrades to installed packages.
/// @since 5.0
// @replaces libdnf/sack/query.hpp:method:addFilter(int keyname, int cmp_type, int match) - cmp_type = HY_PKG_UPGRADES
void filter_upgrades();

/// Filter available packages that are downgrades to installed packages.
///
/// Removes from the query all packages that are not downgrades to installed packages.
/// @since 5.0
// @replaces libdnf/sack/query.hpp:method:addFilter(int keyname, int cmp_type, int match) - cmp_type = HY_PKG_DOWNGRADES
void filter_downgrades();

/// Filter installed packages for which there are available upgrades.
///
/// Only installed packages remain in the query, and only those for which upgrades are available.
/// @since 5.0
// @replaces libdnf/sack/query.hpp:method:addFilter(int keyname, int cmp_type, int match) - cmp_type = HY_PKG_UPGRADABLE
void filter_upgradable();

/// Filter installed packages for which there are available downgrades.
///
/// Only installed packages remain in the query, and only those for which downgrades are available.
/// @since 5.0
// @replaces libdnf/sack/query.hpp:method:addFilter(int keyname, int cmp_type, int match) - cmp_type = HY_PKG_DOWNGRADABLE
void filter_downgradable();

Expand Down
2 changes: 1 addition & 1 deletion libdnf5/rpm/package_query.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ Id what_upgrades(libdnf5::solv::RpmPool & spool, const Solvable * solvable) {
return l;
}

/// Return id of a package that can be upgraded with pkg.
/// Return id of a package that can be downgraded with pkg.
///
/// The returned package Id fulfills the following criteria:
/// :: it is installed
Expand Down
Loading