files-v1.rst 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159
  1. File Table v1
  2. *************
  3. The set of package files distributed on ``cmake.org`` varies by CMake version.
  4. One file, named ``cmake-<ver>-files-v1.json``, contains a table of the package
  5. files available for a given version. Clients may use this to find other files.
  6. Format
  7. ------
  8. The format is a JSON object:
  9. .. code-block:: json
  10. {
  11. "version": {
  12. "major": 3, "minor": 18, "patch": 6,
  13. "string": "3.18.6"
  14. },
  15. "files": [
  16. {
  17. "os": ["...", "..."],
  18. "architecture": ["...", "..."],
  19. "class": "...",
  20. "name": "..."
  21. }
  22. ],
  23. "hashFiles": [
  24. {
  25. "algorithm": ["...", "..."],
  26. "name": "cmake-<version>-<algo>.txt",
  27. "signature": ["cmake-<version>-<algo>.txt.asc"]
  28. }
  29. ]
  30. }
  31. The members are:
  32. ``version``
  33. A JSON object specifying the version of CMake with members:
  34. ``major``, ``minor``, ``patch``
  35. Integer values specifying the major, minor, and patch version components.
  36. ``suffix``
  37. A string specifying the version suffix, if any, e.g. ``rc1``.
  38. ``string``
  39. A string specifying the full version in the format
  40. ``<major>.<minor>.<patch>[-<suffix>]``.
  41. ``files``
  42. A JSON array of entries corresponding to available package files.
  43. Each entry is a JSON object containing members:
  44. ``os``
  45. A JSON array of strings naming the operating system for which the
  46. package file is built, possibly using multiple alternative spellings.
  47. Possible names include:
  48. ``source``
  49. Source packages.
  50. ``Linux``, ``linux``
  51. Linux packages.
  52. ``macOS``, ``macos``
  53. macOS packages.
  54. ``Windows``, ``windows``
  55. Windows packages.
  56. ``architecture``
  57. A JSON array of strings naming the architecture(s) for which the
  58. package file is built, possibly using multiple alternative spellings.
  59. Source packages have an empty list of architectures (``[]``).
  60. Binary packages have a non-empty list of architectures, with at least
  61. one name matching the output of ``uname -m`` on corresponding hosts.
  62. On Windows, architecture names include ``x86_64`` and ``i386``.
  63. On macOS, universal binary packages list all architectures,
  64. e.g. ``["arm64","x86_64"]``.
  65. ``class``
  66. A JSON string naming the class of package. The value is one of:
  67. ``archive``
  68. A tarball or zip archive.
  69. The extension, such as ``.tar.gz`` or ``.zip``, indicates the format.
  70. The rest of the file name matches the top-level directory in the archive.
  71. ``installer``
  72. An interactive installer.
  73. ``volume``
  74. A disk image (``.dmg`` on macOS).
  75. ``name``
  76. A JSON string specifying the name of the package file.
  77. ``macOSmin``
  78. Optional member that is present on package files for macOS.
  79. The value is a JSON string specifying the minimum version of macOS
  80. required to run the binary, e.g. ``"10.10"``.
  81. ``hashFiles``
  82. A JSON array of entries corresponding to files containing cryptographic
  83. hashes of the package file contents. Each entry is a JSON object
  84. containing members:
  85. ``algorithm``
  86. A JSON array of strings naming a cryptographic hash algorithm, possibly
  87. using multiple alternative spellings, e.g. ``["sha256", "SHA-256"]``.
  88. ``name``
  89. A JSON string specifying the name of the file containing hashes,
  90. e.g. ``"cmake-<version>-SHA-256.txt"``.
  91. ``signature``
  92. A JSON array of strings naming files containing a cryptographic
  93. signature of the hash file specified by ``name``, e.g.
  94. ``["cmake-<version>-SHA-256.txt.asc"]``.
  95. The table and hash files are generated by `files.bash`_ from
  96. the `files-v1.json.in`_ template and the package files themselves.
  97. .. _`files.bash`: files.bash
  98. .. _`files-v1.json.in`: files-v1.json.in
  99. Queries
  100. -------
  101. Clients may download the `File Table v1`_ file ``cmake-<ver>-files-v1.json``
  102. and query it to get the name(s) of specific package files adjacent to it.
  103. Make queries as specific as possible in order to account for additional
  104. alternative binaries in future CMake versions.
  105. For example, one may use ``jq`` queries:
  106. * To select a Windows binary archive supporting ``x86_64`` hosts::
  107. .files[] | select((.os[] | . == "windows") and
  108. (.architecture[] | . == "x86_64") and
  109. (.class == "archive")) | .name
  110. * To select a Linux binary archive supporting ``x86_64`` hosts::
  111. .files[] | select((.os[] | . == "linux") and
  112. (.architecture[] | . == "x86_64") and
  113. (.class == "archive")) | .name
  114. * To select a macOS binary archive supporting ``arm64`` hosts::
  115. .files[] | select((.os[] | . == "macos") and
  116. (.architecture[] | . == "arm64") and
  117. (.class == "archive")) | .name
  118. * To select a SHA-256 hash file::
  119. .hashFiles[] | select(.algorithm[] | . == "SHA-256") | .name