2015-03-26 03:52:29 +01:00
|
|
|
{% from "salt/map.jinja" import salt_settings with context %}
|
2015-08-20 06:46:49 +02:00
|
|
|
{% set pygit2_settings = salt_settings.gitfs.pygit2 %}
|
2015-03-26 03:52:29 +01:00
|
|
|
|
2015-06-05 22:27:01 +02:00
|
|
|
git:
|
|
|
|
pkg.installed
|
|
|
|
|
2015-08-20 06:46:49 +02:00
|
|
|
{% if pygit2_settings.install_from_source %}
|
|
|
|
{% set libgit2_settings = pygit2_settings.libgit2 %}
|
|
|
|
|
|
|
|
{% if libgit2_settings.install_from_source %}
|
|
|
|
{% set libgit2_src_dir = libgit2_settings.build_parent_dir + 'libgit2-' + libgit2_settings.version %}
|
|
|
|
{% set libgit2_build_dir = libgit2_src_dir + '/_build' %}
|
|
|
|
|
2015-03-26 03:52:29 +01:00
|
|
|
# we probably don't have a package or it's not a high enough version
|
|
|
|
# install latest from source/pip
|
|
|
|
pygit-deps:
|
|
|
|
pkg.installed:
|
|
|
|
- pkgs:
|
|
|
|
- build-essential
|
|
|
|
- python-dev
|
|
|
|
- libssh-dev
|
|
|
|
- libffi-dev
|
|
|
|
- cmake
|
|
|
|
|
|
|
|
dl-libgit2-src:
|
|
|
|
archive.extracted:
|
2015-08-20 06:46:49 +02:00
|
|
|
- name: {{ libgit2_settings.build_parent_dir }}
|
|
|
|
- source: https://github.com/libgit2/libgit2/archive/v{{ libgit2_settings.version }}.tar.gz
|
|
|
|
- source_hash: md5={{ libgit2_settings.download_hash }}
|
2015-03-26 03:52:29 +01:00
|
|
|
- archive_format: tar
|
|
|
|
- keep: True
|
2015-08-20 06:46:49 +02:00
|
|
|
- if_missing: /usr/src/libgit2-{{ libgit2_settings.version }}
|
2015-03-26 03:52:29 +01:00
|
|
|
|
2015-08-20 06:46:49 +02:00
|
|
|
{{ libgit2_build_dir }}:
|
2015-03-26 03:52:29 +01:00
|
|
|
file.directory
|
|
|
|
|
|
|
|
configure-libgit2:
|
|
|
|
cmd.run:
|
|
|
|
- name: cmake ..
|
2015-08-20 06:46:49 +02:00
|
|
|
- cwd: {{ libgit2_build_dir }}
|
|
|
|
- creates: {{ libgit2_build_dir }}/Makefile
|
2015-03-26 03:52:29 +01:00
|
|
|
|
|
|
|
build-libgit2:
|
|
|
|
cmd.run:
|
|
|
|
- name: make -j4
|
2015-08-20 06:46:49 +02:00
|
|
|
- cwd: {{ libgit2_build_dir }}
|
|
|
|
- creates: {{ libgit2_build_dir }}/libgit2.so
|
2015-03-26 03:52:29 +01:00
|
|
|
|
|
|
|
install-libgit2:
|
|
|
|
cmd.run:
|
|
|
|
- name: make install
|
2015-08-20 06:46:49 +02:00
|
|
|
- cwd: {{ libgit2_build_dir }}
|
2015-03-26 03:52:29 +01:00
|
|
|
- creates: /usr/local/lib/libgit2.so
|
|
|
|
|
|
|
|
run-ldconfig-after-lib-install:
|
|
|
|
cmd.run:
|
|
|
|
- name: ldconfig
|
|
|
|
- onchanges:
|
|
|
|
- cmd: install-libgit2
|
|
|
|
|
2015-08-20 06:46:49 +02:00
|
|
|
{% else %}
|
|
|
|
{{ salt_settings.libgit2 }}:
|
|
|
|
pkg.installed
|
|
|
|
|
|
|
|
{% endif %}
|
|
|
|
|
2015-03-26 03:52:29 +01:00
|
|
|
install-pygit2:
|
|
|
|
pip.installed:
|
2015-08-20 06:46:49 +02:00
|
|
|
- name: pygit2 == {{ pygit2_settings.version }}
|
2015-03-26 03:52:29 +01:00
|
|
|
|
|
|
|
{% else %}
|
2015-06-02 21:40:53 +02:00
|
|
|
{{ salt_settings.pygit2 }}:
|
|
|
|
pkg.installed
|
2015-03-26 03:52:29 +01:00
|
|
|
|
|
|
|
{% endif %}
|