Files
rpm-packaging/tools/run_renderspec.sh
Dirk Mueller e2da411fcd tools/run_renderspec: fail on syntax errors in the spec templates
running processes in the background with " &" means that the exit
code will get ignored by the surrounding shell, which causes
issues in renderspec invocation to be ignored by the linter job.

Rewrite the logic to use xargs so that we preserve the parallelism
but still capture the exit codes (although it happens out of band
so it is remaining hard to find in the output). Remove the py3 only
logic and always run it with both flags.

Change-Id: Idb5f9cd3d6264ad86ca5a9905234f072ece622ca
2018-08-09 14:38:06 +02:00

33 lines
882 B
Bash
Executable File

#!/bin/bash
set -eux
basedir=${1:-$PWD}
specdir=${basedir}/openstack/
WORKSPACE=${WORKSPACE:-$basedir}
OUTPUTDIR=$WORKSPACE/logs/
specstyles="suse fedora"
MAXPROC=4
# clean up output dir
for specstyle in $specstyles; do
mkdir -p $OUTPUTDIR/${specstyle}/
rm -rf $OUTPUTDIR/${specstyle}/*
done
count=0
echo "run renderspec over specfiles from ${specdir}"
for specstyle in $specstyles; do
find ${specdir} -name '*.spec.j2' -type f -print0 | \
xargs -n 1 -0 -P 0 -I __SPEC__ bash -c "
set -e
skip='--skip-pyversion py3'
if grep -q '%package -n python3-' __SPEC__; then
skip=""
fi
pkg_name=\$(pymod2pkg --dist $specstyle \$(basename __SPEC__ .spec.j2))
renderspec --spec-style $specstyle __SPEC__ \
\$skip -o $WORKSPACE/logs/$specstyle/\$pkg_name.spec"
done