k8s-clusters/ansible/arch-linux/tasks/aur.yaml

54 lines
1.6 KiB
YAML
Raw Normal View History

2022-02-01 17:05:06 -06:00
- name: AUR | get package metadata for {{ pkg_name }}
connection: local
become: no
uri: >
url=https://aur.archlinux.org/rpc.php?type=info&arg={{ pkg_name | mandatory }}
return_content=yes
timeout=6
register: api_info
- assert:
that:
- api_info.status == 200
- api_info.json is defined
- api_info.json.type == 'info'
- api_info.json.resultcount == 1
- api_info.json.results is defined
- name: AUR | download tarball for package {{ pkg_name }}
become: no
connection: local
get_url: >
url='https://aur.archlinux.org{{ api_info.json.results.URLPath }}'
dest='/tmp/'
register: aur_tarball
- name: AUR | upload and extract package {{ pkg_name }} tarball to host
become: yes
become_user: '{{ makepkg_nonroot_user }}'
unarchive: >
src={{ aur_tarball.dest }}
dest=/tmp/
register: extracted_pkg
- name: AUR | get dependencies and build package {{ pkg_name }}
when: extracted_pkg.changed
become: yes
become_user: '{{ makepkg_nonroot_user }}'
command: >
makepkg --noconfirm --noprogressbar -mfs
chdir=/tmp/{{ pkg_name }}
register: aur_makepkg_result
- shell: 'ls -1 /tmp/{{ pkg_name | quote }} | grep pkg.tar'
register: compiled_package_name
- name: AUR | install {{ pkg_name }} with pacman
when: aur_makepkg_result.changed
become: yes
shell: >
pacman --noconfirm --noprogressbar --needed -U {{ compiled_package_name.stdout | quote }}
chdir=/tmp/{{ pkg_name }}
register: pacman_install_result
changed_when: pacman_install_result.stdout is defined and pacman_install_result.stdout.find('there is nothing to do') == -1