本文档翻译自:https://docs.conan.io/en/latest/reference/commands/output/search.html

    :::success Warning
    这是一项实验性功能,可能会在将来的发行版中进行重大更改。 :::

    conan search 提供--json参数来生成包含搜索过程信息的文件。
    输出JSON包含两个第一级密钥:

    • error:如果上传完成没有错误,则为True,否则为False。
    • results:包含软件包的遥控器列表。 每个元素包含:
      • remote:远端名称。
      • items:在该遥控器中找到的项目列表。 对于每个项目,总会有一个配方,还可以在搜索时打包。
        • recipe:代表上载配方的文档。
          • id:参考,例如“ openssl / 1.0.2u”
        • packages:代表为配方找到的二进制包的元素列表。
          • id:包ID,例如“ 8018a4df6e7d2b4630a814fa40c81b85b9182d2b”
          • options:软件包选项的字典。
          • settings:字典与包的设置。
          • require:软件包的需求列表。
          • outdated:布尔值,用于显示包装是否已从配方中过期。



    Examples:
    在所有远程服务器中搜索引用: conan search eigen* -r all

    1. {
    2. "error": false,
    3. "results": [{
    4. "remote": "conan-center",
    5. "items": [{
    6. "recipe": {
    7. "id": "eigen/3.3.4@conan/stable"
    8. }
    9. }, {
    10. "recipe": {
    11. "id": "eigen/3.3.5@conan/stable"
    12. }
    13. }, {
    14. "recipe": {
    15. "id": "eigen/3.3.7"
    16. }
    17. }, {
    18. "recipe": {
    19. "id": "eigen/3.3.7@conan/stable"
    20. }
    21. }]
    22. }, {
    23. "remote": "conan-community",
    24. "items": [{
    25. "recipe": {
    26. "id": "eigen/3.3.4@conan/stable"
    27. }
    28. }, {
    29. "recipe": {
    30. "id": "eigen/3.3.5@conan/stable"
    31. }
    32. }, {
    33. "recipe": {
    34. "id": "eigen/3.3.7@conan/stable"
    35. }
    36. }]
    37. }]
    38. }

    在远程中搜索引用的软件包:conan search paho-c/1.2.0@conan/stable -r conan-center --json search.json

    1. {
    2. "error":false,
    3. "results":[
    4. {
    5. "remote":"conan-center",
    6. "items":[
    7. {
    8. "recipe":{
    9. "id":"paho-c/1.2.0@conan/stable"
    10. },
    11. "packages":[
    12. {
    13. "id":"0000193ac313953e78a4f8e82528100030ca70ee",
    14. "options":{
    15. "shared":"False",
    16. "asynchronous":"False",
    17. "SSL":"False"
    18. },
    19. "settings":{
    20. "os":"Linux",
    21. "arch":"x86_64",
    22. "compiler":"gcc",
    23. "build_type":"Debug",
    24. "compiler.version":"4.9"
    25. },
    26. "requires":[
    27. ],
    28. "outdated":false
    29. },
    30. {
    31. "id":"014be746b283391f79d11e4e8af3154344b58223",
    32. "options":{
    33. "shared":"False",
    34. "asynchronous":"False",
    35. "SSL":"False"
    36. },
    37. "settings":{
    38. "os":"Windows",
    39. "compiler.threads":"posix",
    40. "compiler.exception":"seh",
    41. "arch":"x86_64",
    42. "compiler":"gcc",
    43. "build_type":"Debug",
    44. "compiler.version":"5"
    45. },
    46. "requires":[
    47. ],
    48. "outdated":false
    49. },
    50. {
    51. "id":"0188020dbfd167611b967ad2fa0e30710d23e920",
    52. "options":{
    53. "shared":"True",
    54. "asynchronous":"False",
    55. "SSL":"False"
    56. },
    57. "settings":{
    58. "os":"Macos",
    59. "arch":"x86_64",
    60. "compiler":"apple-clang",
    61. "build_type":"Debug",
    62. "compiler.version":"9.1"
    63. },
    64. "requires":[
    65. ],
    66. "outdated":false
    67. },
    68. {
    69. "id":"03369b0caf8c0c8d4bb84d5136112596bde4652d",
    70. "options":{
    71. "shared":"True",
    72. "asynchronous":"False",
    73. "SSL":"False"
    74. },
    75. "settings":{
    76. "os":"Linux",
    77. "arch":"x86",
    78. "compiler":"gcc",
    79. "build_type":"Release",
    80. "compiler.version":"5"
    81. },
    82. "requires":[
    83. ],
    84. "outdated":false
    85. }
    86. ]
    87. }
    88. ]
    89. }
    90. ]
    91. }

    在本地缓存中搜索引用:conan search paho-c* --json search.json

    1. {
    2. "error":false,
    3. "results":[
    4. {
    5. "remote":"None",
    6. "items":[
    7. {
    8. "recipe":{
    9. "id":"paho-c/1.2.0@danimtb/testing"
    10. }
    11. }
    12. ]
    13. }
    14. ]
    15. }

    在本地缓存中搜索引用的软件包:**conan search paho-c/1.2.0@danimtb/testing --json search.json**

    1. {
    2. "error":false,
    3. "results":[
    4. {
    5. "remote":"None",
    6. "items":[
    7. {
    8. "recipe":{
    9. "id":"paho-c/1.2.0@danimtb/testing"
    10. },
    11. "packages":[
    12. {
    13. "id":"6cc50b139b9c3d27b3e9042d5f5372d327b3a9f7",
    14. "options":{
    15. "SSL":"False",
    16. "asynchronous":"False",
    17. "shared":"False"
    18. },
    19. "settings":{
    20. "arch":"x86_64",
    21. "build_type":"Release",
    22. "compiler":"Visual Studio",
    23. "compiler.runtime":"MD",
    24. "compiler.version":"15",
    25. "os":"Windows"
    26. },
    27. "requires":[
    28. ],
    29. "outdated":false
    30. },
    31. {
    32. "id":"95cd13dfc3f6b80d3ccb2a38441e3a1ad88e5a15",
    33. "options":{
    34. "SSL":"False",
    35. "asynchronous":"True",
    36. "shared":"True"
    37. },
    38. "settings":{
    39. "arch":"x86_64",
    40. "build_type":"Release",
    41. "compiler":"Visual Studio",
    42. "compiler.runtime":"MD",
    43. "compiler.version":"15",
    44. "os":"Windows"
    45. },
    46. "requires":[
    47. ],
    48. "outdated":true
    49. },
    50. {
    51. "id":"970e773c5651dc2560f86200a4ea56c23f568ff9",
    52. "options":{
    53. "SSL":"False",
    54. "asynchronous":"False",
    55. "shared":"True"
    56. },
    57. "settings":{
    58. "arch":"x86_64",
    59. "build_type":"Release",
    60. "compiler":"Visual Studio",
    61. "compiler.runtime":"MD",
    62. "compiler.version":"15",
    63. "os":"Windows"
    64. },
    65. "requires":[
    66. ],
    67. "outdated":true
    68. },
    69. {
    70. "id":"c4c0a49b09575515ce1dd9841a48de0c508b9d7c",
    71. "options":{
    72. "SSL":"True",
    73. "asynchronous":"False",
    74. "shared":"True"
    75. },
    76. "settings":{
    77. "arch":"x86_64",
    78. "build_type":"Release",
    79. "compiler":"Visual Studio",
    80. "compiler.runtime":"MD",
    81. "compiler.version":"15",
    82. "os":"Windows"
    83. },
    84. "requires":[
    85. "openssl/1.0.2n@conan/stable:606fdb601e335c2001bdf31d478826b644747077",
    86. "zlib/1.2.11@conan/stable:6cc50b139b9c3d27b3e9042d5f5372d327b3a9f7"
    87. ],
    88. "outdated":true
    89. },
    90. {
    91. "id":"db9d6ba7004592ed2598f2c369484d4a01269110",
    92. "options":{
    93. "SSL":"True",
    94. "asynchronous":"False",
    95. "shared":"True"
    96. },
    97. "settings":{
    98. "arch":"x86_64",
    99. "build_type":"Release",
    100. "compiler":"gcc",
    101. "compiler.exception":"seh",
    102. "compiler.threads":"posix",
    103. "compiler.version":"7",
    104. "os":"Windows"
    105. },
    106. "requires":[
    107. "openssl/1.0.2n@conan/stable:f761d91cef7988eafb88c6b6179f4cf261609f26",
    108. "zlib/1.2.11@conan/stable:6dc82da13f94df549e60f9c1ce4c5d11285a4dff"
    109. ],
    110. "outdated":true
    111. }
    112. ]
    113. }
    114. ]
    115. }
    116. ]
    117. }