modified make, fixed packages and vars

- the make helper now has distinct build stages
  - configure: is now defined in pkg.targets.configure
  - build: is now defined in pkg.targets.build
  - install: is now defined in pkg.targets.install
  - added pre-install: which is a list of targets that are looped over
before install
  - added post-instal: which is a list of targets that are looped over
after install

- removed major package level variables from vars/main.yml
  - moving those variables into actual package level variables as
defaults
  - if the values are defined they will be used instead of defaults
This commit is contained in:
Matthew Stobbs
2026-03-19 13:39:26 -06:00
parent ac0ac25bba
commit d1d556d425
10 changed files with 211 additions and 76 deletions

View File

@@ -12,11 +12,54 @@
version: "{{ pkg.version | default(omit) }}"
ansible.builtin.include_tasks: helpers/git.yml
- name: Run make targets
loop: "{{ pkg.targets }}"
- name: Run configure target
when:
- pkg.target.configure is defined
community.general.make:
chdir: "{{ pkg.path }}"
target: "{{ pkg.target.configure.name }}"
params: "{{ pkg.target.configure.params | default(omit) }}"
- name: Run build target
when:
- pkg.target.build is defined
community.general.make:
chdir: "{{ pkg.path }}"
target: "{{ pkg.target.build.name }}"
params: "{{ target.params | default(omit) }}"
- name: Clean old installation
vars:
files: "{{ pkg.install_files }}"
when:
- pkg.install_files is defined
ansible.builtin.include_tasks: helpers/clean_install.yml
- name: Run preinstall targets
when:
- pkg.targets.preinstall is defined
loop: "{{ pkg.targets.preinstall }}"
loop_control:
loop_var: target
community.general.make:
chdir: "{{ pkg.path }}"
target: "{{ target.name }}"
params: "{{ target.params | default(omit) }}"
- name: Run install target
when:
- pkg.targets.install is defined
community.general.make:
chdir: "{{ pkg.path }}"
target: "{{ pkg.targets.install.name }}"
params: "{{ pkg.targets.install.params | default(omit) }}"
- name: Run postinstall targets
when:
- pkg.targets.postinstall is defined
loop: "{{ pkg.targets.postinstall }}"
loop_control:
loop_var: target
become: "{{ target.do_become }}"
community.general.make:
chdir: "{{ pkg.path }}"
target: "{{ target.name }}"

View File

@@ -1,11 +1,25 @@
# vim: set filetype=yaml.ansible :
#
## Package: bat
## Description: cat replacement with style
## Description: cat replacement with wings
## Version: latest
## Methods: source
## Helpers: cargo
---
- name: Set bat default facts # {{{
ansible.builtin.set_fact:
bat:
install_methods:
- source
- system
pkgname:
RedHat: bat
Debian: bat
Archlinux: bat
Alpine: bat
Darwin: bat
FreeBSD: bat
# }}}
- name: Start bat configuration
when:
- "'bat' not in __configured"

View File

@@ -11,6 +11,11 @@
cargo:
install_methods:
- system
pkgname:
RedHat: cargo
Debian: cargo
Alpine: cargo
FreeBSD: cargo
- name: Configure cargo
when:
- "'cargo' not in __configured"
@@ -35,7 +40,7 @@
block:
- name: Queue cargo install
ansible.builtin.set_fact:
pkg_sys: "{{ pkg_sys + [cargo_pkgname] }}"
pkg_sys: "{{ pkg_sys + [cargo.pkgname[os_family]] }}"
- name: Finalize cargo configuration
ansible.builtin.set_fact:

View File

@@ -6,6 +6,12 @@
## Methods: system
## Helpers: -
---
- name: Set cmake default facts # {{
ansible.builtin.set_fact:
cmake:
install_methods:
- system
# }}
- name: Configure cmake
when:
- "'cmake' not in __configured"

View File

@@ -1,5 +1,11 @@
# vim: set filetype=yaml.ansible :
---
- name: Set fzf default facts # {{{
ansible.builtin.set_fact:
fzf:
install_methods:
- system
# }}}
- name: Configure fzf
when:
- "'fzf' not in __configured"

