Browse Source

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

master
Shane Poage 9 years ago
parent
commit
addc6d5a26
3 changed files with 52 additions and 28 deletions
  1. +7
    -0
      salt/defaults.yaml
  2. +25
    -12
      salt/gitfs/pygit2.sls
  3. +20
    -16
      salt/map.jinja

+ 7
- 0
salt/defaults.yaml View File

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



+ 25
- 12
salt/gitfs/pygit2.sls View File

{% 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:


dl-libgit2-src: dl-libgit2-src:
archive.extracted: archive.extracted:
- name: /usr/src
- source: https://github.com/libgit2/libgit2/archive/v0.22.1.tar.gz
- source_hash: md5=dbf516d18e176bbb131de3efccfee533
- 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 }}
- 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
- creates: /usr/src/libgit2-0.22.1/_build/Makefile
- cwd: {{ libgit2_build_dir }}
- 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
- creates: /usr/src/libgit2-0.22.1/_build/libgit2.so
- cwd: {{ libgit2_build_dir }}
- 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:
- 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 }}:

+ 20
- 16
salt/map.jinja View File

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': {},
'Ubuntu': {},
'CentOS': {},
'Amazon': {},
'Fedora': {},
'Debian': {
'libgit2': 'libgit2-22',
'gitfs': {
'pygit2': {
'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': {
'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',
'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',
'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 ##}
{% do default_settings.salt.update(os_family_map) %} {% do default_settings.salt.update(os_family_map) %}
{## Merge in salt:lookup pillar ##} {## Merge in salt:lookup pillar ##}
{% 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)
%} %}

Loading…
Cancel
Save