maint.rst 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369
  1. CMake Maintainer Guide
  2. **********************
  3. The following is a guide to CMake maintenance processes.
  4. See documentation on `CMake Development`_ for more information.
  5. .. _`CMake Development`: README.rst
  6. .. contents:: Maintainer Processes:
  7. Review a Merge Request
  8. ======================
  9. The `CMake Review Process`_ requires a maintainer to issue the ``Do: merge``
  10. command to integrate a merge request. Please check at least the following:
  11. * If the MR source branch (or part of it) should be backported
  12. to the ``release`` branch (and is already based on a commit
  13. contained in the ``release`` branch), add a ``Backport: release`` or
  14. ``Backport: release:<commit-ish>`` trailing line to the MR description.
  15. * If the MR source branch is not named well for the change it makes
  16. (e.g. it is just ``master`` or the patch changed during review),
  17. add a ``Topic-rename: <topic>`` trailing line to the MR description
  18. to provide a better topic name.
  19. * If the MR introduces a new feature or a user-facing behavior change,
  20. such as a policy, ensure that a ``Help/release/dev/$topic.rst`` file
  21. is added with a release note.
  22. * If a commit changes a specific area, such as a module, its commit
  23. message should have an ``area:`` prefix on its first line.
  24. * If a commit fixes a tracked issue, its commit message should have
  25. a trailing line such as ``Fixes: #00000``.
  26. * Ensure that the MR adds sufficient documentation and test cases.
  27. * Ensure that the MR has been tested sufficiently. Typically it should
  28. be staged for nightly testing with ``Do: stage``. Then manually
  29. review the `CMake CDash Page`_ to verify that no regressions were
  30. introduced. (Learn to tolerate spurious failures due to idiosyncrasies
  31. of various nightly builders.)
  32. * Ensure that the MR targets the ``master`` branch. A MR intended for
  33. the ``release`` branch should be based on ``release`` but still target
  34. ``master``. Use the above-mentioned ``Backport: release`` line to tell
  35. ``Do: merge`` to merge to both. If a MR is merged without the backport
  36. line, a maintainer may still merge the MR topic to ``release`` manually.
  37. Maintain Current Release
  38. ========================
  39. The ``release`` branch is used to maintain the current release or release
  40. candidate. The branch is published with no version number but maintained
  41. using a local branch named ``release-$ver``, where ``$ver`` is the version
  42. number of the current release in the form ``$major.$minor``. It is always
  43. merged into ``master`` before publishing.
  44. To merge an open MR to the ``release`` branch, edit its description to
  45. use the ``Backport: release`` line mentioned above and then ``Do: merge``
  46. normally. To update the ``release`` branch manually (e.g. to merge a
  47. ``$topic`` branch that was merged without the backport line), use the
  48. following procedure.
  49. Before merging a ``$topic`` branch into ``release``, verify that the
  50. ``$topic`` branch has already been merged to ``master`` via the usual
  51. ``Do: merge`` process. Then, to merge the ``$topic`` branch into
  52. ``release``, start by creating the local branch:
  53. .. code-block:: shell
  54. git fetch origin
  55. git checkout -b release-$ver origin/release
  56. Merge the ``$topic`` branch into the local ``release-$ver`` branch, making
  57. sure to include a ``Merge-request: !xxxx`` footer in the commit message:
  58. .. code-block:: shell
  59. git merge --no-ff $topic
  60. Merge the ``release-$ver`` branch to ``master``:
  61. .. code-block:: shell
  62. git checkout master
  63. git pull
  64. git merge --no-ff release-$ver
  65. Review new ancestry to ensure nothing unexpected was merged to either branch:
  66. .. code-block:: shell
  67. git log --graph --boundary origin/master..master
  68. git log --graph --boundary origin/release..release-$ver
  69. Publish both ``master`` and ``release`` simultaneously:
  70. .. code-block:: shell
  71. git push --atomic origin master release-$ver:release
  72. .. _`CMake Review Process`: review.rst
  73. .. _`CMake CDash Page`: https://open.cdash.org/index.php?project=CMake
  74. Create Release Version
  75. ======================
  76. When the ``release`` branch is ready to create a new release, follow the
  77. steps in the above `Maintain Current Release`_ section to checkout a local
  78. ``release-$ver`` branch, where ``$ver`` is the version number of the
  79. current release in the form ``$major.$minor``.
  80. Edit ``Source/CMakeVersion.cmake`` to set the full version:
  81. .. code-block:: cmake
  82. # CMake version number components.
  83. set(CMake_VERSION_MAJOR $major)
  84. set(CMake_VERSION_MINOR $minor)
  85. set(CMake_VERSION_PATCH $patch)
  86. #set(CMake_VERSION_RC $rc) # uncomment for release candidates
  87. In the following we use the placeholder ``$fullver`` for the full version
  88. number of the new release with the form ``$major.$minor.$patch[-rc$rc]``.
  89. If the version is not a release candidate, comment out the RC version
  90. component above and leave off the ``-rc$rc`` suffix from ``$fullver``.
  91. Commit the release version with the **exact** message ``CMake $fullver``:
  92. .. code-block:: shell
  93. git commit -m "CMake $fullver"
  94. Tag the release using an annotated tag with the same message as the
  95. commit and named with the **exact** form ``v$fullver``:
  96. .. code-block:: shell
  97. git tag -s -m "CMake $fullver" "v$fullver"
  98. Follow the steps in the above `Maintain Current Release`_ section to
  99. merge the ``release-$ver`` branch into ``master`` and publish both.
  100. Branch a New Release
  101. ====================
  102. This section covers how to start a new ``release`` branch for a major or
  103. minor version bump (patch releases remain on their existing branch).
  104. In the following we use the placeholder ``$ver`` to represent the
  105. version number of the new release with the form ``$major.$minor``,
  106. and ``$prev`` to represent the version number of the prior release.
  107. Review Prior Release
  108. --------------------
  109. Review the history around the prior release branch:
  110. .. code-block:: shell
  111. git log --graph --boundary \
  112. ^$(git rev-list --grep="Merge topic 'doc-.*-relnotes'" -n 1 master)~1 \
  113. $(git rev-list --grep="Begin post-.* development" -n 1 master) \
  114. $(git tag --list *-rc1| tail -1)
  115. Consolidate Release Notes
  116. -------------------------
  117. Starting from a clean work tree on ``master``, create a topic branch to
  118. use for consolidating the release notes:
  119. .. code-block:: shell
  120. git checkout -b doc-$ver-relnotes
  121. Run the `consolidate-relnotes.bash`_ script:
  122. .. code-block:: shell
  123. Utilities/Release/consolidate-relnotes.bash $ver $prev
  124. .. _`consolidate-relnotes.bash`: ../../Utilities/Release/consolidate-relnotes.bash
  125. This moves notes from the ``Help/release/dev/*.rst`` files into a versioned
  126. ``Help/release/$ver.rst`` file and updates ``Help/release/index.rst`` to
  127. link to the new document. Commit the changes with a message such as::
  128. Help: Consolidate $ver release notes
  129. Run the `Utilities/Release/consolidate-relnotes.bash` script to move
  130. notes from `Help/release/dev/*` into `Help/release/$ver.rst`.
  131. Manually edit ``Help/release/$ver.rst`` to add section headers, organize
  132. the notes, and revise wording. Then commit with a message such as::
  133. Help: Organize and revise $ver release notes
  134. Add section headers similar to the $prev release notes and move each
  135. individual bullet into an appropriate section. Revise a few bullets.
  136. Update Sphinx ``versionadded`` directives in documents added since
  137. the previous release by running the `update_versions.py`_ script:
  138. .. code-block:: shell
  139. Utilities/Sphinx/update_versions.py --since v$prev.0 --overwrite
  140. .. _`update_versions.py`: ../../Utilities/Sphinx/update_versions.py
  141. Commit the changes with a message such as::
  142. Help: Update Sphinx versionadded directives for $ver release
  143. Run the script:
  144. Utilities/Sphinx/update_versions.py --since v$prev.0 --overwrite
  145. Open a merge request with the ``doc-$ver-relnotes`` branch for review
  146. and integration. Further steps may proceed after this has been merged
  147. to ``master``.
  148. Update 'release' Branch
  149. -----------------------
  150. Starting from a clean work tree on ``master``, create a new ``release-$ver``
  151. branch locally:
  152. .. code-block:: shell
  153. git checkout -b release-$ver origin/master
  154. Remove the development branch release note infrastructure:
  155. .. code-block:: shell
  156. git rm Help/release/dev/0-sample-topic.rst
  157. sed -i '/^\.\. include:: dev.txt/ {N;d}' Help/release/index.rst
  158. Commit with a message such as::
  159. Help: Drop development topic notes to prepare release
  160. Release versions do not have the development topic section of
  161. the CMake Release Notes index page.
  162. Update ``.gitlab-ci.yml`` to drop the upload jobs from the
  163. packaging pipeline by renaming them to start in ``.``:
  164. .. code-block:: shell
  165. sed -i 's/^u:/.u:/' .gitlab-ci.yml
  166. Commit with a message such as::
  167. gitlab-ci: Drop package pipeline upload jobs for release branch
  168. The package pipeline for release versions should not upload packages
  169. automatically to our archive of nightly development versions.
  170. Update ``Source/CMakeVersion.cmake`` to set the version to
  171. ``$major.$minor.0-rc0``:
  172. .. code-block:: cmake
  173. # CMake version number components.
  174. set(CMake_VERSION_MAJOR $major)
  175. set(CMake_VERSION_MINOR $minor)
  176. set(CMake_VERSION_PATCH 0)
  177. set(CMake_VERSION_RC 0)
  178. Replace uses of ``DEVEL_CMAKE_VERSION`` in the source tree with
  179. the literal release version number string ``"$major.$minor.0"``:
  180. .. code-block:: shell
  181. $EDITOR $(git grep -l DEVEL_CMAKE_VERSION)
  182. Commit with a message such as::
  183. Begin $ver release versioning
  184. Merge the ``release-$ver`` branch to ``master``:
  185. .. code-block:: shell
  186. git checkout master
  187. git pull
  188. git merge --no-ff release-$ver
  189. Begin post-release development by restoring the development branch release
  190. note infrastructure, the nightly package pipeline upload jobs, and
  191. the version date from ``origin/master``:
  192. .. code-block:: shell
  193. git checkout origin/master -- \
  194. Source/CMakeVersion.cmake Help/release/dev/0-sample-topic.rst
  195. sed -i $'/^Releases/ i\\\n.. include:: dev.txt\\\n' Help/release/index.rst
  196. sed -i 's/^\.u:/u:/' .gitlab-ci.yml
  197. Update ``Source/CMakeVersion.cmake`` to set the version to
  198. ``$major.$minor.$date``:
  199. .. code-block:: cmake
  200. # CMake version number components.
  201. set(CMake_VERSION_MAJOR $major)
  202. set(CMake_VERSION_MINOR $minor)
  203. set(CMake_VERSION_PATCH $date)
  204. #set(CMake_VERSION_RC 0)
  205. Commit with a message such as::
  206. Begin post-$ver development
  207. Push the update to the ``master`` and ``release`` branches:
  208. .. code-block:: shell
  209. git push --atomic origin master release-$ver:release
  210. Announce 'release' Branch
  211. -------------------------
  212. Post a topic to the `CMake Discourse Forum Development Category`_
  213. announcing that post-release development is open::
  214. I've branched `release` for $ver. The repository is now open for
  215. post-$ver development. Please rebase open merge requests on `master`
  216. before staging or merging.
  217. .. _`CMake Discourse Forum Development Category`: https://discourse.cmake.org/c/development
  218. Initial Post-Release Development
  219. --------------------------------
  220. Deprecate policies more than 8 release series old by updating the
  221. policy range check in ``cmMakefile::SetPolicy``.
  222. Commit with a message such as::
  223. Add deprecation warnings for policies CMP#### and below
  224. The OLD behaviors of all policies are deprecated, but only by
  225. documentation. Add an explicit deprecation diagnostic for policies
  226. introduced in CMake $OLDVER and below to encourage projects to port
  227. away from setting policies to OLD.
  228. Update the ``cmake_policy`` version range generated by ``install(EXPORT)``
  229. in ``cmExportFileGenerator::GeneratePolicyHeaderCode`` to end at the
  230. previous release. We use one release back since we now know all the
  231. policies added for that version. Commit with a message such as::
  232. export: Increase maximum policy version in exported files to $prev
  233. The files generatd by `install(EXPORT)` and `export()` commands
  234. are known to work with policies as of CMake $prev, so enable them
  235. in sufficiently new CMake versions.
  236. Update the ``cmake_minimum_required`` version range in CMake itself:
  237. * ``CMakeLists.txt``
  238. * ``Utilities/Doxygen/CMakeLists.txt``
  239. * ``Utilities/Sphinx/CMakeLists.txt``
  240. to end in the previous release. Commit with a message such as::
  241. Configure CMake itself with policies through CMake $prev