aboutsummaryrefslogtreecommitdiffstats
path: root/roles/_workstation/makepkg
diff options
context:
space:
mode:
Diffstat (limited to 'roles/_workstation/makepkg')
-rw-r--r--roles/_workstation/makepkg/defaults/main.yml4
-rw-r--r--roles/_workstation/makepkg/meta/main.yml22
-rw-r--r--roles/_workstation/makepkg/tasks/install.yml21
-rw-r--r--roles/_workstation/makepkg/tasks/main.yml16
4 files changed, 63 insertions, 0 deletions
diff --git a/roles/_workstation/makepkg/defaults/main.yml b/roles/_workstation/makepkg/defaults/main.yml
new file mode 100644
index 0000000..96e3521
--- /dev/null
+++ b/roles/_workstation/makepkg/defaults/main.yml
@@ -0,0 +1,4 @@
+---
+
+makepkg_mirror_url: https://aur.archlinux.org
+makepkg_root_build_dir: /tmp/makepkg
diff --git a/roles/_workstation/makepkg/meta/main.yml b/roles/_workstation/makepkg/meta/main.yml
new file mode 100644
index 0000000..07c1a64
--- /dev/null
+++ b/roles/_workstation/makepkg/meta/main.yml
@@ -0,0 +1,22 @@
+---
+
+argument_specs:
+ main:
+ short_description: makepkg main entrypoint.
+ options:
+ makepkg_root_build_dir:
+ type: path
+ required: true
+ description: Local build directory
+ makepkg_package_name:
+ type: str
+ required: true
+ description: Package name (from the AUR)
+ makepkg_user:
+ type: str
+ required: true
+ description: User for building the package
+ makepkg_mirror_url:
+ type: str
+ required: true
+ description: Mirror url (usually the AUR)
diff --git a/roles/_workstation/makepkg/tasks/install.yml b/roles/_workstation/makepkg/tasks/install.yml
new file mode 100644
index 0000000..b9caeef
--- /dev/null
+++ b/roles/_workstation/makepkg/tasks/install.yml
@@ -0,0 +1,21 @@
+---
+
+- name: clone repository # noqa: latest[git]
+ ansible.builtin.git:
+ repo: "{{ makepkg_mirror_url }}/{{ makepkg_package_name }}.git"
+ dest: "{{ makepkg_root_build_dir }}/{{ makepkg_package_name }}"
+ force: true
+ become: true
+ become_user: "{{ makepkg_user }}"
+
+- name: make package # noqa: no-changed-when
+ ansible.builtin.command:
+ cmd: makepkg -fs
+ chdir: "{{ makepkg_root_build_dir }}/{{ makepkg_package_name }}"
+ become: true
+ become_user: "{{ makepkg_user }}"
+
+- name: install package # noqa: no-changed-when
+ ansible.builtin.shell:
+ cmd: pacman --noconfirm -U *.zst
+ chdir: "{{ makepkg_root_build_dir }}/{{ makepkg_package_name }}"
diff --git a/roles/_workstation/makepkg/tasks/main.yml b/roles/_workstation/makepkg/tasks/main.yml
new file mode 100644
index 0000000..1a31fd9
--- /dev/null
+++ b/roles/_workstation/makepkg/tasks/main.yml
@@ -0,0 +1,16 @@
+---
+
+- name: "check that package is present: {{ makepkg_package_name }}"
+ ansible.builtin.command:
+ cmd: pacman -Q {{ makepkg_package_name }}
+ register: makepkg_result_check_package
+ changed_when:
+ - makepkg_result_check_package.rc != 0
+ failed_when:
+ - makepkg_result_check_package.rc == 1
+ - "'was not found' not in makepkg_result_check_package.stderr"
+
+- name: include install task # noqa: no-handler
+ ansible.builtin.include_tasks:
+ file: install.yml
+ when: makepkg_result_check_package.changed
remember that computers suck.