View File

@@ -1,5 +1,11 @@
# vim: set filetype=yaml.ansible :
---
- name: Set git default facts # {{{
ansible.builtin.set_fact:
git:
install_methods:
- system
# }}}
- name: Configure git
when:
- "'git' not in __configured"

View File

@@ -1,13 +0,0 @@
# vim: set filetype=yaml.ansible :
---
- name: Add glow
when:
- glow_configured is undefined
block:
- name: Append glow to pkg_go
ansible.builtin.set_fact:
pkg_go: "{{ pkg_go + ['github.com/charmbracelet/glow@latest'] }}"
- name: Set glow_configured
ansible.builtin.set_fact:
glow_configured: true

View File

@@ -1,5 +1,50 @@
# vim: set filetype=yaml.ansible :
---
- name: Set go default facts # {{{
ansible.builtin.set_fact:
go:
install_methods:
- archive
- system
pkgname:
RedHat: go
Debian: go
Darwin: go
FreeBSD:
default: go
1.25: go125
1.24: go124
1.23: go123
1.22: go122
archive:
version: "{{ go_archive_version | default('1.26.1') }}"
archmap:
arm64: arm64
aarch64: arm64
x86_64: amd64
url_base: https://go.dev/dl
checksums:
1.26.1:
Darwin:
amd64: sha256:65773dab2f8cc4cd23d93ba6d0a805de150ca0b78378879292be0b903b8cdd08
arm64: sha256:353df43a7811ce284c8938b5f3c7df40b7bfb6f56cb165b150bc40b5e2dd541f
Linux:
amd64: sha256:031f088e5d955bab8657ede27ad4e3bc5b7c1ba281f05f245bcc304f327c987a
arm64: sha256:a290581cfe4fe28ddd737dde3095f3dbeb7f2e4065cab4eae44dfc53b760c2f7
FreeBSD:
amd64: sha256:d89034a0b54fdc234815fecfb76d7d06a7d180d7a6124aa47715a4cacc9fe999
arm64: sha256:d62b358dbf7bcfc33402e7e221d848e7fd8d7ac902b33920f2c23c8a32ba76db
1.25.6:
Darwin:
amd64: sha256:e2b5b237f5c262931b8e280ac4b8363f156e19bfad5270c099998932819670b7
arm64: sha256:984521ae978a5377c7d782fd2dd953291840d7d3d0bd95781a1f32f16d94a006
Linux:
amd64: sha256:f022b6aad78e362bcba9b0b94d09ad58c5a70c6ba3b7582905fababf5fe0181a
arm64: sha256:738ef87d79c34272424ccdf83302b7b0300b8b096ed443896089306117943dd5
FreeBSD:
amd64: sha256:61e1d50e332359474ff6dcf4bc0bd34ba2d2cf4ef649593a5faa527f0ab84e2b
arm64: sha256:648484146702dd58db0e2c3d15bda3560340d149ed574936e63285a823116b77
# }}}
- name: Configure go for install
when:
- "'go' not in __configured"
@@ -16,7 +61,7 @@
block:
- name: Set go pkgname
ansible.builtin.set_fact:
go_pkgname: "{{ go_pkgname[ansible_os_family] }}"
go_pkgname: "{{ go.pkgname[os_family] }}"
- name: Set go pkgname for FreeBSD
when:
@@ -24,6 +69,10 @@
ansible.builtin.set_fact:
go_pkgname: "{{ go_pkgname[go_bsd_version] | default(go_pkgname['default']) }}"
- name: Go system package install
ansible.builtin.set_fact:
pkg_sys: "{{ pkg_sys + [go_pkgname] }}"
- name: Configure go archive installation
when:
- go_install_method == 'archive'
@@ -31,16 +80,16 @@
- name: Configure go
ansible.builtin.set_fact:
go_system: "{{ ansible_system | lower }}"
go_arch: "{{ go_archive_archmap[ansible_architecture] }}"
go_arch: "{{ go.archive.archmap[ansible_architecture] }}"
- name: Set archive name
ansible.builtin.set_fact:
go_archive_file: "go{{ go_archive_version }}.{{ go_system }}-{{ go_arch }}.tar.gz"
go_archive_file: "go{{ go.archive.version }}.{{ go_system }}-{{ go_arch }}.tar.gz"
- name: Set go archive url and path
ansible.builtin.set_fact:
go_archive_url: "{{ go_archive_url_base }}/{{ go_archive_file }}"
go_extract_path: "{{ path_archive }}/go{{ go_archive_version }}"
go_archive_url: "{{ go.archive.url_base }}/{{ go_archive_file }}"
go_extract_path: "{{ path_archive }}/go{{ go.archive.version }}"
- name: Finalize go archive install
ansible.builtin.set_fact:
@@ -48,7 +97,7 @@
extract_to: "{{ go_extract_path }}"
url: "{{ go_archive_url }}"
name: "{{ go_archive_file }}"
checksum: "{{ go_archive_sums[go_archive_version][ansible_system][go_arch] }}"
checksum: "{{ go.archive.checksums[go.archive.version][ansible_system][go_arch] }}"
links:
- from: "{{ go_extract_path }}/go"
to: "{{ path_go }}"
@@ -59,22 +108,10 @@
__add_to_path: "{{ __add_to_path + [path_go ~ '/bin'] }}"
__var_to_env: "{{ __var_to_env | combine( { 'GOROOT': path_go } ) }}"
- name: Queue go install
block:
- name: Go system package install
when:
- go_install_method == 'system'
- name: Add go archive extract install
ansible.builtin.set_fact:
pkg_sys: "{{ pkg_sys + [go_pkgname] }}"
pkg_archive: "{{ pkg_archive + [go_archive_install] }}"
- name: Install via archive
when:
- go_install_method == 'archive'
block:
- name: Add go archive extract install
ansible.builtin.set_fact:
pkg_archive: "{{ pkg_archive + [go_archive_install] }}"
- name: Complete go archive install configuration
- name: Finalise go configuration
ansible.builtin.set_fact:
__configured: "{{ __configured | combine( { 'go': true } ) }}"
__configured: "{{ __configured | combine( { 'go': go_install_method } ) }}"

