Skip to content

Commit e956152

Browse files
committed
bootlinux: Refactor builder workflow to use modular package tasks
Simplify the builder workflow by using the new modular package generation tasks instead of duplicating package building logic. Generated-by: Claude AI Signed-off-by: Daniel Gomez <da.gomez@samsung.com>
1 parent 7b8bfdf commit e956152

File tree

1 file changed

+19
-119
lines changed

1 file changed

+19
-119
lines changed

playbooks/roles/bootlinux/tasks/build/builder.yml

Lines changed: 19 additions & 119 deletions
Original file line numberDiff line numberDiff line change
@@ -142,125 +142,25 @@
142142
when:
143143
- bootlinux_compiler_clang|bool
144144

145-
- name: Remove the old artifacts directory on the control host
146-
delegate_to: localhost
147-
ansible.builtin.file:
148-
path: "{{ bootlinux_artifacts_dir }}"
149-
state: absent
150-
151-
- name: Ensure an empty artifacts directory exists on the control host
152-
delegate_to: localhost
153-
run_once: true
154-
ansible.builtin.file:
155-
path: "{{ bootlinux_artifacts_dir }}"
156-
state: directory
157-
mode: "u=rwx,g=rx,o=rx"
158-
159-
- name: Build kernel .deb packages
160-
when:
161-
- ansible_os_family == "Debian"
162-
block:
163-
- name: Make the bindeb-pkg target
164-
community.general.make:
165-
chdir: "{{ target_linux_dir_path }}"
166-
jobs: "{{ ansible_processor_nproc }}"
167-
target: "bindeb-pkg"
168-
169-
- name: Find the build artifacts
170-
ansible.builtin.find:
171-
paths: "{{ artifact_paths }}"
172-
patterns: "*.deb"
173-
file_type: file
174-
recurse: true
175-
register: found_debs
176-
177-
- name: Fetch the build artifacts to the control host
178-
ansible.builtin.fetch:
179-
src: "{{ item.path }}"
180-
dest: "{{ bootlinux_artifacts_dir }}/"
181-
flat: true
182-
loop: "{{ found_debs.files }}"
183-
loop_control:
184-
label: "Fetching {{ item.path | basename }} ..."
185-
186-
- name: Build kernel .rpm packages
187-
when:
188-
- ansible_os_family != "Debian"
189-
block:
190-
- name: Build the list of artifacts directories on the builder
191-
ansible.builtin.set_fact:
192-
artifact_paths:
193-
- "{{ target_linux_dir_path }}/rpmbuild/RPMS"
194-
- "{{ ansible_env.HOME }}/rpmbuild/RPMS"
195-
196-
- name: Wipe the artifact directories on the builder
197-
ansible.builtin.file:
198-
path: "{{ item }}"
199-
state: absent
200-
loop: "{{ artifact_paths }}"
201-
loop_control:
202-
label: "Deleting {{ item }} ..."
203-
204-
- name: Create empty artifact directories on the builder
205-
ansible.builtin.file:
206-
path: "{{ item }}"
207-
state: directory
208-
mode: "u=rwx,g=rx,o=rx"
209-
loop: "{{ artifact_paths }}"
210-
loop_control:
211-
label: "Creating {{ item }} ..."
212-
213-
- name: Make the binrpm-pkg target
214-
community.general.make:
215-
chdir: "{{ target_linux_dir_path }}"
216-
jobs: "{{ ansible_processor_nproc }}"
217-
target: "binrpm-pkg"
218-
params:
219-
RPMOPTS: "--without devel"
220-
when:
221-
- bootlinux_compiler_gcc|bool
222-
223-
- name: Make the binrpm-pkg target
224-
community.general.make:
225-
chdir: "{{ target_linux_dir_path }}"
226-
jobs: "{{ ansible_processor_nproc }}"
227-
target: "binrpm-pkg"
228-
params:
229-
RPMOPTS: "--without devel"
230-
LLVM: 1
231-
when:
232-
- bootlinux_compiler_clang|bool
233-
234-
- name: Find the build artifacts
235-
ansible.builtin.find:
236-
paths: "{{ artifact_paths }}"
237-
patterns: "*.rpm"
238-
file_type: file
239-
recurse: true
240-
register: found_rpms
241-
242-
- name: Fetch the build artifacts to the control host
243-
ansible.builtin.fetch:
244-
src: "{{ item.path }}"
245-
dest: "{{ bootlinux_artifacts_dir }}/"
246-
flat: true
247-
loop: "{{ found_rpms.files }}"
248-
loop_control:
249-
label: "Fetching {{ item.path | basename }} ..."
250-
251-
- name: Extract the release information of the built kernel
252-
community.general.make:
253-
chdir: "{{ target_linux_dir_path }}"
254-
target: "kernelrelease"
255-
register: kernelrelease
256-
257-
- name: Store the kernel release information with the build artifacts
258-
delegate_to: localhost
259-
ansible.builtin.lineinfile:
260-
create: true
261-
line: "{{ kernelrelease.stdout }}"
262-
mode: "u=rw,g=r,o=r"
263-
path: "{{ bootlinux_artifacts_dir }}/kernel.release"
145+
- name: Prepare artifacts directory for builder packages
146+
ansible.builtin.include_tasks: ../packages/prepare-artifacts-dir.yml
147+
vars:
148+
artifacts_target_dir: "{{ bootlinux_artifacts_dir }}"
149+
artifacts_clean: true
150+
artifacts_organize_by_version: false
151+
152+
- name: Generate kernel packages on builder node
153+
ansible.builtin.include_tasks: ../packages/generate-packages.yml
154+
vars:
155+
kernel_build_dir: "{{ target_linux_dir_path }}"
156+
package_generation_mode: "remote"
157+
package_jobs: "{{ ansible_processor_nproc }}"
158+
build_environment: "{{ bootlinux_build_environment | default({}) }}"
159+
160+
- name: Collect package artifacts from builder to controller
161+
ansible.builtin.include_tasks: ../packages/collect-artifacts.yml
162+
vars:
163+
artifacts_source_mode: "remote"
264164

265165
- name: Skip the kernel install steps
266166
ansible.builtin.meta: end_play

0 commit comments

Comments
 (0)