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

[question] filtering packages with "conan list" based on an option not part of the package id #14464

Closed
1 task done
tbsuht opened this issue Aug 10, 2023 · 7 comments · Fixed by #14694
Closed
1 task done

Comments

@tbsuht
Copy link

tbsuht commented Aug 10, 2023

What is your question?

Hi,

consider gtest/1.13.0 which has an option no_main which is not part of the package_id.

No mather which value you try to filter for such an option, this will not find a package:

$ conan list "gtest/1.13.0:*" -p "options.no_main=False"
Local Cache
  gtest
    gtest/1.13.0
      revisions
        53120f2a905d958ebe9cb0dca34a2432 (2023-07-26 07:55:02 UTC)
          packages
$ conan list "gtest/1.13.0:*" -p "options.no_main=True"
Local Cache
  gtest
    gtest/1.13.0
      revisions
        53120f2a905d958ebe9cb0dca34a2432 (2023-07-26 07:55:02 UTC)
          packages

This is not obvious to someone who doesn't know the recipe:

$ conan inspect $(conan cache path gtest/1.13.0)               
default_options:
    shared: False
    fPIC: True
    build_gmock: True
    no_main: False
    hide_symbols: False
    debug_postfix: d
description: Google's C++ test framework
generators: []
homepage: https://github.com/google/googletest
label: 
license: BSD-3-Clause
name: gtest
options:
    build_gmock: True
    debug_postfix: d
    fPIC: True
    hide_symbols: False
    no_main: False
    shared: False
options_definitions:
    shared: ['True', 'False']
    fPIC: ['True', 'False']
    build_gmock: ['True', 'False']
    no_main: ['True', 'False']
    hide_symbols: ['True', 'False']
    debug_postfix: ['ANY']
package_type: None
requires: []
revision_mode: hash
settings: ['os', 'arch', 'compiler', 'build_type']
topics: ['testing', 'google-testing', 'unit-test']
url: https://github.com/conan-io/conan-center-index

Now the problem is, that this option no_main is outputted in the json output from conan create and I create filters based on this report e.g. to find a "Debug" package of a build for a debugging tool.

I have no way of removing this option from the filter creation as I can't get the info that the option is not part of the package_id.
How to deal with this situation?

Have you read the CONTRIBUTING guide?

  • I've read the CONTRIBUTING guide
@memsharded
Copy link
Member

Hi @tbsuht

Thanks for your question.
While I understand what you are describing, I am not sure what could be done here, beyond trying to clarify expectations.

The conan list command only has the conaninfo.txt information, that will not contain anything about removed options. It is basically impossible to know if that option was removed or never existed, because the evaluation of the recipes cannot happen in conan list, as there are no profiles at all, no evaluation of the graph at all.

Let's say that we decide to ignore inputs to conan list that are not listed in the conaninfo.txt, then every typo like build_tipe=xxx would be simply ignored, but it is not possible to validate the input, or even warn, because it can be very noisy. Do we want to ignore the inputs even if no validation will happen?

@tbsuht
Copy link
Author

tbsuht commented Aug 11, 2023

Hi @memsharded

Is it possible to extend the information in conaninfo.txt?
Either about what the package_id is composed of or what has been removed from the standard set of attributes used for package_id?

Let's say that we decide to ignore inputs to conan list that are not listed in the conaninfo.txt, then every typo like build_tipe=xxx would be simply ignored, but it is not possible to validate the input, or even warn, because it can be very noisy. Do we want to ignore the inputs even if no validation will happen?

If the info about the removed attributes would be available then we could 1) show a warning if an attribute is used, which is not a option/setting/... and 2) ignore it if it was removed from the package_id.

@memsharded
Copy link
Member

Is it possible to extend the information in conaninfo.txt?

I am afraid this is impossible. In Conan 2.0, the conaninfo.txt is exactly the package_id. The package_id is now computing hashing the file, directly. Nothing can be added that is not part of the package_id, and in this case, these options are not part of the package_id, so not possible to add anything regarding to those options.

@tbsuht
Copy link
Author

tbsuht commented Aug 11, 2023

Is it possible to easily query the conaninfo.txt? At least for my usecase I could remove such options from the query if not part of the conaninfo.txt.

@memsharded
Copy link
Member

the conan cache path pkg/version:package_id (you can add revisions too) will give you the path to the folder containing the conaninfo.txt. We don't have a public interface to read it, but it is shouldn't be too complicated. However this looks like too ad-hoc, maybe we still want to discuss the possibility above, I keep the "Look-into" label to discuss it with the team.

@tbsuht
Copy link
Author

tbsuht commented Aug 11, 2023

Ok then this also not really an alternative for me as I need to provide a package_id for conan cache path, but I'm actually searching for a package.

I keep the "Look-into" label to discuss it with the team.

Thanks!

@memsharded
Copy link
Member

Implemented in #14694, will be released next 2.0.15

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants