2017-09-24 14:03:05 +00:00
|
|
|
---
|
|
|
|
# host to test against
|
|
|
|
- hosts: test-kitchen
|
|
|
|
remote_user: root
|
|
|
|
tasks:
|
|
|
|
- include_tasks: tasks/dependencies.yml
|
|
|
|
|
|
|
|
- name: Install build tools
|
|
|
|
package:
|
|
|
|
name: "{{ item }}"
|
|
|
|
with_items: "{{ build_tools }}"
|
|
|
|
|
2017-11-10 18:31:22 +00:00
|
|
|
- name: Check whether deb-src repos are enabled
|
2017-09-24 14:03:05 +00:00
|
|
|
command: grep -c -e "^deb-src.*" /etc/apt/sources.list
|
|
|
|
register: deb_src_check
|
|
|
|
ignore_errors: yes
|
|
|
|
when:
|
|
|
|
- ansible_os_family == "Debian"
|
|
|
|
|
|
|
|
- name: Set deb-src check results
|
|
|
|
set_fact:
|
2019-08-18 07:40:16 +00:00
|
|
|
deb_src_check_result: "{{ deb_src_check.stdout | default(0) }}"
|
2017-09-24 14:03:05 +00:00
|
|
|
|
|
|
|
- name: Enable Ubuntu main & restricted source repo
|
|
|
|
replace:
|
|
|
|
path: '/etc/apt/sources.list'
|
|
|
|
regexp: '^(#\s)(.*main\srestricted)$'
|
|
|
|
replace: '\2 # enabled'
|
|
|
|
when:
|
|
|
|
- ansible_distribution == "Ubuntu"
|
2019-08-18 07:40:16 +00:00
|
|
|
- deb_src_check_result|int < 1
|
2017-09-24 14:03:05 +00:00
|
|
|
|
2018-06-09 04:55:50 +00:00
|
|
|
- name: Remove dpkg excludes on Ubuntu
|
|
|
|
replace:
|
|
|
|
path: '/etc/dpkg/dpkg.cfg.d/excludes'
|
|
|
|
regexp: '^(path-exclude=/usr/share/man/.*)'
|
|
|
|
replace: '#\1'
|
|
|
|
when:
|
|
|
|
- ansible_distribution == "Ubuntu"
|
|
|
|
|
2017-09-24 14:03:05 +00:00
|
|
|
- name: Enable Debian source repos
|
|
|
|
replace:
|
|
|
|
path: '/etc/apt/sources.list'
|
|
|
|
regexp: '^(deb)(.*)$'
|
|
|
|
replace: '\1\2\ndeb-src\2'
|
|
|
|
when:
|
|
|
|
- ansible_distribution == "Debian"
|
2019-08-18 07:40:16 +00:00
|
|
|
- deb_src_check_result|int < 1
|
2017-09-24 14:03:05 +00:00
|
|
|
|
|
|
|
- name: Install gnupg build dependencies for Debian based distros
|
|
|
|
apt:
|
|
|
|
name: gnupg2
|
|
|
|
state: build-dep
|
|
|
|
update_cache: yes
|
|
|
|
when:
|
|
|
|
- ansible_os_family == "Debian"
|
|
|
|
|
|
|
|
- name: Install gnupg build dependencies for RedHat based distros
|
2018-06-09 04:55:50 +00:00
|
|
|
command: bash -lc "dnf -y install 'dnf-command(builddep)' && dnf builddep -y gnupg2"
|
|
|
|
when:
|
|
|
|
- ansible_os_family == "RedHat"
|
|
|
|
|
2018-07-24 16:51:02 +00:00
|
|
|
- name: Install gnupg build dependencies for Alpine based distros
|
|
|
|
command: bash -lc "apk add gnutls-dev libksba-dev libgcrypt-dev libgpg-error-dev npth-dev zlib-dev libassuan-dev bzip2-dev sqlite-dev libusb-dev"
|
|
|
|
when:
|
|
|
|
- ansible_os_family == "Alpine"
|
|
|
|
|
2018-06-09 04:55:50 +00:00
|
|
|
- name: Install rspec in /usr/local/bin for RedHat based distros
|
|
|
|
command: bash -lc "gem install -n /usr/local/bin rspec"
|
2017-09-24 14:03:05 +00:00
|
|
|
when:
|
|
|
|
- ansible_os_family == "RedHat"
|
|
|
|
|
2018-07-24 16:51:02 +00:00
|
|
|
- name: Make directory /usr/local/src/ for Alpine based distros
|
|
|
|
command: bash -lc "mkdir -p /usr/local/src/"
|
|
|
|
when:
|
|
|
|
- ansible_os_family == "Alpine"
|
|
|
|
|
2017-09-24 14:03:05 +00:00
|
|
|
- name: Set gnupg src directory
|
|
|
|
set_fact:
|
2019-01-04 21:53:13 +00:00
|
|
|
gpg_src_path: /usr/local/src/gpg-gnupg
|
|
|
|
|
|
|
|
- name: Get GnuPG from github
|
|
|
|
git:
|
|
|
|
repo: 'https://github.com/gpg/gnupg.git'
|
|
|
|
dest: "{{ gpg_src_path }}"
|
|
|
|
update: true
|
|
|
|
|
|
|
|
- name: get latest tag name
|
|
|
|
shell: "git describe --tags `git rev-list --tags --max-count=1`"
|
|
|
|
args:
|
|
|
|
chdir: "{{ gpg_src_path }}"
|
|
|
|
register: latest_tag
|
|
|
|
|
|
|
|
- name: Checkout latest tag
|
|
|
|
git:
|
|
|
|
repo: 'https://github.com/gpg/gnupg.git'
|
|
|
|
dest: "{{ gpg_src_path }}"
|
|
|
|
version: "{{ latest_tag.stdout }}"
|
2017-09-24 14:03:05 +00:00
|
|
|
|
|
|
|
- name: Run gnupg autogen
|
|
|
|
command: bash -lc "cd {{ gpg_src_path }} && ./autogen.sh "
|
|
|
|
changed_when: False
|
|
|
|
|
|
|
|
- name: Disable development msg for gnupg
|
|
|
|
lineinfile:
|
|
|
|
path: "{{ gpg_src_path }}/configure"
|
|
|
|
regexp: '^development_version=.*'
|
|
|
|
line: 'development_version=no'
|
|
|
|
|
|
|
|
- name: Set gnupg build config
|
|
|
|
set_fact:
|
|
|
|
gpg_build_config: >-
|
|
|
|
--sysconfdir=/etc
|
|
|
|
--prefix=/usr
|
|
|
|
--enable-symcryptrun
|
|
|
|
--docdir=/usr/share/doc/gnupg-2.2.0
|
|
|
|
--disable-rpath
|
|
|
|
--enable-maintainer-mode
|
|
|
|
changed_when: False
|
|
|
|
|
|
|
|
- name: Configure gnupg build
|
|
|
|
command: bash -lc "cd {{ gpg_src_path }} && ./configure {{ gpg_build_config }}"
|
|
|
|
changed_when: False
|
|
|
|
|
2018-07-24 16:51:02 +00:00
|
|
|
# disable gnupg doc build on alpine as it is not detecting an absence of graphical tools such as fig2dev on alpine
|
|
|
|
- name: Disable making docs on Alpine
|
|
|
|
lineinfile:
|
|
|
|
path: "{{ gpg_src_path }}/Makefile"
|
|
|
|
regexp: '^doc = doc$'
|
|
|
|
line: 'doc = '
|
|
|
|
when:
|
|
|
|
- ansible_os_family == "Alpine"
|
|
|
|
|
2018-10-11 01:21:58 +00:00
|
|
|
# disable gnupg doc build on Ubuntu-Rolling because it won't build
|
|
|
|
# ( See https://travis-ci.org/sobolevn/git-secret/jobs/439870332 )
|
|
|
|
- name: Disable making docs on Ubuntu-Rolling
|
|
|
|
lineinfile:
|
|
|
|
path: "{{ gpg_src_path }}/Makefile"
|
|
|
|
regexp: '^doc = doc$'
|
|
|
|
line: 'doc = '
|
|
|
|
when:
|
|
|
|
- ansible_distribution == "Ubuntu"
|
|
|
|
|
2017-09-24 14:03:05 +00:00
|
|
|
- name: Compile gnupg src
|
|
|
|
command: bash -lc "cd {{ gpg_src_path }} && make"
|
|
|
|
changed_when: False
|
|
|
|
|
|
|
|
- name: Install compiled gnupg
|
|
|
|
command: bash -lc "cd {{ gpg_src_path }} && make install"
|
|
|
|
changed_when: False
|
|
|
|
|
|
|
|
- include_tasks: tasks/prep-tests.yml
|
|
|
|
- include_tasks: tasks/run-tests.yml
|