Saltstack Official Salt Formula
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

83 lines
2.0KB

  1. {% from "salt/map.jinja" import salt_settings with context %}
  2. {% set pygit2_settings = salt_settings.gitfs.pygit2 %}
  3. {% if pygit2_settings.git.get('require_state', False) %}
  4. include:
  5. - {{ pygit2_settings.git.require_state }}
  6. {% elif pygit2_settings.git.get('install_from_package', 'git') %}
  7. pygit2-git:
  8. pkg.installed:
  9. - name: {{ pygit2_settings.git.install_from_package }}
  10. {% endif %}
  11. {% if pygit2_settings.install_from_source %}
  12. {% set libgit2_settings = pygit2_settings.libgit2 %}
  13. {% if libgit2_settings.install_from_source %}
  14. {% set libgit2_src_dir = libgit2_settings.build_parent_dir + 'libgit2-' + libgit2_settings.version %}
  15. {% set libgit2_build_dir = libgit2_src_dir + '/_build' %}
  16. # we probably don't have a package or it's not a high enough version
  17. # install latest from source/pip
  18. pygit-deps:
  19. pkg.installed:
  20. - pkgs:
  21. - build-essential
  22. - pkg-config
  23. - python-dev
  24. - libssh-dev
  25. - libffi-dev
  26. - cmake
  27. dl-libgit2-src:
  28. archive.extracted:
  29. - name: {{ libgit2_settings.build_parent_dir }}
  30. - source: https://github.com/libgit2/libgit2/archive/v{{ libgit2_settings.version }}.tar.gz
  31. - source_hash: md5={{ libgit2_settings.download_hash }}
  32. - archive_format: tar
  33. - keep: True
  34. - if_missing: /usr/src/libgit2-{{ libgit2_settings.version }}
  35. {{ libgit2_build_dir }}:
  36. file.directory
  37. configure-libgit2:
  38. cmd.run:
  39. - name: cmake ..
  40. - cwd: {{ libgit2_build_dir }}
  41. - creates: {{ libgit2_build_dir }}/Makefile
  42. build-libgit2:
  43. cmd.run:
  44. - name: make -j4
  45. - cwd: {{ libgit2_build_dir }}
  46. - creates: {{ libgit2_build_dir }}/libgit2.so
  47. install-libgit2:
  48. cmd.run:
  49. - name: make install
  50. - cwd: {{ libgit2_build_dir }}
  51. - creates: /usr/local/lib/libgit2.so
  52. run-ldconfig-after-lib-install:
  53. cmd.run:
  54. - name: ldconfig
  55. - onchanges:
  56. - cmd: install-libgit2
  57. {% else %}
  58. {{ salt_settings.libgit2 }}:
  59. pkg.installed
  60. {% endif %}
  61. install-pygit2:
  62. pip.installed:
  63. - name: pygit2 == {{ pygit2_settings.version }}
  64. {% else %}
  65. {{ salt_settings.pygit2 }}:
  66. pkg.installed
  67. {% endif %}