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

Add support for full regex queries in libmamba's MatchSpec implementation #1853

Closed
jaimergp opened this issue Aug 10, 2022 · 7 comments
Closed
Assignees
Labels
type::feature-request New feature proposal

Comments

@jaimergp
Copy link
Contributor

Hello!

Apparently, conda's MatchSpec class supports full regex syntax for queries as long as the string is wrapped with ^$. Otherwise it's handled as a glob (which internally gets converted to a full regex anyway).

So all of these are equivalent and return the same results:

$ conda search "numpy=*=py39*"
$ conda search "numpy[build='py39*']"
$ conda search "numpy[build='^py39.*$']"
$ conda search "numpy[build='^(?:py39.*)$']"

However libmamba's MatchSpec (re)implementation seems to choke on the : character of the (?:) non-capturing group.

I understand this is very niche, but the suggested solution for an upcoming PR in conda, which deals with the very old problem of glob strings deemed as not compatible (when indeed they are), might end up producing a regex build string. See conda/conda#11612 for details.

The solution works well for conda but when I tried to see what happens with libmamba through conda-libmamba-solver, it cannot parse the resulting match spec string:

$ CONDA_EXPERIMENTAL_SOLVER=classic conda create -p ./whocares/ --dry-run "numpy=*=*py39*" "numpy=*=py39*"
Collecting package metadata (current_repodata.json): done
Solving environment: done

## Package Plan ##

  environment location: /opt/conda-src/whocares

  added / updated specs:
    - numpy[build='^(?=.*py39.*)(?:py39.*)$']

The following NEW packages will be INSTALLED:

  _libgcc_mutex      pkgs/main/linux-64::_libgcc_mutex-0.1-main
  _openmp_mutex      pkgs/main/linux-64::_openmp_mutex-5.1-1_gnu
  blas               pkgs/main/linux-64::blas-1.0-mkl
  ca-certificates    pkgs/main/linux-64::ca-certificates-2022.07.19-h06a4308_0
  certifi            pkgs/main/linux-64::certifi-2022.6.15-py39h06a4308_0
  intel-openmp       pkgs/main/linux-64::intel-openmp-2021.4.0-h06a4308_3561
  ld_impl_linux-64   pkgs/main/linux-64::ld_impl_linux-64-2.38-h1181459_1
  libffi             pkgs/main/linux-64::libffi-3.3-he6710b0_2
  libgcc-ng          pkgs/main/linux-64::libgcc-ng-11.2.0-h1234567_1
  libgomp            pkgs/main/linux-64::libgomp-11.2.0-h1234567_1
  libstdcxx-ng       pkgs/main/linux-64::libstdcxx-ng-11.2.0-h1234567_1
  mkl                pkgs/main/linux-64::mkl-2021.4.0-h06a4308_640
  mkl-service        pkgs/main/linux-64::mkl-service-2.4.0-py39h7f8727e_0
  mkl_fft            pkgs/main/linux-64::mkl_fft-1.3.1-py39hd3c417c_0
  mkl_random         pkgs/main/linux-64::mkl_random-1.2.2-py39h51133e4_0
  ncurses            pkgs/main/linux-64::ncurses-6.3-h5eee18b_3
  numpy              pkgs/main/linux-64::numpy-1.23.1-py39h6c91a56_0
  numpy-base         pkgs/main/linux-64::numpy-base-1.23.1-py39ha15fc14_0
  openssl            pkgs/main/linux-64::openssl-1.1.1q-h7f8727e_0
  pip                pkgs/main/linux-64::pip-22.1.2-py39h06a4308_0
  python             pkgs/main/linux-64::python-3.9.12-h12debd9_1
  readline           pkgs/main/linux-64::readline-8.1.2-h7f8727e_1
  setuptools         pkgs/main/linux-64::setuptools-61.2.0-py39h06a4308_0
  six                pkgs/main/noarch::six-1.16.0-pyhd3eb1b0_1
  sqlite             pkgs/main/linux-64::sqlite-3.39.2-h5082296_0
  tk                 pkgs/main/linux-64::tk-8.6.12-h1ccaba5_0
  tzdata             pkgs/main/noarch::tzdata-2022a-hda174b7_0
  wheel              pkgs/main/noarch::wheel-0.37.1-pyhd3eb1b0_0
  xz                 pkgs/main/linux-64::xz-5.2.5-h7f8727e_1
  zlib               pkgs/main/linux-64::zlib-1.2.12-h7f8727e_2

