conan-io/conan-package-tools

generate packages for different option values

boussaffawalid opened this issue · 6 comments

Feature request

Right now if I set CONAN_BUILD_TYPES="Debug,Release" CPT will create two packages for Debug and Release build types.
However CONAN_OPTIONS does not work in the same way. I'm not sure if this is a feature or a bug.

For example, if I set CONAN_OPTIONS ="foobar:with_bar=True,foobar:with_bar=False" only one package is created.
It would be great if CPT allow creating permutations for options as well,

Environment Details

  • Conan Package Tools Version: 0.23.0
  • Operating System: Linux
  • Operation System Version: Ubuntu 16.04
  • Compiler+version: gcc-5.4
  • Docker image: conanio/gcc7
  • Conan version: conan 1.2.0
  • Python version: python 3.7.0

Hi @boussaffawalid !

Do you have a log showing your explanation? Also, I would like which env vars you are using.

Regards

@uilianries here is a minimal example to reproduce the issue
https://github.com/boussaffawalid/cpt_issue_457

@boussaffawalid Now I see your question. Unfortunately, CONAN_OPTIONS was not designed to do that, the current behavior is correct. What you want is swapping the option values, which is another case.

I recommend you customizing your ConanMultiPackager with the expected values:

from cpt.packager import ConanMultiPackager
import copy


if __name__ == "__main__":
    builder = ConanMultiPackager(options=["foo:qux=True", "foo:bar=True"])
    builder.add_common_builds()
    for item in copy.copy(builder.items):
        new_options = copy.copy(item.options)
        new_options["foo:qux"] = False
        new_options["foo:bar"] = False
        builder.add(settings=item.settings, options=new_options, env_vars=item.env_vars, build_requires=item.build_requires)
    builder.run()

@uilianries thank you, that what we are doing currently. I just thought that CPT should support this out of the box.

@boussaffawalid Your request is not bad, but inserting option values which are not explicit, are not good IMO. For instance, fPIC is only distributed as True.

I think we could add new option like CONAN_BUILD_ALL_OPTIONS=foo:qux,foo:bar which do what you need.

@uilianries I agree and think such new option will be very handy