From f0115c54690f4d7aeb0ec1f148c509e051092623 Mon Sep 17 00:00:00 2001 From: Fabien Boucher Date: Aug 14 2019 09:56:53 +0000 Subject: Add the fedpkg-build role Also add full src_dir path for repo on mock-srpm-build role. --- diff --git a/roles/fedpkg-build/defaults/main.yaml b/roles/fedpkg-build/defaults/main.yaml new file mode 100644 index 0000000..7ce3258 --- /dev/null +++ b/roles/fedpkg-build/defaults/main.yaml @@ -0,0 +1,2 @@ +scratch_build: True +target: rawhide diff --git a/roles/fedpkg-build/tasks/main.yaml b/roles/fedpkg-build/tasks/main.yaml new file mode 100644 index 0000000..df0e911 --- /dev/null +++ b/roles/fedpkg-build/tasks/main.yaml @@ -0,0 +1,30 @@ +- name: Install system dependencies + yum: + name: "fedpkg,koji,createrepo" + state: latest + become: true + +- name: Create repo directory + file: + path: "{{ ansible_user_dir }}/repo" + state: directory + +- name: Build package in Fedora build system {% if scratch_build %}(scratch build){% endif %} + command: | + fedpkg build {% if scratch_build %} --scratch --srpm {{ srpm }}{% endif %} --target {{ target }} + register: fedpkg_build + +- name: Get task ID + set_fact: + task_id: "{{ fedpkg_build.stdout | regex_replace('\n', ' ') | regex_replace('.*Created task: (\\d+).*$', '\\1') }}" + +- name: Download artifacts from Koji + command: | + koji download-task --logs {{ task_id }} + args: + chdir: "{{ ansible_user_dir }}/repo" + +- name: Create repository + command: createrepo . + args: + chdir: "{{ ansible_user_dir }}/repo" diff --git a/roles/mock-srpm-build/tasks/main.yaml b/roles/mock-srpm-build/tasks/main.yaml index 42be02d..02b8196 100644 --- a/roles/mock-srpm-build/tasks/main.yaml +++ b/roles/mock-srpm-build/tasks/main.yaml @@ -21,7 +21,7 @@ - name: Retrieve sources shell: > spectool -g -C {{ ansible_user_dir }}/SOURCES - {{ zuul.project.src_dir }}/*.spec + {{ ansible_user_dir }}/{{ zuul.project.src_dir }}/*.spec - name: Init the mock chroot command: mock {{ mock_opts }} --init @@ -29,7 +29,7 @@ - name: Build the SRPM shell: > mock {{ mock_opts }} --buildsrpm - --spec {{ zuul.project.src_dir }}/*.spec + --spec {{ ansible_user_dir }}/{{ zuul.project.src_dir }}/*.spec --sources {{ ansible_user_dir }}/SOURCES - name: Rename log file with srpm prefix