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
Repoquery: Add --duplicates option #178
Repoquery: Add --duplicates option #178
Conversation
23d35e7
to
6657370
Compare
libdnf/rpm/package_query.cpp
Outdated
for (int pos_second = start_block; pos_second < stop_block; ++pos_second) { | ||
Id id_second = samename[pos_second]; | ||
s_second = pool.id2solvable(id_second); | ||
if ((s_first->evr == s_second->evr) && (s_first->arch != s_second->arch)) { |
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.
All packages in the block should have the same arch. Why is && (s_first->arch != s_second->arch)
needed?
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.
It is not, I forgot that the arch check was moved. 👍 👍
Since thanks to your other suggestion we no longer compare each solvable to it self I think we can drop the condition entirely. If there somehow was a package installed twice with the same name
, arch
and even evr
I think we would want it in the query. Packages with the same nevra
but different id
surely are duplicates in general for the filter_duplices()
.
What do you think?
libdnf/rpm/package_query.cpp
Outdated
for (int pos_first = start_block; pos_first < stop_block; ++pos_first) { | ||
Id id_first = samename[pos_first]; | ||
s_first = pool.id2solvable(id_first); | ||
for (int pos_second = start_block; pos_second < stop_block; ++pos_second) { |
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.
You compare each couple of solvables twice (i.e. pkgA with pkgB and than pkgB with pkgA again). I think you can start the inner cycle with for (int pos_second = pos_first...
. Or even pos_second = pos_first + 1
to avoid comparison of solvable with itself.
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.
Yes, thank you!
81ae48c
to
9ef25f8
Compare
9ef25f8
to
ac6b4d3
Compare
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.
Thanks, LGTM!
Adds
filter_duplicates()
method toPackageQuery
.For: #122
Tests: rpm-software-management/ci-dnf-stack#1187