-
Notifications
You must be signed in to change notification settings - Fork 103
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
PackageQuery: Add filter_extras
#264
Conversation
Filter installed "extra" packages - packages which are installed, but not available in any repository.
LGTM, but there is one request for a different implementation of extras filter. Bug 1800910 - dnf list extras stopped to shows some packages that should. |
Hm, yeah. The implementation in the patch uses the same approach as current dnf4 - extras are detected using |
I've added a commit which extends |
include/libdnf/rpm/package_query.hpp
Outdated
void filter_extras(); | ||
/// Filter packages, which are installed but not available in any enabled repository. | ||
/// @param with_versions If false (default) extras calculation is based only on `name.arch`. That means package is not in extras if any version of the package exists in the repository. If true, filter_extras is more strict and returns each package which exact NEVRA is not present in any repository. | ||
void filter_extras(const bool with_versions=false); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice, technically it is not a version but EVR.
Just a suggestion. What about to name the variable as exact_evr
or exact_EVR
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Naming, the hardest part of the coding...
I agree, your suggested name for parameter is clearer.
674835b
to
be2428b
Compare
include/libdnf/rpm/package_query.hpp
Outdated
@@ -587,6 +587,10 @@ class PackageQuery : public PackageSet { | |||
// TODO(dmach): consider removing the installed packages during the filtering | |||
void filter_priority(); | |||
|
|||
/// Filter packages, which are installed but not available in any enabled repository. | |||
/// @param with_versions If false (default) extras calculation is based only on `name.arch`. That means package is not in extras if any version of the package exists in any of the enabled repositories. If true, filter_extras is more strict and returns each package which exact NEVRA is not present in any enabled repository. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What about to replace and returns each package which exact NEVRA is not present in any repository.
by and keeps in query installed packages which exact NEVRA is not present in any repository.
include/libdnf/rpm/package_query.hpp
Outdated
@@ -587,6 +587,10 @@ class PackageQuery : public PackageSet { | |||
// TODO(dmach): consider removing the installed packages during the filtering | |||
void filter_priority(); | |||
|
|||
/// Filter packages, which are installed but not available in any enabled repository. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What about to replace Filter packages
by Keep packages
?
May I also ask you to describe the behavior with regular excluded packages?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure. Done.
99aa6bb
to
c543674
Compare
include/libdnf/rpm/package_query.hpp
Outdated
@@ -587,6 +587,16 @@ class PackageQuery : public PackageSet { | |||
// TODO(dmach): consider removing the installed packages during the filtering | |||
void filter_priority(); | |||
|
|||
/// Keep in query only packages that are installed but not available in any enabled | |||
/// repository. Also installed packages that are only part of non-active modules | |||
/// are considered extras. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice improvement, What about to considered extras
change to considered as extras
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done. Sorry for all those mistakes in my English.
filter_nevra(available, sack::QueryCmp::NEQ); | ||
} else { | ||
filter_name_arch(available, sack::QueryCmp::NEQ); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am really exited how easily you were able to implemented the filter.
e111912
to
c74e733
Compare
include/libdnf/rpm/package_query.hpp
Outdated
@@ -587,6 +587,16 @@ class PackageQuery : public PackageSet { | |||
// TODO(dmach): consider removing the installed packages during the filtering | |||
void filter_priority(); | |||
|
|||
/// Keep in query only packages that are installed but not available in any enabled |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
May I ask you to add a note that filter ignores regular excludes?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
oops. Sorry, I missed this comment. Should be fixed now.
By default the `filter_extras()` detects extra packages only by name and arch. That means package is not considered as extra if any version of the package exists in any of enabled repositories. With new `exact_evr` parameter the filter is more strict and extra is any package which is installed and which NEVRA does not exist in any of enabled repositories.
c74e733
to
e2fd563
Compare
LGTM, feel free to merge it when tests pass. |
Filter installed "extra" packages - packages which are installed, but not available in any repository.