--- # 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 }}" - name: Check whether deb-src repos are enabled 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: deb_src_check_result: "{{ deb_src_check.stdout | default(0) }}" - name: Enable Ubuntu main & restricted source repo replace: path: '/etc/apt/sources.list' regexp: '^(#\s)(.*main\srestricted)$' replace: '\2 # enabled' when: - ansible_distribution == "Ubuntu" - deb_src_check_result|int < 1 - 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" - name: Enable Debian source repos replace: path: '/etc/apt/sources.list' regexp: '^(deb)(.*)$' replace: '\1\2\ndeb-src\2' when: - ansible_distribution == "Debian" - deb_src_check_result|int < 1 - 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 command: bash -lc "dnf -y install 'dnf-command(builddep)' && dnf builddep -y gnupg2" when: - ansible_os_family == "RedHat" - 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" - name: Install rspec in /usr/local/bin for RedHat based distros command: bash -lc "gem install -n /usr/local/bin rspec" when: - ansible_os_family == "RedHat" - name: Make directory /usr/local/src/ for Alpine based distros command: bash -lc "mkdir -p /usr/local/src/" when: - ansible_os_family == "Alpine" - name: Set gnupg src directory set_fact: 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 }}" - 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 # 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" # 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" - 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