tools: parallelize execution

Parallelize renderspec and spec-cleaner executions to speed up scripts.
There is no constraint to run these jobs sequentially

Change-Id: I7bdeee82cc360cf31e9684ef22638f41c53b12b8
This commit is contained in:
Haikel Guemar 2016-07-17 20:06:14 +02:00
parent bcee8480d3
commit 9bbc588472
2 changed files with 14 additions and 2 deletions

View File

@ -8,6 +8,7 @@ specdir=${basedir}/openstack/
WORKSPACE=${WORKSPACE:-$basedir}
OUTPUTDIR=$WORKSPACE/logs/
specstyles="suse fedora"
MAXPROC=4
mkdir -p $OUTPUTDIR
@ -16,11 +17,16 @@ for specstyle in $specstyles; do
rm -f $OUTPUTDIR/*.${specstyle}
done
count=0
echo "run renderspec over specfiles from ${specdir}"
for spec in ${specdir}/**/*.spec.j2; do
for specstyle in $specstyles; do
echo "run ${spec} for ${specstyle}"
renderspec --spec-style ${specstyle} ${spec} \
-o $WORKSPACE/logs/${spec##*/}.${specstyle}
-o $WORKSPACE/logs/${spec##*/}.${specstyle} &
let count+=1
[[ count -eq $MAXPROC ]] && wait && count=0
done
done
wait

View File

@ -7,18 +7,24 @@ basedir=${1:-$PWD}
WORKSPACE=${WORKSPACE:-$basedir}
# tempfile to store the spec-cleaner diff for all specs
tmpdir=$(mktemp -d)
MAXPROC=4
echo "run spec-cleaner over specfiles from $WORKSPACE/logs/"
count=0
# TODO(toabctl): also run spec-cleaner with non-SUSE specs
# but the current problem is that the license check works for SUSE only
for spec in $WORKSPACE/logs/*.suse ; do
# NOTE(toabctl):spec-cleaner can not ignore epochs currently
sed -i '/^Epoch:.*/d' $spec
spec-cleaner -m -d --no-copyright --diff-prog "diff -uw" \
$spec > $tmpdir/`basename ${spec}`.cleaner.diff
$spec > $tmpdir/`basename ${spec}`.cleaner.diff &
let count+=1
[[ count -eq $MAXPROC ]] && wait && count=0
done
wait
# check if some diffs are available
failed=0
for specdiff in $tmpdir/*; do