2
0

Added logic to properly install pygit2 on ubuntu systems and made the pygit2 installation more flexible in general.

This commit is contained in:
Shane Poage 2015-08-19 23:46:49 -05:00
parent 5db269e560
commit addc6d5a26
3 changed files with 52 additions and 28 deletions

View File

@ -28,6 +28,13 @@ salt:
install_from_source: True install_from_source: True
pygit2: pygit2:
install_from_source: True install_from_source: True
version: 0.23.0
libgit2:
version: 0.23.0
install_from_source: True
build_parent_dir: /usr/src/
# hash necessary until github issue #9272 is addressed
download_hash: 683d1164e361e2a0a8d52652840e2340
gitpython: gitpython:
install_from_source: False install_from_source: False

View File

@ -1,9 +1,16 @@
{% from "salt/map.jinja" import salt_settings with context %} {% from "salt/map.jinja" import salt_settings with context %}
{% set pygit2_settings = salt_settings.gitfs.pygit2 %}
git: git:
pkg.installed pkg.installed
{% if salt_settings.gitfs.pygit2.install_from_source %} {% 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' %}
# we probably don't have a package or it's not a high enough version # we probably don't have a package or it's not a high enough version
# install latest from source/pip # install latest from source/pip
pygit-deps: pygit-deps:
@ -17,32 +24,32 @@ pygit-deps:
dl-libgit2-src: dl-libgit2-src:
archive.extracted: archive.extracted:
- name: /usr/src - name: {{ libgit2_settings.build_parent_dir }}
- source: https://github.com/libgit2/libgit2/archive/v0.22.1.tar.gz - source: https://github.com/libgit2/libgit2/archive/v{{ libgit2_settings.version }}.tar.gz
- source_hash: md5=dbf516d18e176bbb131de3efccfee533 - source_hash: md5={{ libgit2_settings.download_hash }}
- archive_format: tar - archive_format: tar
- keep: True - keep: True
- if_missing: /usr/src/libgit2-0.22.1 - if_missing: /usr/src/libgit2-{{ libgit2_settings.version }}
/usr/src/libgit2-0.22.1/_build: {{ libgit2_build_dir }}:
file.directory file.directory
configure-libgit2: configure-libgit2:
cmd.run: cmd.run:
- name: cmake .. - name: cmake ..
- cwd: /usr/src/libgit2-0.22.1/_build - cwd: {{ libgit2_build_dir }}
- creates: /usr/src/libgit2-0.22.1/_build/Makefile - creates: {{ libgit2_build_dir }}/Makefile
build-libgit2: build-libgit2:
cmd.run: cmd.run:
- name: make -j4 - name: make -j4
- cwd: /usr/src/libgit2-0.22.1/_build - cwd: {{ libgit2_build_dir }}
- creates: /usr/src/libgit2-0.22.1/_build/libgit2.so - creates: {{ libgit2_build_dir }}/libgit2.so
install-libgit2: install-libgit2:
cmd.run: cmd.run:
- name: make install - name: make install
- cwd: /usr/src/libgit2-0.22.1/_build - cwd: {{ libgit2_build_dir }}
- creates: /usr/local/lib/libgit2.so - creates: /usr/local/lib/libgit2.so
run-ldconfig-after-lib-install: run-ldconfig-after-lib-install:
@ -51,9 +58,15 @@ run-ldconfig-after-lib-install:
- onchanges: - onchanges:
- cmd: install-libgit2 - cmd: install-libgit2
{% else %}
{{ salt_settings.libgit2 }}:
pkg.installed
{% endif %}
install-pygit2: install-pygit2:
pip.installed: pip.installed:
- name: pygit2 - name: pygit2 == {{ pygit2_settings.version }}
{% else %} {% else %}
{{ salt_settings.pygit2 }}: {{ salt_settings.pygit2 }}:

View File

@ -9,22 +9,29 @@ Setup variable using grains['os_family'] based logic, only add key:values here
that differ from whats in defaults.yaml that differ from whats in defaults.yaml
##} ##}
{% set os_family_map = salt['grains.filter_by']({ {% set os_family_map = salt['grains.filter_by']({
'Debian': {}, 'Debian': {
'Ubuntu': {}, 'libgit2': 'libgit2-22',
'CentOS': {}, 'gitfs': {
'Amazon': {}, 'pygit2': {
'Fedora': {}, 'install_from_source': True,
'version': '0.22.1',
'libgit2': {
'install_from_source': False,
},
},
},
},
'RedHat': { 'RedHat': {
'pygit2': 'python-pygit2', 'pygit2': 'python-pygit2',
'gitfs': { 'gitfs': {
'pygit2': { 'pygit2': {
'install_from_source': False 'install_from_source': False,
}, },
}, },
'master': { 'master': {
'gitfs_provider': 'pygit2' 'gitfs_provider': 'pygit2'
}, },
'repotype': 'epel' 'repotype': 'epel',
}, },
'Suse': {}, 'Suse': {},
'Gentoo': { 'Gentoo': {
@ -32,7 +39,7 @@ that differ from whats in defaults.yaml
'salt_minion': 'app-admin/salt', 'salt_minion': 'app-admin/salt',
'salt_syndic': 'app-admin/salt', 'salt_syndic': 'app-admin/salt',
'salt_api': 'app-admin/salt', 'salt_api': 'app-admin/salt',
'salt_cloud': 'app-admin/salt' 'salt_cloud': 'app-admin/salt',
}, },
'Arch': { 'Arch': {
'salt_master': 'salt-zmq', 'salt_master': 'salt-zmq',
@ -40,7 +47,7 @@ that differ from whats in defaults.yaml
'salt_syndic': 'salt-zmq', 'salt_syndic': 'salt-zmq',
'salt_cloud': 'salt-zmq', 'salt_cloud': 'salt-zmq',
'salt_api': 'salt-zmq', 'salt_api': 'salt-zmq',
'salt_ssh': 'salt-zmq' 'salt_ssh': 'salt-zmq',
}, },
'FreeBSD': { 'FreeBSD': {
'salt_master': 'py27-salt', 'salt_master': 'py27-salt',
@ -55,11 +62,9 @@ that differ from whats in defaults.yaml
'minion_service': 'salt_minion', 'minion_service': 'salt_minion',
'master_service': 'salt_master', 'master_service': 'salt_master',
'api_service': 'salt_api', 'api_service': 'salt_api',
'syndic_service': 'salt_syndic' 'syndic_service': 'salt_syndic',
}, },
} }, grain="os_family", merge=salt['pillar.get']('salt:lookup'))
, grain="os_family"
, merge=salt['pillar.get']('salt:lookup'))
%} %}
{## Merge the flavor_map to the default settings ##} {## Merge the flavor_map to the default settings ##}
@ -69,6 +74,5 @@ that differ from whats in defaults.yaml
{% set salt_settings = salt['pillar.get']( {% set salt_settings = salt['pillar.get'](
'salt', 'salt',
default=default_settings.salt, default=default_settings.salt,
merge=True merge=True)
)
%} %}