mamba-org / mamba

The Fast Cross-Platform Package Manager
https://mamba.readthedocs.io
BSD 3-Clause "New" or "Revised" License
6.78k stars 348 forks source link

ENH: enable repoquery against all platforms, e.g. with `-p *` #2068

Open h-vetinari opened 1 year ago

h-vetinari commented 1 year ago

Having to mark packages as broken in conda-forge is not a fun task, and to minimize the risk of getting the C&P wrong, we've cobbled together some scripts that get the right packages from the metadata (and by "we" I mean Mark).

However - assuming a version needs to be pulled for all architectures -, this means duplicating a lot of queries (and waiting each time until the download happens), see e.g. https://github.com/conda-forge/admin-requests/pull/427:

mamba repoquery search --platform linux-64 pytorch=1.10.2=*_0 --json | grep url | awk -F'conda-forge/' '{print $2}'  | awk -F'",' '{print $1}'
mamba repoquery search --platform linux-64 torchvision=0.11.3=*_1 --json | grep url | awk -F'conda-forge/' '{print $2}'  | awk -F'",' '{print $1}'
mamba repoquery search -p linux-64 torchvision=0.11.3=*_0 --json | grep url | awk -F'conda-forge/' '{print $2}'  | awk -F'",' '{print $1}'
mamba repoquery search -p osx-arm64 pytorch=1.10.2=*_0 --json | grep url | awk -F'conda-forge/' '{print $2}'  | awk -F'",' '{print $1}'
mamba repoquery search -p osx-arm64 torchvision=0.11.3=*_1 --json | grep url | awk -F'conda-forge/' '{print $2}'  | awk -F'",' '{print $1}'
mamba repoquery search -p osx-arm64 torchvision=0.11.3=*_0 --json | grep url | awk -F'conda-forge/' '{print $2}'  | awk -F'",' '{print $1}'
mamba repoquery search -p osx-64 pytorch=1.10.2=*_0 --json | grep url | awk -F'conda-forge/' '{print $2}'  | awk -F'",' '{print $1}'
mamba repoquery search -p osx-64 torchvision=0.11.3=*_1 --json | grep url | awk -F'conda-forge/' '{print $2}'  | awk -F'",' '{print $1}'
mamba repoquery search -p osx-64 torchvision=0.11.3=*_0 --json | grep url | awk -F'conda-forge/' '{print $2}'  | awk -F'",' '{print $1}'

That's just for three architectures (in practice up to 6!), so it'd be nice to be able to write this as:

mamba repoquery search -p * pytorch=1.10.2=*_0 --json | grep url | awk -F'conda-forge/' '{print $2}'  | awk -F'",' '{print $1}'
mamba repoquery search -p * torchvision=0.11.3=*_1 --json | grep url | awk -F'conda-forge/' '{print $2}'  | awk -F'",' '{print $1}'
mamba repoquery search -p * torchvision=0.11.3=*_0 --json | grep url | awk -F'conda-forge/' '{print $2}'  | awk -F'",' '{print $1}'

(yes, this might return more results in case not all arches are actually needed, but it's much, much easier to delete extra lines, than create the right content)

Of course, having an explicit option to do away with the grep/awk-scripting would be even better, but for now this issue is just about getting all architectures in one go.

JFYI @hmaarrfk

jonashaag commented 1 year ago

Or we could make it accept a comma separated list / multiple usages of -p?

h-vetinari commented 1 year ago

Sure, that would also work