Fix duplicated packages with categories from env lock file#4340
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #4340 +/- ##
==========================================
+ Coverage 55.07% 55.08% +0.01%
==========================================
Files 240 240
Lines 30302 30331 +29
Branches 3237 3241 +4
==========================================
+ Hits 16688 16709 +21
- Misses 13611 13619 +8
Partials 3 3 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
| const Context& ctx, | ||
| solver::libsolv::Database& database, | ||
| std::vector<specs::PackageInfo> packages, | ||
| std::unordered_set<specs::PackageInfo> packages, |
There was a problem hiding this comment.
Did you consider using flat_set ? (reminder: it's like unordered_set except implemented as a vector).
It seems it would be more appropriate as we have loops going through it.
There was a problem hiding this comment.
To follow up on the comment, I think it would also need implementing some missing parts like operator< for PackageInfo as flat_set is sorted.
| std::back_insert_iterator(m_solution.actions), | ||
| [](specs::PackageInfo&& pkg) { return solver::Solution::Install{ std::move(pkg) }; } | ||
| ); | ||
| for (auto it = packages.begin(); it != packages.end();) |
There was a problem hiding this comment.
I'm not sure I understand the change, what this loop is doing that's different from the original?
There was a problem hiding this comment.
I think unordered_set iterators are constant and cannot be used to instantiate std::move_iterator.
There was a problem hiding this comment.
Yes exactly. And it seems flat_set would have the same issue as iterators are const and it doesn't have an extract equivalent.
Description
Fix #4333
Type of Change
Checklist
pre-commit run --alllocally in the source folder and confirmed that there are no linter errors.