tests: Avoid using koji to download srpm

Just download the actual source tarball from the spec file
using the fedpkg command and use dit directly.
This commit is contained in:
Stef Walter 2017-08-22 21:09:19 +02:00
parent b78097c2c8
commit cabb5ce26c

View File

@ -8,12 +8,20 @@
tasks: tasks:
# XXX: move to standard-test-roles, e.g. standard-test-get-source # XXX: move to standard-test-roles, e.g. standard-test-get-source
- name: install koji - name: install requirements
package: name={{item}} state=present # XXX: state=latest package: name={{item}} state=present # XXX: state=latest
with_items: with_items:
- koji - fedpkg
- rpm-build
- dnf-plugins-core # The dist doesn't actually matter here
- name: download and extract sources
command: fedpkg --dist=master prep
args:
chdir: "{{playbook_dir}}/.."
- name: get source directory from environment
shell: "rpm -q --specfile {{playbook_dir}}/../rpm-ostree.spec --qf '{{playbook_dir}}/../%{NAME}-%{VERSION}\n' | head -n1"
register: srcdir
- name: provision VM - name: provision VM
qemu_provision: qemu_provision:
@ -25,46 +33,8 @@
vmssh: ssh -F {{qemu.statedir}}/ssh-config vmcheck vmssh: ssh -F {{qemu.statedir}}/ssh-config vmcheck
- block: - block:
- name: get source rpm from environment
command: "{{vmssh}} rpm -q rpm-ostree --qf '%{SOURCERPM}'"
register: srpm
- name: create temporary source dir
tempfile: state=directory
register: tmpd
# XXX: this approach is probably going to break apart once we start
# running tests per dist-git PR (since they'll probably not be built in
# koji anymore)
- name: download source rpm
command: koji download-build --rpm {{srpm.stdout}}
args:
chdir: "{{tmpd.path}}"
- set_fact:
srpmpath: "{{tmpd.path}}/{{srpm.stdout}}"
- name: install build dependencies
command: dnf builddep -y {{srpmpath}}
- name: extract source rpm
command: >
rpmbuild --define "_srcrpmdir {{tmpd.path}}"
--define "_buildrootdir {{tmpd.path}}"
--define "_rpmdir {{tmpd.path}}"
--define "_specdir {{tmpd.path}}"
--define "_sourcedir {{tmpd.path}}"
--define "_builddir {{tmpd.path}}"
-rp {{srpmpath}}
# XXX: this should be made a param to the role and kept in sync with %setup
# -n $DIR. here we just assume the default name in case -n is not used
- name: construct buildsubdir from rpmdb
command: rpm -qp {{srpmpath}} --qf '{{tmpd.path}}/%{NAME}-%{VERSION}'
register: buildsubdir
- name: import ssh-config - name: import ssh-config
command: cp {{qemu.statedir}}/ssh-config {{buildsubdir.stdout}} command: cp {{qemu.statedir}}/ssh-config {{srcdir.stdout}}
# XXX: need to upstream this # XXX: need to upstream this
- name: create and rebase onto vmcheck - name: create and rebase onto vmcheck
@ -85,10 +55,10 @@
VMTESTS: 1 VMTESTS: 1
SKIP_VMOVERLAY: 1 SKIP_VMOVERLAY: 1
TESTS: basic layering-basic TESTS: basic layering-basic
topsrcdir: "{{buildsubdir.stdout}}" topsrcdir: "{{srcdir.stdout}}"
commondir: "{{buildsubdir.stdout}}/tests/common" commondir: "{{srcdir.stdout}}/tests/common"
args: args:
chdir: "{{buildsubdir.stdout}}" chdir: "{{srcdir.stdout}}"
always: always:
- name: teardown VM - name: teardown VM
@ -97,10 +67,7 @@
- name: fetch vmcheck results - name: fetch vmcheck results
synchronize: synchronize:
src: "{{buildsubdir.stdout}}/vmcheck/" src: "{{srcdir.stdout}}/vmcheck/"
dest: "{{artifacts}}/vmcheck" dest: "{{artifacts}}/vmcheck"
mode: pull mode: pull
delete: yes delete: yes
- name: delete temporary dir
file: path="{{tmpd.path}}" state=absent