Skip to content

Commit

Permalink
fix: linting, update versions
Browse files Browse the repository at this point in the history
  • Loading branch information
codedwrench authored and Rick de Bondt committed Nov 9, 2023
1 parent 53665b4 commit a2dc186
Show file tree
Hide file tree
Showing 12 changed files with 170 additions and 156 deletions.
6 changes: 6 additions & 0 deletions Resources/Ansible_Windows/.ansible-lint
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
# .ansible-lint

profile: shared # min, basic, moderate,safety, shared, production
enable_list:
- fqcn
22 changes: 11 additions & 11 deletions Resources/Ansible_Windows/base_scripts/configure_msys2_packages.yml
Original file line number Diff line number Diff line change
@@ -1,35 +1,35 @@
---
- name: Check already installed packages file exists
win_stat:
path: '{{ drive }}:\msys64\packages.txt'
ansible.windows.win_stat:
path: "{{ drive }}:\\msys64\\packages.txt"
register: packages_exist

- name: Get pacman installed list
win_shell: 'type {{ drive }}:\msys64\packages.txt'
ansible.windows.win_shell: type {{ drive }}:\msys64\packages.txt
register: installed_packages
changed_when: false
when: packages_exist.stat.exists

- name: Compare expected to be installed with installed packages
set_fact:
should_setup_msys2: True
ansible.builtin.set_fact:
should_setup_msys2: true
when: (not packages_exist.stat.exists) or (item not in installed_packages.stdout_lines)
loop: "{{ msys2_packages }}"

- name: Setup MSYS2
win_shell:
'{{ drive }}:\msys64\msys2_shell.cmd -mingw32 -defterm -no-start -c ''pacman -Syu
--needed --noconfirm {{ msys2_packages | join('' '') }} &&
pacman -Qe | cut -d '''' '''' -f 1 > /{{ drive }}/msys64/packages.txt'''
ansible.windows.win_shell: >
{{ drive }}:\\msys64\\msys2_shell.cmd -mingw32 -defterm -no-start -c
'pacman -Syu --needed --noconfirm {{ msys2_packages | join(' ') }} &&
pacman -Qe | cut -d '' '' -f 1 > /{{ drive }}/msys64/packages.txt'
when: should_setup_msys2 is defined

- name: Get pacman installed list
win_shell: 'type {{ drive }}:\msys64\packages.txt'
ansible.windows.win_shell: type {{ drive }}:\msys64\packages.txt
changed_when: false
register: installed_packages

- name: Verify pacman result
fail:
ansible.builtin.fail:
msg: "{{ item }} not installed"
failed_when: item not in installed_packages.stdout_lines
loop: "{{ msys2_packages }}"
46 changes: 28 additions & 18 deletions Resources/Ansible_Windows/base_scripts/install_boost.yml
Original file line number Diff line number Diff line change
@@ -1,38 +1,48 @@
---
- name: Download Boost
win_get_url:
dest: '{{ drive }}:\{{ install_dir}}\boost.zip'
url: 'https://boostorg.jfrog.io/artifactory/main/release/{{ boost_version }}/source/boost_{{ boost_version.split(".")[0] }}_{{ boost_version.split(".")[1] }}_{{ boost_version.split(".")[2] }}.zip'
ansible.windows.win_get_url:
dest: "{{ drive }}:\\{{ install_dir }}\\boost.zip"
url: >-
https://boostorg.jfrog.io/artifactory/main/release/{{ boost_version }}/source/
boost_{{ boost_version.split(".")[0] }}_{{ boost_version.split(".")[1] }}_{{ boost_version.split(".")[2] }}.zip
register: boost_download_result

- name: Unzip Boost
win_unzip:
delete_archive: yes
src: '{{ drive }}:\{{ install_dir}}\boost.zip'
dest: '{{ drive }}:\{{ install_dir}}'
community.windows.win_unzip:
delete_archive: true
src: "{{ drive }}:\\{{ install_dir }}\\boost.zip"
dest: "{{ drive }}:\\{{ install_dir }}"
when: boost_download_result.msg is defined and boost_download_result.msg == "OK"

