Repository navigation
oac-tree: refactor to use oac-tree bundle 1.3 #75
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
This file was deleted.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -8,7 +8,7 @@ | |
| loop: | ||
| - .flag | ||
| - oac-tree.sh.d | ||
| - lib/oac-tree/plugins | ||
| - "{{ distro.lib_dirname }}/oac-tree/plugins" | ||
| - src | ||
| become: true | ||
|
|
||
|
|
@@ -36,6 +36,11 @@ | |
| become: true | ||
| when: is_redhat | ||
|
|
||
| - name: "Check global rebuild flag" | ||
| stat: | ||
| path: "{{ oactree_install_path }}/.flag/REBUILD" | ||
| register: oactree_rebuild_flag | ||
|
|
||
| - name: "Clear global rebuild flag" | ||
| ansible.builtin.file: | ||
| path: "{{ oactree_install_path }}/.flag/REBUILD" | ||
|
|
@@ -50,10 +55,95 @@ | |
| become: true | ||
| loop: | ||
| - "{{ oactree_install_path }}/{{ distro.lib_dirname }}" | ||
| - "{{ oactree_install_path }}/lib/oac-tree/plugins" | ||
| - "/opt/epics/base-7.0.9/lib/linux-{{ ansible_facts['architecture'] }}" | ||
| - "/opt/epics/pvxs-1.3.1/lib/linux-{{ ansible_facts['architecture'] }}" | ||
| - "{{ oactree_install_path }}/{{ distro.lib_dirname }}/oac-tree/plugins" | ||
| - "{{ epics_install_path }}/base-{{ epics_base_version }}/lib/linux-{{ ansible_facts['architecture'] }}" | ||
| - "{{ epics_install_path }}/pvxs-{{ pvxs_version }}/lib/linux-{{ ansible_facts['architecture'] }}" | ||
|
|
||
| - name: "Check bundle source directory" | ||
| stat: | ||
| path: "{{ oactree_install_path }}/src/oac-tree-bundle" | ||
| register: oactree_bundle_dir | ||
|
Comment on lines
+62
to
+65
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This could likely come after the clone and anything that depends on this could instead depend on whether or not that task is changed. This is probably a better way to handle this in that this only checks if the src dir exists; with this other method you would actually know if the source had changed. |
||
|
|
||
| - name: "Clear bundle build flag" | ||
| ansible.builtin.file: | ||
| path: "{{ oactree_install_path }}/.flag/oac-tree-bundle" | ||
| state: absent | ||
| become: true | ||
| when: oactree_rebuild_flag.stat.exists == true or oactree_bundle_dir.stat.exists == false | ||
|
|
||
| - name: "Check bundle build flag" | ||
| stat: | ||
| path: "{{ oactree_install_path }}/.flag/oac-tree-bundle" | ||
| register: oactree_bundle_flag | ||
|
|
||
| - name: "Build oac-tree modules and plugins" | ||
| include_tasks: build_module.yml | ||
| loop: "{{ oactree_modules_list }}" | ||
| - name: "Set global rebuild flag if needed" | ||
| ansible.builtin.file: | ||
| path: "{{ oactree_install_path }}/.flag/REBUILD" | ||
| state: touch | ||
| modification_time: preserve | ||
| access_time: preserve | ||
| become: true | ||
| when: oactree_bundle_flag.stat.exists == false | ||
|
Comment on lines
+79
to
+86
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm not sure I understand what exactly is happening with this logic. I don't see anywhere outside of this task that modifies this flag. Moreover, as I read the logic:
The problem as I see it is that the order suggests that this will re-run the build every time: since we are building we set the rebuild flag, and hence next time we trigger a rebuild, etc. etc. Am I missing something? Is there an external way to set this rebuild flag?
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. That's a left-over from building the modules separately (without the bundle parent dir). You have a number of modules that are built in a specific order (flattened dependency tree). |
||
|
|
||
| - name: "Clone oac-tree-bundle repository" | ||
| ansible.builtin.git: | ||
| repo: "{{ oactree_bundle_repo }}" | ||
| dest: "{{ oactree_install_path }}/src/oac-tree-bundle" | ||
| version: "{{ oactree_bundle_version }}" | ||
| recursive: true | ||
| become: true | ||
| when: oactree_bundle_flag.stat.exists == false | ||
|
|
||
| - name: "Create build directory" | ||
| ansible.builtin.file: | ||
| path: "{{ oactree_install_path }}/src/oac-tree-bundle/build" | ||
| state: directory | ||
| become: true | ||
| when: oactree_bundle_flag.stat.exists == false | ||
|
|
||
| - name: "Run cmake" | ||
| command: | ||
| chdir: "{{ oactree_install_path }}/src/oac-tree-bundle/build" | ||
| cmd: "cmake -DCMAKE_INSTALL_PREFIX={{ oactree_install_path }} -DCMAKE_PREFIX_PATH={{ oactree_install_path }} .." | ||
| environment: | ||
| EPICS_BASE: "{{ epics_install_path }}/base-{{ epics_base_version }}" | ||
| EPICS_HOST_ARCH: "linux-{{ ansible_facts['architecture'] }}" | ||
| PVXS_DIR: "{{ epics_install_path }}/pvxs-{{ pvxs_version }}" | ||
| CMAKE_PREFIX_PATH: "{{ oactree_install_path }}" | ||
| become: true | ||
| when: oactree_bundle_flag.stat.exists == false | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. All of these might be better suited to be in a block, as they are consecutive tasks that depend on a common condition. |
||
|
|
||
| - name: "Run make (build and install everything - this may take a while)" | ||
| command: make -j {{ ansible_facts.processor_vcpus }} -C {{ oactree_install_path }}/src/oac-tree-bundle/build | ||
| register: build_result | ||
| environment: | ||
| EPICS_BASE: "{{ epics_install_path }}/base-{{ epics_base_version }}" | ||
| EPICS_HOST_ARCH: "linux-{{ ansible_facts['architecture'] }}" | ||
| PVXS_DIR: "{{ epics_install_path }}/pvxs-{{ pvxs_version }}" | ||
| CMAKE_PREFIX_PATH: "{{ oactree_install_path }}" | ||
| become: true | ||
| when: oactree_bundle_flag.stat.exists == false | ||
|
|
||
| - name: "Update linker configuration" | ||
| ansible.builtin.command: ldconfig | ||
| become: true | ||
| when: oactree_bundle_flag.stat.exists == false and build_result.rc | default(0) == 0 | ||
|
|
||
| - name: "Create oac-tree.sh fragment" | ||
| copy: | ||
| content: "PATH={{ oactree_install_path }}/bin:$PATH\n" | ||
| dest: "{{ oactree_install_path }}/oac-tree.sh.d/00-oac-tree" | ||
| become: true | ||
|
|
||
| - name: "Update (re-assemble) oac-tree.sh" | ||
| assemble: | ||
| src: "{{ oactree_install_path }}/oac-tree.sh.d" | ||
| dest: "/etc/profile.d/oac-tree.sh" | ||
| become: true | ||
|
|
||
| - name: "Create bundle build flag" | ||
| copy: | ||
| content: "" | ||
| dest: "{{ oactree_install_path }}/.flag/oac-tree-bundle" | ||
| become: true | ||
| when: build_result.rc | default(0) == 0 and oactree_bundle_flag.stat.exists == false | ||
|
Comment on lines
+144
to
+149
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think you can do this more cleanly using the file module and state
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. True. Will do. |
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If flags are to be used, I think it would be good to variable-ise them. e.g.
{{ oactree_build_flag }}