Skip to content

Commit

Permalink
Fix conda-build compatibility regression (#531)
Browse files Browse the repository at this point in the history
* ignore solv files (debug)

* mark / debug dev version

* bring this bit back

* revert this other bit?

* find out what kind of deduplication is happening

* debug further

* try with deduped again

* Reenable solv files

* dedup on reported exceptions

* revert this unrelated change

* sleep after each channel reloaded?

* only reload if conda-build channels are involved

* Remove Channel.platform() to avoid missing subdirs when calling Channel.urls()

* Remove .platform here too

* clean up a bit

* add news

* more cleanups
  • Loading branch information
jaimergp authored Sep 24, 2024
1 parent 29e1ab6 commit 590010c
Show file tree
Hide file tree
Showing 3 changed files with 42 additions and 4 deletions.
3 changes: 2 additions & 1 deletion conda_libmamba_solver/index.py
Original file line number Diff line number Diff line change
Expand Up @@ -305,7 +305,8 @@ def _load_channels(self) -> dict[str, _ChannelRepoInfo]:
urls = []
seen_noauth = set()
for _c in self._channels:
c = Channel(_c)
# When .platform is defined, .urls() will ignore subdirs kw. Remove!
c = Channel(**{k: v for k, v in Channel(_c).dump().items() if k != "platform"})
noauth_urls = c.urls(with_credentials=False, subdirs=self._subdirs)
if seen_noauth.issuperset(noauth_urls):
continue
Expand Down
24 changes: 21 additions & 3 deletions conda_libmamba_solver/solver.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
We can import from conda and libmambapy. `mamba` itself should NOT be imported here.
"""

import json
import logging
import os
Expand Down Expand Up @@ -198,7 +199,23 @@ def solve_final_state(
all_channels.append(channel)
all_channels.extend(in_state.maybe_free_channel())

all_channels = tuple(dict.fromkeys(all_channels))
# Aggregate channels and subdirs
deduped_channels = {}
for channel in all_channels:
if channel_platform := getattr(channel, "platform", None):
if channel_platform not in subdirs:
log.info(
"Channel %s defines platform %s which is not part of subdirs=%s. "
"Ignoring platform attribute...",
channel,
channel_platform,
subdirs,
)
# Remove 'Channel.platform' to avoid missing subdirs. Channel.urls() will ignore
# our explicitly passed subdirs if .platform is defined!
channel = Channel(**{k: v for k, v in channel.dump().items() if k != "platform"})
deduped_channels[channel] = None
all_channels = tuple(deduped_channels)
with Spinner(
self._spinner_msg_metadata(all_channels, conda_bld_channels=conda_bld_channels),
enabled=not context.verbosity and not context.quiet,
Expand All @@ -211,7 +228,8 @@ def solve_final_state(
repodata_fn=self._repodata_fn,
load_pkgs_cache=context.offline,
)
index.reload_local_channels()
if conda_bld_channels:
index.reload_local_channels()

with Spinner(
self._spinner_msg_solving(),
Expand Down Expand Up @@ -722,7 +740,7 @@ def _maybe_raise_for_problems(
)
# This is not a conflict, but a missing package in the channel
exc = PackagesNotFoundError(
tuple(not_found.values()), tuple(channels or self.channels)
tuple(not_found.values()), tuple(dict.fromkeys(channels or self.channels))
)
exc.allow_retry = False
raise exc
Expand Down
19 changes: 19 additions & 0 deletions news/531-channel-dedup
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
### Enhancements

* <news item>

### Bug fixes

* Fix conda-build compatibility regression where arch-specific outputs can't be found in the test phase if a `noarch` output was built first. (#531)

### Deprecations

* <news item>

### Docs

* <news item>

### Other

* <news item>

0 comments on commit 590010c

Please sign in to comment.