doc: introduce sphinx extlinks
PATCH 1/1 doc: introduce sphinx extlinks
From: Andrea Cervesato <[email protected]>
With sphinx extlinks we are now able to avoid duplication of the github repo link inside documentation. The patch introduces two new directives which can be used: :repo: and :master:, which are used to replace repo static link and repo master static link respectively.
--- doc/conf.py | 7 ++++++- doc/developers/test_case_tutorial.rst | 5 ++--- doc/developers/writing_tests.rst | 4 ++-- doc/maintainers/ltp_release_procedure.rst | 18 ++++++++---------- doc/users/quick_start.rst | 2 +- doc/users/supported_systems.rst | 4 +++- 6 files changed, 22 insertions(+), 18 deletions(-)
doc/conf.py +6 -1
@@ -22,10 +22,15 @@ release = '1.0' extensions = [ 'linuxdoc.rstKernelDoc', - 'sphinxcontrib.spelling' + 'sphinxcontrib.spelling', + 'sphinx.ext.extlinks' ] exclude_patterns = ["html*", '_static*'] +extlinks = { + 'repo': ('https://github.com/linux-test-project/ltp/%s', '%s'), + 'master': ('https://github.com/linux-test-project/ltp/blob/master/%s', '%s') +} spelling_lang = "en_US" spelling_warning = True
doc/developers/test_case_tutorial.rst +2 -3
@@ -627,9 +627,8 @@ again on the hard-link, then ``stat`` the file". Because we are now opening a file, we need a ``cleanup`` function to close the file descriptors. We have to manually close the files to ensure the temporary -directory is deleted by the test harness (see the -https://github.com/linux-test-project/ltp/wiki/Test-Writing-Guidelines[test -writing guidelines] for details). +directory is deleted by the test harness (see the test writing guidelines for +details). As a matter of good practice, the file descriptors are closed in reverse order. In some circumstances the order which ``cleanup`` is performed is
doc/developers/writing_tests.rst +2 -2
@@ -343,11 +343,11 @@ of the stable kernel ABI, the associated test must be moved out of staging. Testing builds with GitHub Actions ---------------------------------- -Master branch is tested in `GitHub Actions <https://github.com/linux-test-project/ltp/actions>`_ +Master branch is tested in GitHub :repo:`actions` to ensure LTP builds in various distributions, including old, current and bleeding edge. ``gcc`` and ``clang`` toolchains are also tested for various architectures using cross-compilation. For a full list of tested distros, please -check ``.github/workflows/ci.yml``. +check :repo:`.github/workflows/ci.yml`. .. note::
doc/maintainers/ltp_release_procedure.rst +8 -10
@@ -44,9 +44,9 @@ Tag the git and push changes to github The string ``YYYYMMDD`` should be substituted to the current date. -You can use `tools/tag-release.sh <https://github.com/linux-test-project/ltp/blob/master/tools/tag-release.sh>`_ -script to have the above automated process. -It allows you to verify the tag before pushing it and does other checks. +You can use :master:`tools/tag-release.sh` script to have the above automated +process. It allows you to verify the tag before pushing it and does other +checks. .. code-block:: bash
@@ -121,9 +121,9 @@ metadata documentation: make -C metadata cp -v docparse/metadata.html ../metadata.YYYYMMDD.html -You can use `tools/create-tarballs-metadata.sh <https://github.com/linux-test-project/ltp/blob/master/tools/create-tarballs-metadata.sh>`_ -script to have the above procedure automated. All generated files are placed -in the ``ltp-release-YYYYMMDD`` directory. +You can use :master:`tools/create-tarballs-metadata.sh` script to have the above +procedure automated. All generated files are placed in the +``ltp-release-YYYYMMDD`` directory. .. code-block:: bash
@@ -149,10 +149,8 @@ in the ``ltp-release-YYYYMMDD`` directory. Upload the generated files to GitHub ------------------------------------ -Click on `Releases <https://github.com/linux-test-project/ltp/releases>`_, then -switch to `Tags <https://github.com/linux-test-project/ltp/tags>`_. Click on -'Add release notes'. There should be 'Attach binaries ...' link at the -bottom of the page. +Go to :repo:`tags`. Click on ``Add release notes``. +There should be ``Attach binaries ...`` link at the bottom of the page. Don't forget to upload checksums for the tarballs and metadata documentation as well.
doc/users/quick_start.rst +1 -1
@@ -24,7 +24,7 @@ Basics requirements to build LTP are the following: .. note:: - For optional library dependencies, take a look at the scripts inside ``ci/`` + For optional library dependencies, take a look at the scripts inside :master:`ci/` directory. Running single tests
doc/users/supported_systems.rst +3 -1
@@ -44,6 +44,8 @@ Oldest tested distributions - 2.17 - \- +For a full list of tested distros, please check :master:`.github/workflows/ci.yml`. + Older distributions are not officially supported, which means that it may or may not work. It all depends on your luck. It should be possible to compile latest LTP even on slightly older distributions than we
@@ -99,7 +101,7 @@ Supported C libraries - Older uClibc might have problems. * - `musl <https://musl.libc.org/>`_ - - Not yet fully supported. Check ``ci/alpine.sh`` script. + - Not yet fully supported. Check :master:`ci/alpine.sh` script. * - Android - Please use `AOSP fork <https://android.googlesource.com/platform/external/ltp>`_
Signature · 5 lines
2.35.3 -- Mailing list info: https://lists.linux.it/listinfo/ltp
Hi Andrea,
Thanks a lot, merged!
I'm a bit disappointed that such simple thing as code formatting part of the link (or whole link) is not possible, but it's a detail. Having links on single place is an improvement.
NOTE: I still need to trigger doc build manually.
...
doc/developers/test_case_tutorial.rst again on the hard-link, then ``stat`` the file". · line 631
Quoted 10 lines
+++
b/doc/developers/test_case_tutorial.rstdoc/developers/test_case_tutorial.rst +2
-3@@ -627,9 +627,8 @@ again on the hard-link, then ``stat`` the file". Because we are now opening a file, we need a ``cleanup`` function to close the file descriptors. We have to manually close the files to ensure the temporary -directory is deleted by the test harness (see the -https://github.com/linux-test-project/ltp/wiki/Test-Writing-Guidelines[test -writing guidelines] for details). +directory is deleted by the test harness (see the test writing guidelines for +details).
I dared to fix this as a link (in a separate commit):
directory is deleted by the test harness (see :doc:writing_tests for details).
Kind regards,
Petr
Signature · 1 line
Mailing list info: https://lists.linux.it/listinfo/ltp
Hi Andrea,
Quoted 3 lines
Hi Andrea,
NOTE: I still need to trigger doc build manually.
I'm sorry, this time it worked out of the box, great :). I see green "passing" in the dashboard [1].
Although I still see "Could not add webhook for "linux-test-project". Please connect your GitHub account." in project account [2].
Kind regards,
Petr
[1] https://readthedocs.org/dashboard/
[2] https://readthedocs.org/projects/linux-test-project/
Signature · 1 line
Mailing list info: https://lists.linux.it/listinfo/ltp