Fixed Paru installation role
This commit is contained in:
@@ -1,21 +1,17 @@
|
||||
- name: Check if paru is already installed
|
||||
ansible.builtin.pacman:
|
||||
name: paru
|
||||
state: present
|
||||
check_mode: true
|
||||
ansible.builtin.command:
|
||||
argv:
|
||||
- pacman
|
||||
- -Qq
|
||||
- paru
|
||||
register: is_paru_installed
|
||||
changed_when: false
|
||||
failed_when: false
|
||||
|
||||
- name: Stop the role if paru is already installed
|
||||
when: not is_paru_installed.changed
|
||||
when: is_paru_installed.rc == 0
|
||||
ansible.builtin.meta: end_role
|
||||
|
||||
- name: Ensure build prerequisites are present
|
||||
become: true
|
||||
ansible.builtin.pacman:
|
||||
name:
|
||||
- base-devel
|
||||
- fakeroot
|
||||
|
||||
- name: Create temporary dir for build
|
||||
ansible.builtin.tempfile:
|
||||
state: directory
|
||||
@@ -33,9 +29,29 @@
|
||||
dest: "{{ paru_tmp.path }}"
|
||||
remote_src: true
|
||||
|
||||
- name: Read the package metadata
|
||||
ansible.builtin.slurp:
|
||||
src: "{{ paru_tmp.path }}/paru/.SRCINFO"
|
||||
register: paru_srcinfo
|
||||
|
||||
- name: Extract build and runtime dependencies
|
||||
ansible.builtin.set_fact:
|
||||
paru_build_deps: >-
|
||||
{{ (paru_srcinfo.content | b64decode)
|
||||
| regex_findall('(?m)^\s*(?:make|check)?depends(?:_\w+)?\s*=\s*([^\s<>=]+)')
|
||||
| unique }}
|
||||
|
||||
- name: Ensure build prerequisites are present
|
||||
become: true
|
||||
ansible.builtin.pacman:
|
||||
name: "{{ ['base-devel', 'fakeroot'] + paru_build_deps }}"
|
||||
state: present
|
||||
|
||||
- name: Build the package (no install)
|
||||
ansible.builtin.command:
|
||||
cmd: makepkg --syncdeps --noconfirm
|
||||
argv:
|
||||
- makepkg
|
||||
- --noconfirm
|
||||
chdir: "{{ paru_tmp.path }}/paru"
|
||||
environment:
|
||||
PKGDEST: "{{ paru_tmp.path }}/paru"
|
||||
@@ -44,6 +60,7 @@
|
||||
ansible.builtin.find:
|
||||
paths: "{{ paru_tmp.path }}/paru"
|
||||
patterns: "*.pkg.tar.zst"
|
||||
excludes: "*-debug-*"
|
||||
file_type: file
|
||||
register: built_pkgs
|
||||
|
||||
@@ -51,7 +68,11 @@
|
||||
- name: Install built package(s)
|
||||
become: true
|
||||
ansible.builtin.command:
|
||||
cmd: "pacman -U --noconfirm {{ item.path }}"
|
||||
argv:
|
||||
- pacman
|
||||
- -U
|
||||
- --noconfirm
|
||||
- "{{ item.path }}"
|
||||
creates: /usr/bin/paru
|
||||
loop: "{{ built_pkgs.files }}"
|
||||
|
||||
|
||||
Reference in New Issue
Block a user