build-kernel/playbook.yml
2019-02-25 21:48:16 -06:00

62 lines
1.8 KiB
YAML

---
- hosts: buildservers
vars:
fedora_version: f29
patch_file: acso-4.18.patch # This patch file works with 4.19.12 Fedora srpms currently.
run_epoch: "{{ ansible_date_time.epoch }}"
build_dir: /tmp/{{ fedora_version }}_kernel
tasks:
- name: Ensure libselinux-python is installed
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 }}"