Squash merge move_to_single_file_pkgs into main
This commit is contained in:
64
tasks/helpers/cargo_build.yml
Normal file
64
tasks/helpers/cargo_build.yml
Normal file
@@ -0,0 +1,64 @@
|
||||
# vim: set filetype=yaml.ansible :
|
||||
#
|
||||
## Helper: cargo_buil.yml
|
||||
## Description: download source, build and install using cargo
|
||||
## Variables: top level 'dict'
|
||||
## source_dir: git source directory
|
||||
## repo: git repository url
|
||||
## depth: _int_ optional, Default 1. Git depth to clone
|
||||
## force_git: _bool_ optional, default true. Force clone, overwriting existing dir
|
||||
## recursive: _bool_ optional, default true. Do a recursive clone
|
||||
## version: _string_ optional, default 'latest'. Version to checkout and build
|
||||
## build_flags: _list[str]_ optional. If set, will append these to the build command
|
||||
---
|
||||
- name: Cargo source install helper
|
||||
block:
|
||||
- name: Fetch git repo
|
||||
vars:
|
||||
path: "{{ pkg.source_dir }}"
|
||||
repo: "{{ pkg.git.repo }}"
|
||||
depth: "{{ pkg.depth | default(1) }}"
|
||||
force: "{{ pkg.force_git | default(true) }}"
|
||||
recursive: "{{ pkg.recursive | default(true) }}"
|
||||
version: "{{ pkg.git.version | default(omit) }}"
|
||||
ansible.builtin.include_tasks: helpers/git.yml
|
||||
|
||||
- name: Build cargo release
|
||||
ansible.builtin.command:
|
||||
chdir: "{{ pkg.source_dir }}"
|
||||
argv: "{{ ['cargo', 'build'] + pkg.build_flags }}"
|
||||
|
||||
- name: Clean existing install
|
||||
vars:
|
||||
files: "{{ pkg.files }}"
|
||||
ansible.builtin.include_tasks: helpers/clean_install.yml
|
||||
|
||||
- name: Install cargo release
|
||||
block:
|
||||
# - name: Install files
|
||||
# vars:
|
||||
# source_dir: "{{ pkg.source_dir }}"
|
||||
# pkg: "{{ pkg }}"
|
||||
# ansible.builtin.include_tasks: helpers/install.yml
|
||||
|
||||
- name: Create directories
|
||||
become: "{{ install_become }}"
|
||||
become_user: "{{ install_become_user | default(omit) }}"
|
||||
loop: "{{ pkg.files }}"
|
||||
loop_control:
|
||||
loop_var: file
|
||||
ansible.builtin.file:
|
||||
state: directory
|
||||
mode: '0755'
|
||||
path: "{{ [install_prefix, file.to] | path_join | dirname }}"
|
||||
|
||||
- name: Copy installable files
|
||||
become: "{{ install_become }}"
|
||||
become_user: "{{ install_become_user }}"
|
||||
loop: "{{ pkg.files }}"
|
||||
loop_control:
|
||||
loop_var: file
|
||||
ansible.builtin.copy:
|
||||
dest: "{{ install_prefix }}/{{ file.to }}"
|
||||
mode: "{{ file.mode | default('0644') }}"
|
||||
src: "{{ pkg.source_dir }}/{{ file.from }}"
|
||||
Reference in New Issue
Block a user