- name: Rename Boost
win_shell: "move boost* boost"
ansible.windows.win_shell: move boost* boost
args:
chdir: '{{ drive }}:\{{ install_dir }}'
chdir: "{{ drive }}:\\{{ install_dir }}"
when: boost_download_result.msg is defined and boost_download_result.msg == "OK"

- name: Build Boost
win_shell:
ansible.windows.win_shell: >
'{{ drive }}:\msys64\msys2_shell.cmd -mingw32 -defterm -no-start -here -c
"cd tools/build && ./bootstrap.bat mingw && cp b2 ../.. && cd ../.. &&
./tools/build/b2.exe --build-type=minimal --toolset=gcc variant=release link=static runtime-link=static
address-model=32 threading=multi --with-system --with-program_options stage"'
./tools/build/b2.exe --build-type=minimal --toolset=gcc variant=release link=static
runtime-link=static address-model=32 threading=multi --with-system --with-program_options stage"'
args:
chdir: '{{ drive }}:\{{ install_dir }}\boost'
chdir: "{{ drive }}:\\{{ install_dir }}\\boost"
register: boost_build_output
when: boost_download_result.msg is defined and boost_download_result.msg == "OK"

- name: Log output to file
local_action: copy content={{ boost_build_output.stdout }} dest=./boost_output.log
when: boost_build_output.stdout

ansible.builtin.copy:
content: "{{ boost_build_output.stdout }}"
dest: ./boost_output.log
mode: "0644"
delegate_to: localhost
when: boost_build_output.stdout

- name: Log error output to file
local_action: copy content={{ boost_build_output.stderr }} dest=./boost_error_output.log
when: boost_build_output.stderr
ansible.builtin.copy:
content: "{{ boost_build_output.stderr }}"
dest: ./boost_error_output.log
mode: "0644"
delegate_to: localhost
when: boost_build_output.stderr
6 changes: 3 additions & 3 deletions Resources/Ansible_Windows/base_scripts/install_msys2.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
---
- name: Install MSYS2, Due to github-actions being dumb this has to be on the root of the drive
win_chocolatey:
chocolatey.chocolatey.win_chocolatey:
name: msys2
package_params: '/InstallDir="{{ drive }}:\msys64"'
package_params: /InstallDir="{{ drive }}:\msys64"
state: present

- name: Configure packages
import_tasks: configure_msys2_packages.yml
ansible.builtin.import_tasks: configure_msys2_packages.yml
40 changes: 23 additions & 17 deletions Resources/Ansible_Windows/base_scripts/install_pdcurses.yml
Original file line number Diff line number Diff line change
@@ -1,36 +1,42 @@
---
- name: Download PDCurses
win_get_url:
dest: '{{ drive }}:\{{ install_dir}}\pdcurses.zip'
url: "https://github.com/Bill-Gray/PDCursesMod/archive/refs/tags/v{{ pdcurses_version }}.zip"
ansible.windows.win_get_url:
dest: "{{ drive }}:\\{{ install_dir }}\\pdcurses.zip"
url: https://github.com/Bill-Gray/PDCursesMod/archive/refs/tags/v{{ pdcurses_version }}.zip
register: pdcurses_download_result

- name: Unzip PDCurses
win_unzip:
delete_archive: yes
src: '{{ drive }}:\{{ install_dir}}\pdcurses.zip'
dest: '{{ drive }}:\{{ install_dir}}'
community.windows.win_unzip:
delete_archive: true
src: "{{ drive }}:\\{{ install_dir }}\\pdcurses.zip"
dest: "{{ drive }}:\\{{ install_dir }}"
when: pdcurses_download_result.msg is defined and pdcurses_download_result.msg == "OK"

- name: Rename PDCurses
win_shell: "move PDCurses* pdcurses"
ansible.windows.win_shell: move PDCurses* pdcurses
args:
chdir: '{{ drive }}:\{{ install_dir }}'
chdir: "{{ drive }}:\\{{ install_dir }}"
when: pdcurses_download_result.msg is defined and pdcurses_download_result.msg == "OK"