$ CONDA_EXPERIMENTAL_SOLVER=libmamba conda create -p ./whocares/ --dry-run "numpy=*=*py39*" "numpy=*=py39*"

pkgs/main/linux-64                                          Using cache
pkgs/main/noarch                                            Using cache
pkgs/r/linux-64                                             Using cache
pkgs/r/noarch                                               Using cache
Collect all metadata (repodata.json): done
Solving environment: failed

PackagesNotFoundError: The following packages are missing from the target environment:
  - py39.*)$ *

That weird package not found is the byproduct of misparsing this spec: numpy[build='^(?=.*py39.*)(?:py39.*)$']. I guess the parser is splitting by colon to find the channel spec, if any.

If I try to create an environment with less weird regex builds, it does work, btw:

$ CONDA_EXPERIMENTAL_SOLVER=libmamba conda create -p ./whocares/ --dry-run "numpy[build='^(py38.*_3)$']"

pkgs/main/linux-64                                            No change
pkgs/main/noarch                                              No change
pkgs/r/linux-64                                               No change
pkgs/r/noarch                                                 No change
Collect all metadata (repodata.json): done
Solving environment: done

## Package Plan ##

  environment location: /opt/conda-src/whocares

  added / updated specs:
    - numpy[build='^(py38.*_3)$']


The following packages will be downloaded:

    package                    |            build
    ---------------------------|-----------------
    _libgcc_mutex-0.1          |             main           3 KB
    _openmp_mutex-5.1          |            1_gnu          21 KB
    blas-1.0                   |              mkl           6 KB
    intel-openmp-2021.4.0      |    h06a4308_3561         4.2 MB
    mkl-2021.4.0               |     h06a4308_640       142.6 MB
    mkl-service-2.4.0          |   py38h7f8727e_0          59 KB
    mkl_fft-1.3.1              |   py38hd3c417c_0         180 KB
    mkl_random-1.2.2           |   py38h51133e4_0         308 KB
    numpy-1.21.5               |   py38h6c91a56_3          10 KB
    numpy-base-1.21.5          |   py38ha15fc14_3         4.9 MB
    sqlite-3.39.2              |       h5082296_0         1.1 MB
    ------------------------------------------------------------
                                           Total:       153.3 MB

The following NEW packages will be INSTALLED:

  _libgcc_mutex      pkgs/main/linux-64::_libgcc_mutex-0.1-main
  _openmp_mutex      pkgs/main/linux-64::_openmp_mutex-5.1-1_gnu
  blas               pkgs/main/linux-64::blas-1.0-mkl
  ca-certificates    pkgs/main/linux-64::ca-certificates-2022.07.19-h06a4308_0
  certifi            pkgs/main/linux-64::certifi-2022.6.15-py38h06a4308_0
  intel-openmp       pkgs/main/linux-64::intel-openmp-2021.4.0-h06a4308_3561
  ld_impl_linux-64   pkgs/main/linux-64::ld_impl_linux-64-2.38-h1181459_1
  libffi             pkgs/main/linux-64::libffi-3.3-he6710b0_2
  libgcc-ng          pkgs/main/linux-64::libgcc-ng-11.2.0-h1234567_1
  libgomp            pkgs/main/linux-64::libgomp-11.2.0-h1234567_1
  libstdcxx-ng       pkgs/main/linux-64::libstdcxx-ng-11.2.0-h1234567_1
  mkl                pkgs/main/linux-64::mkl-2021.4.0-h06a4308_640
  mkl-service        pkgs/main/linux-64::mkl-service-2.4.0-py38h7f8727e_0
  mkl_fft            pkgs/main/linux-64::mkl_fft-1.3.1-py38hd3c417c_0
  mkl_random         pkgs/main/linux-64::mkl_random-1.2.2-py38h51133e4_0
  ncurses            pkgs/main/linux-64::ncurses-6.3-h5eee18b_3
  numpy              pkgs/main/linux-64::numpy-1.21.5-py38h6c91a56_3  # build string matches, yay!
  numpy-base         pkgs/main/linux-64::numpy-base-1.21.5-py38ha15fc14_3
  openssl            pkgs/main/linux-64::openssl-1.1.1q-h7f8727e_0
  pip                pkgs/main/linux-64::pip-22.1.2-py38h06a4308_0
  python             pkgs/main/linux-64::python-3.8.13-h12debd9_0
  readline           pkgs/main/linux-64::readline-8.1.2-h7f8727e_1
  setuptools         pkgs/main/linux-64::setuptools-61.2.0-py38h06a4308_0
  six                pkgs/main/noarch::six-1.16.0-pyhd3eb1b0_1
  sqlite             pkgs/main/linux-64::sqlite-3.39.2-h5082296_0
  tk                 pkgs/main/linux-64::tk-8.6.12-h1ccaba5_0
  wheel              pkgs/main/noarch::wheel-0.37.1-pyhd3eb1b0_0
  xz                 pkgs/main/linux-64::xz-5.2.5-h7f8727e_1
  zlib               pkgs/main/linux-64::zlib-1.2.12-h7f8727e_2



DryRunExit: Dry run. Exiting.

So hopefully it's just a parsing issue :D

@wolfv
Copy link
Member

wolfv commented Aug 11, 2022

The packages not found error does look like it comes from libsolv, no? Because you mentioned yesterday that the error already happens when parsing MatchSpecs themselves.

libsolv has this code to strip away everything that comes before the last colon here: https://github.com/openSUSE/libsolv/blob/e13455d011710a99ef1dfb33432044cc7eae0efb/src/conda.c#L576-L578

If we change that to consider only colons that come before the first space, that would probably help to make this work!

E.g. we could change the code to read:

  /* ignore channel and namespace for now, but ignore colons later */
  if ((p2 = strrchr(name, ':')) && (p2 < strchr(name, ' ')))
    name = p2 + 1;

@jaimergp
Copy link
Contributor Author

Oh, yes, you are right!

Where are the spaces coming from?

An alternative would be to check whether the spec contains a square bracket. My C is terrible, so this would be in C-ish Python:

spec = "conda-forge::numpy[build='^(?:py39.*)$']"
bracket = spec.find("[")
if bracket >= 0:
  name = spec[:bracket]
  colon = name.find(":")
  if colon >= 0:
    name = name[colon+1:]
  fields = spec[bracket:]
  spec = name + fields
else:
  colon = spec.find(":")
  if colon >= 0:
    spec = spec[colon+1:]

@jaimergp
Copy link
Contributor Author

So TLDR:

  • I patched libsolv locally to fix the parsing.
  • Without specifying a version field, the build field is always dropped.
  • If a version field is specified (* is enough):
    • glob-only build strings do work; e.g. "scikit-build[version='0.15.*',build='*hb871*']"
    • simple regexes do work too; e.g. "scikit-build[version='0.15.*',build='^.*hb871.*$']"
    • lookahead regexes don't; e.g. "scikit-build[version='0.15.*',build='^(?:.*hb871.*)$']". This seems to be a limitation in POSIX's regex.h, so maybe switching to PCRE helps?

Ok, I had time to look into this a bit more. I applied this patch to libsolv's conda.c, which contains your patch, and also addresses a problem with equal signs in the regex.

diff --git a/src/conda.c b/src/conda.c
index 6f6a65a6..dd9b5948 100644
--- a/src/conda.c
+++ b/src/conda.c
@@ -574,7 +574,7 @@ pool_conda_matchspec(Pool *pool, const char *name)
   int haveglob = 0;
 
   /* ignore channel and namespace for now */
-  if ((p2 = strrchr(name, ':')))
+  if ((p2 = strrchr(name, ':')) && (p2 < strchr(name, ' ')))
     name = p2 + 1;
   name2 = solv_strdup(name);
   /* find end of name */
