Skip to content

Commit

Permalink
add iocStats.yml and patch file capability
Browse files Browse the repository at this point in the history
  • Loading branch information
gilesknap committed Mar 11, 2025
1 parent 5a2bac8 commit ff171b5
Show file tree
Hide file tree
Showing 8 changed files with 96 additions and 10 deletions.
1 change: 1 addition & 0 deletions _ansible/group_vars/all.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# global settings for all support modules

# paths
ibek_support_folder: /epics/generic-source/ibek-support/{{ module }}
epics_folder: /epics
support_folder: /epics/support
configure_folder: "{{support_folder}}/configure"
Expand Down
15 changes: 14 additions & 1 deletion _ansible/roles/support/tasks/clone.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,17 @@
dest: "{{ local_path }}"
version: "{{ version }}"
update: "{{ force_clone | bool }}"
depth: 1
depth: "{{ 1 if patch_file.commit | default(false) else 0 }}"

# get a specific commit to apply a patch
- name: Get specific commit to prepare for patch
ansible.builtin.shell: |
cd "{{ local_path }}" &&
git reset --hard "{{ patch_file.commit }}"
when: patch_file.when | default(false) and patch_file.commit

- name: Patch file
ansible.builtin.shell: |
cd "{{ local_path }}" &&
git apply "{{ patch_file.path }}"
when: patch_file.when | default(false)
12 changes: 6 additions & 6 deletions _ansible/roles/support/tasks/main.yml
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
- name: System
- name: System Installs
ansible.builtin.include_tasks: system.yml
tags: [system]

- name: Clone
ansible.builtin.include_tasks: clone.yml
tags: [clone]

- name: Setup Configure/RELEASE
- name: Pre Build
ansible.builtin.include_tasks: pre_build.yml
tags: [pre_build]

- name: Fixup Configure/RELEASE
ansible.builtin.include_tasks: release.yml
tags: [release]

- name: Config
ansible.builtin.include_tasks: config.yml
tags: [config]

- name: Build
ansible.builtin.include_tasks: build.yml
tags: [build]
Expand Down
14 changes: 13 additions & 1 deletion _ansible/roles/support/tasks/post_build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,4 +47,16 @@
line: "{{ item }}"
regexp: "^{{ item }}$"
create: true
loop: "{{ dbds }}"
loop: "{{ dbds }}"

# Patching #####################################################################

# ad hoc patching of individual lines
- name: Patch lines
ansible.builtin.lineinfile:
path: "{{ item.path }}"
line: "{{ item.line }}"
regexp: "{{ item.regexp }}"
create: true
loop: "{{ patch_lines }}"
when: item.when | default(true) and (item.post_build | default(false) | bool)
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
tags: [config]
block:

- name: Patch Makefiles etc.
- name: Comment out lines in Makefiles etc.
ansible.builtin.replace:
path: "{{ local_path }}/{{ item.path }}"
regexp: "^(?!#)(.*{{ item.regexp }}.*$)"
Expand All @@ -17,3 +17,14 @@
create: true
when: '"RTEMS" in target_arch'

# ad hoc patching of individual lines
- name: Patch lines
ansible.builtin.lineinfile:
path: "{{ item.path }}"
line: "{{ item.line }}"
regexp: "{{ item.regexp }}"
create: true
loop: "{{ patch_lines }}"
when: item.when | default(true) and not (item.post_build | default(false) | bool)


17 changes: 17 additions & 0 deletions _ansible/roles/support/vars/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@ force_clone: false

# quick access to the target architecture
target_arch: "{{ lookup('ansible.builtin.env', 'EPICS_TARGET_ARCH') }}"
is_rtems: "{{ 'RTEMS' in target_arch }}"
is_linux: "{{ 'linux' in target_arch }}"

# patching options #############################################################

Expand All @@ -46,6 +48,21 @@ target_arch: "{{ lookup('ansible.builtin.env', 'EPICS_TARGET_ARCH') }}"
# regex: .*testBusy.*
comment_out: []

# files to patch individual lines in e.g.
# patch_lines:
# - path: "{{ config_linux_target }}"
# regexp: TIRPC
# line: TIRPC = YES
# when: is_linux # defaults to any
# post_build: true # defaults to false
patch_lines: []

# apply a patch file to the repository before compilation
patch_file:
path: # path to the patch file
commit: # optional commit to apply the patch to
when: # can be true, is_linux or is_rtems or any bool

# packages to install in developer target
apt_developer: []

Expand Down
2 changes: 1 addition & 1 deletion asyn/asyn.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ apt_developer:
apt_runtime:
- libtirpc3

patch_files:
patch_lines:
- path: "{{ config_linux_target }}"
regexp: TIRPC
line: TIRPC = YES
Expand Down
32 changes: 32 additions & 0 deletions iocStats/iocStats.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
module: iocStats
version: 3.2.0
dbds:
- devIocStats.dbd
libs:
- devIocStats

apt_developer:
- libtirpc-dev
apt_runtime:
- libtirpc3

patch_lines:
# fixup incorrect timezone variable name in template. TODO: why is this needed?
- path: "{{ local_path }}/db/iocAdminSoft.db"
regexp: "@EPICS_TIMEZONE"
line: ' field(INP, "@EPICS_TZ")'
post_build: true

patch_file:
path: "{{ ibek_support_folder }}/iocStats.patch"
commit: 4226b12
when: is_rtems

remove_macros:
- SNCSEQ
- IPAC

comment_out:
# don't build tests
- path: Makefile
regexp: += test

0 comments on commit ff171b5

Please # to comment.