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

Isolate PackageInfo from libsolv #2340

Merged
merged 5 commits into from
Mar 8, 2023

Conversation

AntoinePrv
Copy link
Member

@AntoinePrv AntoinePrv commented Mar 2, 2023

  • The PackageInfo becomes (almost) a data type, independant from libsolv.
  • The Solvable* -> PackageInfo is done in the MPool.
  • MTransaction needs to capture the MPool to use that functions (but anyways it was using a Pool* already, at least it's explicit).

The rest of the changes are to cope with these changes throughout the code base.

@wolfv
Copy link
Member

wolfv commented Mar 6, 2023

nice!

Comment on lines +213 to +219
.def(py::init<>(
[](MSolver& solver, MultiPackageCache& mpc)
{
deprecated("Use Transaction(Pool, Solver, MultiPackageCache) instead");
return std::make_unique<MTransaction>(solver.pool(), solver, mpc);
}
))
Copy link
Member Author

Choose a reason for hiding this comment

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

Keeping deprecated API in Python

libmamba/src/core/transaction.cpp Outdated Show resolved Hide resolved
@@ -1468,7 +1473,7 @@ namespace mamba
}
else
{
if (!need_pkg_download(s, m_multi_cache))
if (!need_pkg_download(mk_pkginfo(m_pool, s), m_multi_cache))
Copy link
Member

Choose a reason for hiding this comment

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

mk_pkginfo returns a PackageInfo right? It replaces a solvable here?

Copy link
Member Author

Choose a reason for hiding this comment

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

Yes, the previous line was calling an implicit conversion from Solvable* to PackageInfo.

libmamba/include/mamba/core/solver.hpp Show resolved Hide resolved
@@ -126,7 +122,7 @@ namespace mamba
const std::vector<MatchSpec>& specs_to_install,
MultiPackageCache& caches
);
MTransaction(MSolver& solver, MultiPackageCache& caches);
MTransaction(MPool& pool, MSolver& solver, MultiPackageCache& caches);
Copy link
Member

Choose a reason for hiding this comment

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

Because the member m_pool is a value and not a reference, it is not clear what is going on here. In the constructor implementation we pass m_pool(pool), what does this mean? Is it a copy?

Copy link
Member Author

Choose a reason for hiding this comment

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

It's a shared reference. We had the discussion last autumn to make MPool interally based on an std::shared_ptr.
This will also change as we refactor the pool.

Copy link
Member

Choose a reason for hiding this comment

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

Ah ok, then why not pass it by value? that would make it clear that whatever the model, there is ownership being acquired. There is no condition to that so no reason to pass a reference.

Copy link
Member

Choose a reason for hiding this comment

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

I missed your answer before I merged, I can make the change in a mechanical PR.

libmamba/src/core/pool.cpp Outdated Show resolved Hide resolved
@AntoinePrv AntoinePrv requested review from Klaim and Hind-M March 7, 2023 15:44
@JohanMabille JohanMabille merged commit 8c5841c into mamba-org:main Mar 8, 2023
@AntoinePrv AntoinePrv deleted the package-info branch March 8, 2023 10:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants