Conan: [question] How can I execute a conan create --build=all excluding a single package?

Created on 8 Feb 2021  路  3Comments  路  Source: conan-io/conan

I need to perform a conan create --build=all but avoid building one particular package (which is not built from source but was created with someone else's binaries inside). I've read https://docs.conan.io/en/latest/mastering/policies.html which state:

The package pattern can be referred as a case-sensitive fnmatch pattern of the package name or the full package reference.

So I thought e.g. fnmatch ! would apply: https://docs.python.org/3/library/fnmatch.html

I've tried:

--build=!mydontbuildpackage
--build=![mydontbuildpackage]
--build=!mydontbuildpackage*
--build=[!mydontbuildpackage]*

but in all cases I ended up with an error:

ERROR: Missing prebuilt package for 'a/0.3.0@PORT/stable', 'b/3.5.2-13@PORT/stable', 'c/0.0.5@PORT/stable', 'c/2.58.0@PORT/stable', 'e/0.0.28@PORT/stable', 'f/0.0.22@PORT/stable' ...
Try to build from sources with '--build=missing'

Does anyone have any examples of this ?

duplicate

Most helpful comment

I do not believe it's possible to achieve your goal with the current --build flag and fnmatch implementation.

Currently, your only path forward is to pass multiple build flags, one for each package you need to rebuild:

  conan install ...  --build a --build b --build c

If you want to pursue the "exclusion pattern", I believe this calls for a feature request to support multiple patterns, similar to the way the exports_sources feature works in recipes:

  conan install ...  --build * --build !xyz

If the explicit listing of packages to build is insufficient for you, and you wish to pursue this as a feature request, I can label this as a feature request. Please let me know.

All 3 comments

It's been suggested to me that I've misunderstood the fnmatch documentation, and [!abc] means "one character that is neither 'a' nor 'b' nor 'c'" rather than "not the sequence 'abc'".

I guess I want something available with FNM_EXTMATCH:

'!(pattern-list)'

from https://www.man7.org/linux/man-pages/man3/fnmatch.3.html

In which case, if fnmatch exclusion is not a possibility, is there some other way I can accomplish my goal of issuing a "rebuild everything" request that won't get stuck on some packages containing 3rd party binaries?

I do not believe it's possible to achieve your goal with the current --build flag and fnmatch implementation.

Currently, your only path forward is to pass multiple build flags, one for each package you need to rebuild:

  conan install ...  --build a --build b --build c

If you want to pursue the "exclusion pattern", I believe this calls for a feature request to support multiple patterns, similar to the way the exports_sources feature works in recipes:

  conan install ...  --build * --build !xyz

If the explicit listing of packages to build is insufficient for you, and you wish to pursue this as a feature request, I can label this as a feature request. Please let me know.

I think this is a duplicated of https://github.com/conan-io/conan/issues/8442. Lets close this one and follow up there, please.

Was this page helpful?
0 / 5 - 0 ratings