From bf55ef35084736be46ccb4927b68bec25760d65f Mon Sep 17 00:00:00 2001 From: Thomas Bechtold Date: Thu, 29 Oct 2015 14:38:51 +0900 Subject: [PATCH] Add basic renderspec test integration Use renderspec to render the jinja2 templates into real RPM spec files. Abort if the conversion doesn't work. Change-Id: I31edbe16129a627236db0c980602ca23a0ba2a4a --- test-requirements.txt | 1 + tools/run_renderspec.sh | 18 ++++++++++++++++++ tox.ini | 20 ++++++++++++++++++++ 3 files changed, 39 insertions(+) create mode 100644 test-requirements.txt create mode 100755 tools/run_renderspec.sh create mode 100644 tox.ini diff --git a/test-requirements.txt b/test-requirements.txt new file mode 100644 index 000000000..496ed28ae --- /dev/null +++ b/test-requirements.txt @@ -0,0 +1 @@ +-e git+https://git.openstack.org/openstack/renderspec#egg=renderspec diff --git a/tools/run_renderspec.sh b/tools/run_renderspec.sh new file mode 100755 index 000000000..318bc8e01 --- /dev/null +++ b/tools/run_renderspec.sh @@ -0,0 +1,18 @@ +#!/bin/bash + +set -eux + +basedir=$1 +specdir=${basedir}/openstack/ + +WORKSPACE=${WORKSPACE:-$basedir} + +echo "run renderspec over specfiles from ${specdir}" +for spec in ${specdir}/**/*.spec.j2; do + mkdir -p $WORKSPACE/logs/ + for specstyle in "suse" "fedora"; do + echo "run ${spec} for ${specstyle}" + renderspec --spec-style ${specstyle} ${spec} \ + -o $WORKSPACE/logs/`basename ${spec}`.${specstyle} + done +done diff --git a/tox.ini b/tox.ini new file mode 100644 index 000000000..f15ff40a4 --- /dev/null +++ b/tox.ini @@ -0,0 +1,20 @@ +[tox] +minversion = 1.8 +envlist = rpm-packaging-lint +skipsdist = True + +[testenv] +setenv = VIRTUAL_ENV={envdir} +install_command = pip install -U {opts} {packages} +deps = -r{toxinidir}/test-requirements.txt +passenv = http_proxy HTTP_PROXY https_proxy HTTPS_PROXY no_proxy NO_PROXY + +[tox:jenkins] +downloadcache = ~/cache/pip + +[testenv:rpm-packaging-lint] +commands = + {toxinidir}/tools/run_renderspec.sh {toxinidir} + +[testenv:venv] +commands = {posargs}