- name: Build PDCurses
win_shell:
'{{ drive }}:\msys64\msys2_shell.cmd -mingw32 -defterm -no-start -here -c
"mingw32-make WIDE=Y CHTYPE_32=Y -j4" '
ansible.windows.win_shell: '{{ drive }}:\msys64\msys2_shell.cmd -mingw32 -defterm -no-start -here -c "mingw32-make WIDE=Y CHTYPE_32=Y -j4" '
args:
chdir: '{{ drive }}:\{{ install_dir }}\pdcurses\wincon'
chdir: "{{ drive }}:\\{{ install_dir }}\\pdcurses\\wincon"
register: pdcurses_build_output
when: pdcurses_download_result.msg is defined and pdcurses_download_result.msg == "OK"

- name: Log output to file
local_action: copy content={{ pdcurses_build_output.stdout }} dest=./pdcurses_output.log
when: pdcurses_build_output.stdout
ansible.builtin.copy:
content: "{{ pdcurses_build_output.stdout }}"
dest: ./pdcurses_output.log
mode: "0644"
delegate_to: localhost
when: pdcurses_build_output.stdout

- name: Log error output to file
local_action: copy content={{ pdcurses_build_output.stderr }} dest=./pdcurses_error_output.log
when: pdcurses_build_output.stderr
ansible.builtin.copy:
content: "{{ pdcurses_build_output.stderr }}"
dest: ./pdcurses_error_output.log
mode: "0644"
delegate_to: localhost
when: pdcurses_build_output.stderr
20 changes: 10 additions & 10 deletions Resources/Ansible_Windows/base_scripts/install_wpcapdll.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,27 +3,27 @@

# Leaving the installer so it can be installed manually for testing the xlha executable afterwards.
- name: Download NPCAP Installer
win_get_url:
dest: '{{ drive }}:\{{ install_dir}}\npcap.exe'
url: "https://npcap.com/dist/npcap-{{ npcap_version }}.exe"
ansible.windows.win_get_url:
dest: "{{ drive }}:\\{{ install_dir }}\\npcap.exe"
url: https://npcap.com/dist/npcap-{{ npcap_version }}.exe
register: npcapsdk_download_result

- name: Grab wpcap.dll, the installer does not allow for silent install so we are going to mess with it.
win_shell: '7z x npcap.exe -oNPcap -aoa'
ansible.windows.win_shell: 7z x npcap.exe -oNPcap -aoa
args:
chdir: '{{ drive }}:\{{ install_dir }}'
chdir: "{{ drive }}:\\{{ install_dir }}"
register: extract_npcap_result
when: (npcapsdk_download_result.msg is defined) and (npcapsdk_download_result.msg == "OK")

- name: Copy wpcap.dll
win_copy:
dest: '{{ drive }}:\\{{ install_dir }}\npcapsdk\wpcap.dll'
dest: "{{ drive }}:\\\\{{ install_dir }}\\npcapsdk\\wpcap.dll"
operation: file_copy
remote_src: yes
src: '{{ drive }}:\{{ install_dir }}\Npcap\wpcap.dll'
remote_src: true
src: "{{ drive }}:\\{{ install_dir }}\\Npcap\\wpcap.dll"
when: (npcapsdk_download_result.msg is defined) and (npcapsdk_download_result.msg == "OK")

- name: Remove NPCAP dir
win_file:
path: '{{ drive }}:\{{ install_dir }}\NPcap'
state: absent
path: "{{ drive }}:\\{{ install_dir }}\\NPcap"
state: absent
23 changes: 11 additions & 12 deletions Resources/Ansible_Windows/install.yml
Original file line number Diff line number Diff line change
@@ -1,21 +1,20 @@
---
- name: Installing XLink Handheld Assistant build environment
hosts: win

tasks:
- name: Grab variables
include_vars:
- name: Grab variables
ansible.builtin.include_vars:
file: vars.yml

- name: Install Base
import_tasks: install_base.yml
when: install_base == True
ansible.builtin.import_tasks: install_base.yml
when: install_base

- name: Install Runner
import_tasks: install_runner.yml
when: install_runner == True

- name: Install Development Environment
import_tasks: install_devenv.yml
when: install_devenv == True
ansible.builtin.import_tasks: install_runner.yml
when: install_runner

- name: Install Development Environment
ansible.builtin.import_tasks: install_devenv.yml
when: install_devenv
Loading

0 comments on commit a2dc186

Please sign in to comment.