@@ -619,10 +619,10 @@ pool_conda_matchspec(Pool *pool, const char *name)
       if (p <= version + 1 || (p[-1] != ' ' && p[-1] != '='))
 	break;		/* no build */
       /* check char before delimiter */
-      if (p[-2] == '=' || p[-2] == '!' || p[-2] == '|' || p[-2] == ',' || p[-2] == '<' || p[-2] == '>' || p[-2] == '~')
+      if (p[-2] == '=' || p[-2] == '!' || p[-2] == '|' || p[-2] == ',' || p[-2] == '<' || p[-2] == '>' || p[-2] == '~' || p[-2] == '?')
 	{
 	  /* illegal combination */
-	  if (p[-1] == ' ')
+	  if (p[-1] == ' '  || (p[-1] == '=' && p[-2] == '?'))
 	    {
 	      p--;
 	      continue;	/* special case space: it may be in the build */

With this patch the parsing does not choke, so we can get to a different error now :)

Let's assume we want to install scikit-build with a build string that contains hb871*, because that's what a user specified in their environment yaml or whatever. There are several packages that fulfil that requirement:

$ conda search scikit-build
Loading channels: done
# Name                       Version           Build  Channel             
...      
scikit-build                  0.12.0    pyhca92ed8_3  conda-forge         
scikit-build                  0.13.0    pyhca92ed8_0  conda-forge         
scikit-build                  0.13.1    pyhca92ed8_0  conda-forge         
scikit-build                  0.14.0    pyhb871ab6_0  conda-forge         
scikit-build                  0.14.1    pyhb871ab6_0  conda-forge         
scikit-build                  0.15.0    pyhb871ab6_0  conda-forge  

I want to test advanced regexes, so I'll use the string ^(?=py.*)(?:.*hb871.*)$, which means "build string contains both py* and *hb871*".

Vanilla conda:

$ conda install --dry-run "scikit-build[build=^(?=py.*)(?:.*hb871.*)$]"

...

## Package Plan ##

  environment location: /Users/jrodriguez/.local/anaconda

  added / updated specs:
    - scikit-build[build='^(?=py.*)(?:.*hb871.*)$']


The following packages will be downloaded:

    package                    |            build
    ---------------------------|-----------------
    distro-1.6.0               |     pyhd8ed1ab_0          22 KB  conda-forge
    scikit-build-0.15.0        |     pyhb871ab6_0          85 KB  conda-forge
    ------------------------------------------------------------
                                           Total:         107 KB

The following NEW packages will be INSTALLED:

  cmake              conda-forge/osx-arm64::cmake-3.24.1-h967666c_0
  distro             conda-forge/noarch::distro-1.6.0-pyhd8ed1ab_0
  libuv              conda-forge/osx-arm64::libuv-1.44.2-he4db4b2_0
  make               conda-forge/osx-arm64::make-4.3-he57ea6c_1
  rhash              conda-forge/osx-arm64::rhash-1.4.3-he4db4b2_0
  scikit-build       conda-forge/noarch::scikit-build-0.15.0-pyhb871ab6_0

The following packages will be UPDATED:

  python                           3.9.4-h5b20da3_0_cpython --> 3.9.13-hc596b02_0_cpython



DryRunExit: Dry run. Exiting.

Cool that worked. Now let's make it break. I'll query for an non-existing artifact:

$ conda install --dry-run "scikit-build[build=^(?=py.*)(?:.*DOESNOTEXIST.*)$]"

PackagesNotFoundError: The following packages are not available from current channels:

  - scikit-build[build='^(?=py.*)(?:.*DOESNOTEXIST.*)$']

As expected, it fails.


Now with mamba:

$ mamba install --dry-run "scikit-build[build=^(?=py.*)(?:.*hb871.*)$]"       
...

Looking for: ["scikit-build[build='^(?=py.*)(?:.*hb871.*)$']"]

conda-forge/osx-arm64                                       Using cache
conda-forge/noarch                                          Using cache
conda-forge/label/rust_dev/noarch                             No change
conda-forge/label/rust_dev/osx-arm64                          No change

Pinned packages:
  - python 3.9.*


Transaction

  Prefix: /Users/jrodriguez/.local/anaconda

  Updating specs:

   - scikit-build[build='^(?=py.*)(?:.*hb871.*)$']
   - ca-certificates
   - certifi
   - openssl


  Package         Version  Build         Channel                     Size
───────────────────────────────────────────────────────────────────────────
  Install:
───────────────────────────────────────────────────────────────────────────

  + cmake          3.24.1  h967666c_0    conda-forge/osx-arm64     Cached
  + distro          1.6.0  pyhd8ed1ab_0  conda-forge/noarch          22kB
  + libuv          1.44.2  he4db4b2_0    conda-forge/osx-arm64     Cached
  + make              4.3  he57ea6c_1    conda-forge/osx-arm64     Cached
  + rhash           1.4.3  he4db4b2_0    conda-forge/osx-arm64     Cached
  + scikit-build   0.15.0  pyhb871ab6_0  conda-forge/noarch          87kB

  Summary:

  Install: 6 packages

  Total download: 109kB

───────────────────────────────────────────────────────────────────────────


DryRunExit: Dry run. Exiting.

Oh wow it worked! Well, it always works :D The regex is not really respected:

$ mamba install --dry-run "scikit-build[build=^(?=py.*)(?:.*DOESNOTEXIST.*)$]"                         
...

Looking for: ["scikit-build[build='^(?=py.*)(?:.*DOESNOTEXIST.*)$']"]

conda-forge/osx-arm64                                         No change
conda-forge/label/rust_dev/noarch                             No change
conda-forge/label/rust_dev/osx-arm64                          No change
conda-forge/noarch                                   9.1MB @   3.9MB/s  3.2s

Pinned packages:
  - python 3.9.*


Transaction

  Prefix: /Users/jrodriguez/.local/anaconda

  Updating specs:

   - scikit-build[build='^(?=py.*)(?:.*DOESNOTEXIST.*)$']
   - ca-certificates
   - certifi
   - openssl


  Package         Version  Build         Channel                     Size
───────────────────────────────────────────────────────────────────────────
  Install:
───────────────────────────────────────────────────────────────────────────

  + cmake          3.24.1  h967666c_0    conda-forge/osx-arm64     Cached
  + distro          1.6.0  pyhd8ed1ab_0  conda-forge/noarch          22kB
  + libuv          1.44.2  he4db4b2_0    conda-forge/osx-arm64     Cached
  + make              4.3  he57ea6c_1    conda-forge/osx-arm64     Cached
  + rhash           1.4.3  he4db4b2_0    conda-forge/osx-arm64     Cached
  + scikit-build   0.15.0  pyhb871ab6_0  conda-forge/noarch          87kB

  Summary:

  Install: 6 packages

  Total download: 109kB

───────────────────────────────────────────────────────────────────────────


DryRunExit: Dry run. Exiting.

And it's not about the regex. This should fail too and it doesn't:

$ mamba install --dry-run "scikit-build[build='DOESNOTEXIST*']"                                      

... 


Looking for: ['scikit-build[build=DOESNOTEXIST*]']

conda-forge/osx-arm64                                       Using cache
conda-forge/noarch                                          Using cache
conda-forge/label/rust_dev/noarch                             No change
conda-forge/label/rust_dev/osx-arm64                          No change

Pinned packages:
  - python 3.10.*


Transaction

  Prefix: /Users/jrodriguez/.local/anaconda/envs/libsolv-dev

  Updating specs:

   - scikit-build[build=DOESNOTEXIST*]
   - ca-certificates
   - certifi
   - openssl


  Package         Version  Build         Channel                    Size
──────────────────────────────────────────────────────────────────────────
  Install:
──────────────────────────────────────────────────────────────────────────

  + cmake          3.24.1  h967666c_0    conda-forge/osx-arm64      14MB
  + distro          1.6.0  pyhd8ed1ab_0  conda-forge/noarch         22kB
  + expat           2.4.8  h6b3803e_0    conda-forge/osx-arm64     153kB
  + libuv          1.44.2  he4db4b2_0    conda-forge/osx-arm64     468kB
  + make              4.3  he57ea6c_1    conda-forge/osx-arm64     253kB
  + packaging        21.3  pyhd8ed1ab_0  conda-forge/noarch         36kB
  + pyparsing       3.0.9  pyhd8ed1ab_0  conda-forge/noarch         81kB
  + rhash           1.4.3  he4db4b2_0    conda-forge/osx-arm64     199kB
  + scikit-build   0.15.0  pyhb871ab6_0  conda-forge/noarch         87kB
  + wheel          0.37.1  pyhd8ed1ab_0  conda-forge/noarch         32kB
  + zlib           1.2.12  ha287fd2_2    conda-forge/osx-arm64      79kB

  Summary:

  Install: 11 packages

  Total download: 16MB

──────────────────────────────────────────────────────────────────────────

Dry run. Exiting.

It looks like it's dropped:

info     libsolv  repo_add_solv took 57 ms
info     libsolv  repo size: 102513 solvables
info     libsolv  repo memory used: 7063 K incore, 3384 K idarray
info     libsolv  number of solvables: 137513, memory used: 7520 K
info     libsolv  number of ids: 65070 + 128598
info     libsolv  string memory used: 254 K array + 863 K data,  rel memory used: 1507 K array
info     libsolv  string hash memory: 1024 K, rel hash memory : 1024 K
info     libsolv  provide ids: 14566
info     libsolv  provide space needed: 152081 + 257196
info     libsolv  shrunk whatprovidesdata from 152081 to 152081
info     libsolv  shrunk whatprovidesauxdata from 152081 to 137512
info     libsolv  whatprovides memory used: 760 K id array, 1598 K data
info     libsolv  whatprovidesaux memory used: 254 K id array, 537 K data
info     libsolv  createwhatprovides took 3 ms
info     libmamba Parsing MatchSpec scikit-build[build='^(?=py.*)(?:.*hb871.*)$']
info     libmamba Parsing MatchSpec scikit-build[build='^(?=py.*)(?:.*hb871.*)$']
info     libmamba Adding job: scikit-build
info     libmamba Parsing MatchSpec ca-certificates
info     libmamba Parsing MatchSpec ca-certificates
info     libmamba Parsing MatchSpec certifi
info     libmamba Parsing MatchSpec certifi
info     libmamba Parsing MatchSpec openssl
info     libmamba Parsing MatchSpec openssl
info     libmamba Parsing MatchSpec python 3.9.*
info     libsolv  solver started
info     libsolv  dosplitprovides=0, noupdateprovide=0, noinfarchcheck=0
info     libsolv  allowuninstall=0, allowdowngrade=1, allownamechange=1, allowarchchange=0, allowvendorchange=0
info     libsolv  dupallowdowngrade=1, dupallownamechange=1, dupallowarchchange=1, dupallowvendorchange=1
info     libsolv  promoteepoch=0, forbidselfconflicts=0
info     libsolv  obsoleteusesprovides=0, implicitobsoleteusesprovides=0, obsoleteusescolors=0, implicitobsoleteusescolors=0
info     libsolv  dontinstallrecommended=0, addalreadyrecommended=0 onlynamespacerecommended=0
info     libsolv  obsoletes data: 1 entries
info     libsolv  added 110376 pkg rules for installed solvables
info     libsolv  added 19293 pkg rules for updaters of installed solvables
info     libsolv  added 1125 pkg rules for packages involved in a job
info     libsolv  added 0 pkg rules because of weak dependencies
info     libsolv  4044 of 137512 installable solvables considered for solving
info     libsolv  pruned rules from 130795 to 129229
info     libsolv    binary: 113443
info     libsolv    normal: 15785, 408069 literals
info     libsolv  pkg rule memory used: 3028 K
info     libsolv  pkg rule creation took 98 ms
info     libsolv  job: install providing scikit-build
info     libsolv    - job Rule #129599:
info     libsolv      scikit-build-0.11.1-py38h3f7e68f_2 [30286] (w1)
info     libsolv      scikit-build-0.11.1-py38h6f2b01f_2 [30287] (w2)
info     libsolv      scikit-build-0.11.1-py39h93dc1e2_2 [30288]
info     libsolv      scikit-build-0.11.1-py39hfb83b0d_2 [30289]
info     libsolv      scikit-build-0.12.0-py310h1b49c16_2 [30290]
info     libsolv      scikit-build-0.12.0-py38h6f2b01f_0 [30291]
info     libsolv      scikit-build-0.12.0-py38h6f2b01f_1 [30292]
info     libsolv      scikit-build-0.12.0-py38h6f2b01f_2 [30293]
info     libsolv      scikit-build-0.12.0-py39hfb83b0d_0 [30294]
info     libsolv      scikit-build-0.12.0-py39hfb83b0d_1 [30295]
info     libsolv      scikit-build-0.12.0-py39hfb83b0d_2 [30296]
info     libsolv      scikit-build-0.12.0-pyhca92ed8_3 [124228]
info     libsolv      scikit-build-0.13.0-pyhca92ed8_0 [124229]
info     libsolv      scikit-build-0.13.1-pyhca92ed8_0 [124230]
info     libsolv      scikit-build-0.14.0-pyhb871ab6_0 [124231]
info     libsolv      scikit-build-0.14.1-pyhb871ab6_0 [124232]
info     libsolv      scikit-build-0.15.0-pyhb871ab6_0 [124233]
info     libsolv      next rules: 0 0
info     libsolv  job: update providing ca-certificates
info     libsolv    - no rule created

Ok, so let's add the version then? If I specify a version (even with just *), it ALWAYS fails:

$ mamba install --dry-run "scikit-build[version='*',build=^(?=py.*)(?:.*hb871.*)$]"            

...


Looking for: ["scikit-build=[build='^(?=py.*)(?:.*hb871.*)$']"]

conda-forge/osx-arm64                                       Using cache
conda-forge/noarch                                          Using cache
conda-forge/label/rust_dev/osx-arm64                          No change
conda-forge/label/rust_dev/noarch                             No change

Pinned packages:
  - python 3.10.*


Encountered problems while solving:
  - nothing provides requested scikit-build * ^(?=py.*)(?:.*hb871.*)$
$ mamba install --dry-run "scikit-build[version='0.15.*',build=^(?=py.*)(?:.*hb871.*)$]"

...

Looking for: ["scikit-build=0.15[build='^(?=py.*)(?:.*hb871.*)$']"]

conda-forge/osx-arm64                                       Using cache
conda-forge/noarch                                          Using cache
conda-forge/label/rust_dev/osx-arm64                          No change
conda-forge/label/rust_dev/noarch                             No change

Pinned packages:
  - python 3.10.*


Encountered problems while solving:
  - nothing provides requested scikit-build 0.15* ^(?=py.*)(?:.*hb871.*)$

^ These two should have worked!! See logs:

info     libsolv  repo_add_solv took 11 ms
info     libsolv  repo size: 34732 solvables
info     libsolv  repo memory used: 2536 K incore, 1493 K idarray
info     libmamba Reading cache files '/Users/jrodriguez/.local/anaconda/envs/libsolv-dev/pkgs/cache/02e7a01e.*' for repo index 'https://conda.anaconda.org/t/*****/conda-forge/noarch'
info     libsolv  repo_add_solv took 48 ms
info     libsolv  repo size: 102513 solvables
info     libsolv  repo memory used: 7089 K incore, 3384 K idarray
info     libsolv  number of solvables: 137391, memory used: 7513 K
info     libsolv  number of ids: 65071 + 128596
info     libsolv  string memory used: 254 K array + 863 K data,  rel memory used: 1506 K array
info     libsolv  string hash memory: 1024 K, rel hash memory : 1024 K
info     libsolv  provide ids: 14565
info     libsolv  provide space needed: 151958 + 257192
info     libsolv  shrunk whatprovidesdata from 151958 to 151958
info     libsolv  shrunk whatprovidesauxdata from 151958 to 137390
info     libsolv  whatprovides memory used: 760 K id array, 1598 K data
info     libsolv  whatprovidesaux memory used: 254 K id array, 536 K data
info     libsolv  createwhatprovides took 3 ms
info     libmamba Parsing MatchSpec scikit-build=0.15[build='^(?=py.*)(?:.*hb871.*)$']
info     libmamba Parsing MatchSpec scikit-build=0.15[build='^(?=py.*)(?:.*hb871.*)$']
info     libmamba Adding job: scikit-build =0.15* ^(?=py.*)(?:.*hb871.*)$
info     libmamba Parsing MatchSpec ca-certificates
info     libmamba Parsing MatchSpec ca-certificates
info     libmamba Parsing MatchSpec certifi
info     libmamba Parsing MatchSpec certifi
info     libmamba Parsing MatchSpec openssl
info     libmamba Parsing MatchSpec openssl
info     libmamba Parsing MatchSpec python 3.10.*
info     libsolv  solver started
info     libsolv  dosplitprovides=0, noupdateprovide=0, noinfarchcheck=0
info     libsolv  allowuninstall=0, allowdowngrade=1, allownamechange=1, allowarchchange=0, allowvendorchange=0
info     libsolv  dupallowdowngrade=1, dupallownamechange=1, dupallowarchchange=1, dupallowvendorchange=1
info     libsolv  promoteepoch=0, forbidselfconflicts=0
info     libsolv  obsoleteusesprovides=0, implicitobsoleteusesprovides=0, obsoleteusescolors=0, implicitobsoleteusescolors=0
info     libsolv  dontinstallrecommended=0, addalreadyrecommended=0 onlynamespacerecommended=0
info     libsolv  obsoletes data: 1 entries
info     libsolv  added 53849 pkg rules for installed solvables
info     libsolv  added 10415 pkg rules for updaters of installed solvables
info     libsolv  added 0 pkg rules for packages involved in a job
info     libsolv  added 0 pkg rules because of weak dependencies
info     libsolv  1544 of 137390 installable solvables considered for solving
info     libsolv  pruned rules from 64265 to 63505
info     libsolv    binary: 58234
info     libsolv    normal: 5270, 100823 literals
info     libsolv  pkg rule memory used: 1488 K
info     libsolv  pkg rule creation took 9 ms
info     libsolv  job: install providing scikit-build 0.15* ^(?=py.*)(?:.*hb871.*)$
info     libsolv    - job Rule #63631:
info     libsolv      !system:system.any [1] (w1)
info     libsolv      next rules: 0 0
info     libsolv  job: update providing ca-certificates
info     libsolv    - no rule created
info     libsolv  job: update providing certifi
info     libsolv    - no rule created
info     libsolv  job: update providing openssl
info     libsolv    - no rule created

Also for completeness, this also fails, of course:

$ mamba install --dry-run "scikit-build[version='*',build=^(?=py.*)(?:.*DOESNOTEXIST.*)$]"

...


Looking for: ["scikit-build=[build='^(?=py.*)(?:.*DOESNOTEXIST.*)$']"]

conda-forge/osx-arm64                                       Using cache
conda-forge/noarch                                          Using cache
conda-forge/label/rust_dev/noarch                             No change
conda-forge/label/rust_dev/osx-arm64                          No change

Pinned packages:
  - python 3.10.*


Encountered problems while solving:
  - nothing provides requested scikit-build * ^(?=py.*)(?:.*DOESNOTEXIST.*)$

@jaimergp
Copy link
Contributor Author

One more note: I replaced regex.h with pcre2posix.h (plus the corresponding functions, all provided by pcre2) in libsolv and it works just fine! @wolfv Do you think upstream would welcome such a patch?

@jaimergp
Copy link
Contributor Author

PR submitted upstream openSUSE/libsolv#506

@jonashaag jonashaag added the type::feature-request New feature proposal label Sep 30, 2022
@jaimergp
Copy link
Contributor Author

jaimergp commented Oct 7, 2022

libsolv patch for the feedstock: conda-forge/libsolv-feedstock#60

@AntoinePrv
Copy link
Member

Closing in favor of #3169 which is a bit more recent.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type::feature-request New feature proposal
Projects
None yet
Development

No branches or pull requests

4 participants