This repository has been archived on 2025-04-22. You can view files and clone it, but you cannot make any changes to it's state, such as pushing and creating new issues, pull requests or comments.
common-ansible/tasks/arch_linux/aur.yml
2024-10-28 21:05:59 +01:00

56 lines
1.5 KiB
YAML

- fail:
msg: 'Requires aur_build_dir variable to be set'
when: not aur_build_dir
- name: set build directory
set_fact:
build_dir: '{{ aur_build_dir }}/{{ item.name }}'
- name: retrieve package name for {{ item.name }}
command:
argv: >
grep
--only-matching
--perl-regexp
"(?<=pkgname=).*"
"{{ build_dir }}/PKGBUILD"
register: pkg_name
- name: retrieve package version for {{ item.name }}
command:
argv: >
grep
--only-matching
--perl-regexp
"(?<=pkgver=).*"
"{{ build_dir }}/PKGBUILD"
register: pkg_version
- name: retrieve package release for {{ item.name }}
command:
argv: >
grep
--only-matching
--perl-regexp
"(?<=pkgrel=).*"
"{{ build_dir }}/PKGBUILD"
register: pkg_release
- set_fact:
package_filename: '{{ pkg_name.stdout }}-{{ pkg_version.stdout }}-{{ pkg_release.stdout }}-{{ item.arch }}.pkg.tar.zst'
installed_version: ansible_facts.packages[pkg_name.stdout].version|default('')
- name: build package {{ item.name }}
command: makepkg --syncdeps --rmdeps --clean --noconfirm --force
args:
chdir: '{{ build_dir }}'
creates: '{{ build_dir }}/{{ package_filename }}'
register: package_build
when: pkg_version.stdout != installed_version
- name: install {{ item.name }}
become: true
pacman:
name: '{{ build_dir }}/{{ package_filename }}'
state: present
when: pkg_version.stdout != installed_version