View File

@@ -1,5 +1,64 @@
# vim: set filetype=yaml.ansible :
#
## Package: neovim
## Description: fork of vim focusing on modern development
## Version: master
## Methods: [source, system, appimage, archive]
## Helpers: [make, archive, appimage]
---
- name: Set neovim default facts # {{{
ansible.builtin.set_fact:
neovim:
install_methods:
- source
- system
- appimage
- archive
git_repo: https://github.com/neovim/neovim
appimage:
base_url: https://github.com/neovim/neovim/releases/download
pkgname:
RedHat: neovim
Debian: neovim
Darwin: neovim
FreeBSD: neovim
build_files:
- to: lib64/nvim
- to: bin/nvim
- to: share/nvim
- to: share/applications/nvim.desktop
- to: share/icons/hicolor/128x128/apps/nvim.png
- to: share/man/man1/nvim.1
build_pkgdeps:
- cmake
- git
build_deps:
RedHat:
- cmake
- curl
- gcc
- gettext
- glibc-gconv-extra
- make
- ninja-build
Debian:
- build-essential
- cmake
- curl
- gettext
- ninja-build
Darwin:
- cmake
- curl
- gettext
- ninja
Alpine:
- build-base
- cmake
- coreutils
- curl
- gettext-dev
# }}}
- name: Configure neovim
when:
- "'neovim' not in __configured"
@@ -29,12 +88,14 @@
repo: "{{ neovim.git_repo }}"
version: "{{ neovim_version }}"
targets:
- name: ""
build:
name: ""
do_become: false
params:
CMAKE_BUILD_TYPE: Release
CMAKE_EXTRA_FLAGS: "-DCMAKE_INSTALL_PREFIX={{ install_prefix }}"
- name: install
install:
name: install
do_become: true
- name: Append neovim to source install list
ansible.builtin.set_fact: