rtm_asdf.rst 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122
  1. ==================
  2. Runtime Management
  3. ==================
  4. The runtimes are managed with asdf and are activated in this project via the
  5. `.tool-versions <.tool-versions>`_. If you have not yet installed asdf_, then
  6. chapter :ref:`introduce asdf` may be of help to you.
  7. .. contents::
  8. :depth: 2
  9. :local:
  10. :backlinks: entry
  11. Get started
  12. ===========
  13. If you have asdf installed you can install the runtimes of this project by:
  14. .. code:: bash
  15. $ cd /path/to/searxng
  16. $ asdf install # will install runtimes listed in .tool-versions
  17. ...
  18. Manage Versions
  19. ===============
  20. If you want to perform a ``test`` with special runtime versions of nodejs,
  21. python or shellcheck, you can patch the ``.tool-versions``:
  22. .. code:: diff
  23. --- a/.tool-versions
  24. +++ b/.tool-versions
  25. @@ -1,2 +1,2 @@
  26. -python 3.12.0
  27. -shellcheck 0.9.0
  28. +python 3.11.6
  29. +shellcheck 0.8.0
  30. To install use ``asdf install`` again. If the runtime tools have changed, any
  31. existing (nodejs and python) environments should be cleaned up with a ``make
  32. clean``.
  33. .. code:: bash
  34. $ asdf install
  35. ...
  36. $ make clean test
  37. .. _introduce asdf:
  38. Introduce asdf
  39. ==============
  40. To `download asdf`_ and `install asdf`_:
  41. .. code:: bash
  42. $ git clone https://github.com/asdf-vm/asdf.git ~/.asdf --branch <version>
  43. $ echo '. "$HOME/.asdf/asdf.sh"' >> ~/.bashrc
  44. $ echo '. "$HOME/.asdf/completions/asdf.bash"' >> ~/.bashrc
  45. Start a new shell and try to `install plugins`_:
  46. .. code:: bash
  47. $ asdf plugin-list-all | grep -E '(golang|python|nodejs|shellcheck).git'
  48. golang https://github.com/asdf-community/asdf-golang.git
  49. nodejs https://github.com/asdf-vm/asdf-nodejs.git
  50. python https://github.com/danhper/asdf-python.git
  51. shellcheck https://github.com/luizm/asdf-shellcheck.git
  52. $ asdf plugin add golang https://github.com/asdf-community/asdf-golang.git
  53. $ asdf plugin add nodejs https://github.com/asdf-vm/asdf-nodejs.git
  54. $ asdf plugin add python https://github.com/danhper/asdf-python.git
  55. $ asdf plugin add shellcheck https://github.com/luizm/asdf-shellcheck.git
  56. Each plugin has dependencies, to compile runtimes visit the URLs from above and
  57. look out for the dependencies you need to install on your OS, on Debian for the
  58. runtimes listed above you will need:
  59. .. code:: bash
  60. $ sudo apt update
  61. $ sudo apt install \
  62. dirmngr gpg curl gawk coreutils build-essential libssl-dev zlib1g-dev \
  63. libbz2-dev libreadline-dev libsqlite3-dev \
  64. libncursesw5-dev xz-utils tk-dev libxml2-dev libxmlsec1-dev libffi-dev liblzma-dev
  65. With dependencies installed you can install/compile runtimes:
  66. .. code:: bash
  67. $ asdf install golang latest
  68. $ asdf install nodejs latest
  69. $ asdf install python latest
  70. $ asdf install shellcheck latest
  71. Python will be compiled and will take a while.
  72. In the repository the version is defined in `.tool-versions`_. Outside the
  73. repository, its recommended that the runtime should use the versions of the OS
  74. (`Fallback to System Version`_) / if not already done register the system
  75. versions global:
  76. .. code:: bash
  77. $ cd /
  78. $ asdf global golang system
  79. $ asdf global nodejs system
  80. $ asdf global python system
  81. $ asdf global shellcheck system
  82. .. _asdf: https://asdf-vm.com/
  83. .. _download asdf: https://asdf-vm.com/guide/getting-started.html#_2-download-asdf
  84. .. _install asdf: https://asdf-vm.com/guide/getting-started.html#_3-install-asdf
  85. .. _install plugins: https://asdf-vm.com/guide/getting-started.html#install-the-plugin
  86. .. _Fallback to System Version: https://asdf-vm.com/manage/versions.html#fallback-to-system-version