From 4533cc7d0eb95a1f437e14180ea689b1d761e08c Mon Sep 17 00:00:00 2001 From: Brian Jackson Date: Wed, 25 Mar 2015 21:52:29 -0500 Subject: [PATCH] Add modules to install gitfs backend dependencies Add modules for gitfs dependencies and documentation for how to use them. --- README.rst | 15 ++++++++++ salt/defaults.yaml | 11 ++++++++ salt/gitfs/dulwich.sls | 21 ++++++++++++++ salt/gitfs/gitpython.sls | 13 +++++++++ salt/gitfs/pygit2.sls | 60 ++++++++++++++++++++++++++++++++++++++++ 5 files changed, 120 insertions(+) create mode 100644 salt/gitfs/dulwich.sls create mode 100644 salt/gitfs/gitpython.sls create mode 100644 salt/gitfs/pygit2.sls diff --git a/README.rst b/README.rst index 9f8dad3..d11530a 100644 --- a/README.rst +++ b/README.rst @@ -53,6 +53,21 @@ Requisite: Configure salt-master with rest_cherrypy or rest_tornado. Install a minion and configure it in `standalone mode `_. +``salt.gitfs.dulwich`` +---------------------- + +Install gitfs backend dulwich dependencies. Set ``salt:master:gitfs_provider: dulwich`` in your pillar. + +``salt.gitfs.gitpython`` +---------------------- + +Install gitfs backend GitPython dependenciess. Set ``salt:master:gitfs_provider: gitpython`` in your pillar. + +``salt.gitfs.pygit2`` +---------------------- + +Install gitfs backend libgit2/pygit2 dependenciess. Set ``salt:master:gitfs_provider: pygit2`` in your pillar. + ``salt.pkgrepo`` ---------------- diff --git a/salt/defaults.yaml b/salt/defaults.yaml index c2a358b..e48e1bc 100644 --- a/salt/defaults.yaml +++ b/salt/defaults.yaml @@ -12,3 +12,14 @@ salt: salt_api: salt-api salt_ssh: salt-ssh clean_config_d_dir: False + + master: + gitfs_provider: gitpython + + gitfs: + dulwich: + install_from_source: True + pygit2: + install_from_source: True + gitpython: + install_from_source: False diff --git a/salt/gitfs/dulwich.sls b/salt/gitfs/dulwich.sls new file mode 100644 index 0000000..b5c2589 --- /dev/null +++ b/salt/gitfs/dulwich.sls @@ -0,0 +1,21 @@ +{% from "salt/map.jinja" import salt_settings with context %} +# issue 34 + +{% if salt_settings.gitfs.dulwich.install_from_source %} +# we probably don't have a package or it's not a high enough version +# install latest from source/pip +dulwich-deps: + pkg.installed: + - pkgs: + - build-essential + - python-dev + +install-dulwich: + pip.installed: + - name: dulwich + +{% else %} +# install from package +# TODO haven't actually found a distro that has a good version to test + +{% endif %} diff --git a/salt/gitfs/gitpython.sls b/salt/gitfs/gitpython.sls new file mode 100644 index 0000000..7fa09ef --- /dev/null +++ b/salt/gitfs/gitpython.sls @@ -0,0 +1,13 @@ +{% from "salt/map.jinja" import salt_settings with context %} + +{% if salt_settings.gitfs.gitpython.install_from_source %} + +GitPython: + pip.installed + +{% else %} + +python-git: + pkg.installed + +{% endif %} diff --git a/salt/gitfs/pygit2.sls b/salt/gitfs/pygit2.sls new file mode 100644 index 0000000..22e9da1 --- /dev/null +++ b/salt/gitfs/pygit2.sls @@ -0,0 +1,60 @@ +{% from "salt/map.jinja" import salt_settings with context %} + +{% if salt_settings.gitfs.pygit2.install_from_source %} +# 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: + - name: /usr/src + - source: https://github.com/libgit2/libgit2/archive/v0.22.1.tar.gz + - source_hash: md5=dbf516d18e176bbb131de3efccfee533 + - archive_format: tar + - keep: True + - if_missing: /usr/src/libgit2-0.22.1 + +/usr/src/libgit2-0.22.1/_build: + file.directory + +configure-libgit2: + cmd.run: + - name: cmake .. + - cwd: /usr/src/libgit2-0.22.1/_build + - creates: /usr/src/libgit2-0.22.1/_build/Makefile + +build-libgit2: + cmd.run: + - name: make -j4 + - cwd: /usr/src/libgit2-0.22.1/_build + - creates: /usr/src/libgit2-0.22.1/_build/libgit2.so + +install-libgit2: + cmd.run: + - name: make install + - cwd: /usr/src/libgit2-0.22.1/_build + - creates: /usr/local/lib/libgit2.so + +run-ldconfig-after-lib-install: + cmd.run: + - name: ldconfig + - onchanges: + - cmd: install-libgit2 + +install-pygit2: + pip.installed: + - name: pygit2 + +{% else %} +# install from package +# TODO haven't actually found a distro that has a good version to test +# debian jessie will have libgit2-21 + +{% endif %}