build-kernel/playbook.yml
2019-12-27 09:13:11 -06:00

62 lines
1.9 KiB
YAML

---
- hosts: buildservers
vars:
fedora_version: f31
patch_file: acso-5.4.6.patch # This patch has been the same since 4.18, renamed to appear more relevant
run_epoch: "{{ ansible_date_time.epoch }}"
build_dir: /tmp/{{ fedora_version }}_kernel
tasks:
# - name: Ensure libselinux-python is installed - no longer required on f31+?
# dnf:
# name: libselinux-python
# state: present
# become: true
- name: Ensure fedpkg is installed
dnf:
name: fedpkg
state: present
become: true
- name: Find old mock chroots
find:
paths: /var/lib/mock/
patterns: "*"
file_type: directory
recurse: yes
register: chroots_to_delete
- name: Clean old mock chroots
file:
path: "{{ item.path }}"
state: absent
with_items: "{{ chroots_to_delete.files }}"
become: true
- name: Clean old build dir
file:
path: "{{ build_dir }}"
state: absent
become: true
- name: Clone {{ fedora_version }} kernel to {{ build_dir }}
shell: fedpkg clone -a -b {{ fedora_version }} kernel {{ build_dir }}
- name: Copy patch to build dir
copy:
src: payload/{{ patch_file }}
dest: "{{ build_dir }}"
- name: Apply patch and build kernel (logs in {{ build_dir }}/results_kernel/*)
command: "{{ item }} chdir={{ build_dir }}"
with_items:
- ./scripts/newpatch.sh {{ patch_file }}
- /usr/bin/sed -i -e 's/%define buildid .*$/%define buildid .acspatch/' kernel.spec
- /usr/bin/make release
- fedpkg mockbuild
become: true
- name: Find RPMs in {{ build_dir }}/results_kernel/*/*/*.rpm
find:
paths: "{{ build_dir }}/results_kernel/"
recurse: yes
patterns: '*.rpm'
register: rpms
- name: Copy RPMs to /tmp/ (local)
fetch:
src: "{{ item.path }}"
dest: /tmp/
flat: yes
with_items: "{{ rpms.files }}"