feat: Inject channels+mirrors coming from mambajs env-lockfiles#4126
feat: Inject channels+mirrors coming from mambajs env-lockfiles#4126Klaim wants to merge 66 commits into
Conversation
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## main #4126 +/- ##
==========================================
- Coverage 55.08% 54.96% -0.12%
==========================================
Files 240 241 +1
Lines 30329 30424 +95
Branches 3241 3248 +7
==========================================
+ Hits 16707 16723 +16
- Misses 13619 13698 +79
Partials 3 3 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
8209f96 to
61dd997
Compare
acf6926 to
7b39d36
Compare
| // Adds mirror urls if not already recorded, by default added at the end of the mirrors | ||
| // list. | ||
| void add_mirror_urls( | ||
| const std::vector<CondaURL>& additional_mirrors, | ||
| UrlPriority priority = UrlPriority::low | ||
| ); | ||
|
|
There was a problem hiding this comment.
I don't have the full context here, but if possible it would be best if these could be part of ChannelParams/resolve workflow.
The general idea of specs::Channel is that with resolve you always obtain what you want, (pure functional no mutable changes). This is because currently with libsolv hacks etc, specs::Channel are rather short-lived, converted back and forth to strings. I believe functions like set_platforms are use for only local reasoning.
| // inject additional mirrors if not already existing in current channels | ||
| for (auto& channel : it->second) | ||
| { | ||
| // TODO C++23: replace all this by std::vector(from_range_t, ...) | ||
| auto urls_view = specs::as_conda_urls(mirrors); | ||
| std::vector<specs::CondaURL> urls(urls_view.begin(), urls_view.end()); | ||
|
|
||
| channel.add_mirror_urls(urls, new_mirrors_priority); | ||
| } |
There was a problem hiding this comment.
If this logic could be made part of ChannelParams/Channel::resolve that would avoid adding extra complexity to the channel creation logic.
|
I keep seeing issues with the tests locally but I suspect it's actually an unrelated problem, I might have to spam the ci a bit, sorry for the noise! |
This reverts commit 1d2fe6d.
1645ec8 to
e9fd889
Compare
|
FYI, I also rebased this branch onto I kept the previous state of the branch on |
Signed-off-by: Julien Jerphanion <git@jjerphan.xyz>
(maybe unintentionally removed when merged with main?)
Description
So far the handling of environment lockfile read package specifications from them and used that to get the packages but the channels urls specified in the lockfile were read but then ignored.
This change makes libmamba use the urls specified by lockfiles, only for mambajs for now, and put them at the top of the priority of urls to use for each channel name (could be easily changed later if necessary).
The core of the feature is located in
MTransaction create_explicit_transaction_from_lockfile()(transaction.cpp), reviewers should start reading from there.As part of that implementation:
ContextandContextChannelafter reading the lockfile -- this unfortunately happens after the channels has been created with other sources of information so it is a bit contrieved by the execution flow;containsstandard algorithm implementation that will be replaced by the standard once available;ChannelContext(see the change intrancation.cppinMTransaction::execute. This change has the potential to be breaking although we didn't find so far an explicit issue.MTransaction::executeso that it relies on the deduced information instead of approximations pre-execution.ChannelContext::make_channelnow allows adding new unique mirror urls to existing channels.Type of Change
Checklist
pre-commit run --alllocally in the source folder and confirmed that there are no linter errors.