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
This commit is contained in:
parent
275b9ae68d
commit
e2da411fcd
@ -16,25 +16,17 @@ for specstyle in $specstyles; do
|
||||
rm -rf $OUTPUTDIR/${specstyle}/*
|
||||
done
|
||||
|
||||
py3onlypackages=("openstack-glance openstack-keystone")
|
||||
|
||||
count=0
|
||||
echo "run renderspec over specfiles from ${specdir}"
|
||||
for specstyle in $specstyles; do
|
||||
for spec in ${specdir}/**/*.spec.j2; do
|
||||
echo "run ${spec} for ${specstyle}"
|
||||
pkg_name=$(pymod2pkg --dist $specstyle $(basename $spec .spec.j2))
|
||||
if [[ ! " ${py3onlypackages[@]} " =~ " ${pkg_name} " ]];then
|
||||
skip="--skip-pyversion py3"
|
||||
else
|
||||
skip=""
|
||||
fi
|
||||
renderspec --spec-style ${specstyle} ${spec} \
|
||||
--requirements $basedir/global-requirements.txt ${skip} \
|
||||
-o $WORKSPACE/logs/${specstyle}/$pkg_name.spec &
|
||||
let count+=1
|
||||
[[ count -eq $MAXPROC ]] && wait && count=0
|
||||
done
|
||||
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
|
||||
|
||||
wait
|
||||
|
Loading…
Reference in New Issue
Block a user