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:
parent
bcee8480d3
commit
9bbc588472
@ -8,6 +8,7 @@ specdir=${basedir}/openstack/
|
|||||||
WORKSPACE=${WORKSPACE:-$basedir}
|
WORKSPACE=${WORKSPACE:-$basedir}
|
||||||
OUTPUTDIR=$WORKSPACE/logs/
|
OUTPUTDIR=$WORKSPACE/logs/
|
||||||
specstyles="suse fedora"
|
specstyles="suse fedora"
|
||||||
|
MAXPROC=4
|
||||||
|
|
||||||
mkdir -p $OUTPUTDIR
|
mkdir -p $OUTPUTDIR
|
||||||
|
|
||||||
@ -16,11 +17,16 @@ for specstyle in $specstyles; do
|
|||||||
rm -f $OUTPUTDIR/*.${specstyle}
|
rm -f $OUTPUTDIR/*.${specstyle}
|
||||||
done
|
done
|
||||||
|
|
||||||
|
count=0
|
||||||
echo "run renderspec over specfiles from ${specdir}"
|
echo "run renderspec over specfiles from ${specdir}"
|
||||||
for spec in ${specdir}/**/*.spec.j2; do
|
for spec in ${specdir}/**/*.spec.j2; do
|
||||||
for specstyle in $specstyles; do
|
for specstyle in $specstyles; do
|
||||||
echo "run ${spec} for ${specstyle}"
|
echo "run ${spec} for ${specstyle}"
|
||||||
renderspec --spec-style ${specstyle} ${spec} \
|
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
|
||||||
done
|
done
|
||||||
|
|
||||||
|
wait
|
||||||
|
@ -7,18 +7,24 @@ basedir=${1:-$PWD}
|
|||||||
WORKSPACE=${WORKSPACE:-$basedir}
|
WORKSPACE=${WORKSPACE:-$basedir}
|
||||||
# tempfile to store the spec-cleaner diff for all specs
|
# tempfile to store the spec-cleaner diff for all specs
|
||||||
tmpdir=$(mktemp -d)
|
tmpdir=$(mktemp -d)
|
||||||
|
MAXPROC=4
|
||||||
|
|
||||||
echo "run spec-cleaner over specfiles from $WORKSPACE/logs/"
|
echo "run spec-cleaner over specfiles from $WORKSPACE/logs/"
|
||||||
|
|
||||||
|
count=0
|
||||||
# TODO(toabctl): also run spec-cleaner with non-SUSE specs
|
# TODO(toabctl): also run spec-cleaner with non-SUSE specs
|
||||||
# but the current problem is that the license check works for SUSE only
|
# but the current problem is that the license check works for SUSE only
|
||||||
for spec in $WORKSPACE/logs/*.suse ; do
|
for spec in $WORKSPACE/logs/*.suse ; do
|
||||||
# NOTE(toabctl):spec-cleaner can not ignore epochs currently
|
# NOTE(toabctl):spec-cleaner can not ignore epochs currently
|
||||||
sed -i '/^Epoch:.*/d' $spec
|
sed -i '/^Epoch:.*/d' $spec
|
||||||
spec-cleaner -m -d --no-copyright --diff-prog "diff -uw" \
|
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
|
done
|
||||||
|
|
||||||
|
wait
|
||||||
|
|
||||||
# check if some diffs are available
|
# check if some diffs are available
|
||||||
failed=0
|
failed=0
|
||||||
for specdiff in $tmpdir/*; do
|
for specdiff in $tmpdir/*; do
|
||||||
|
Loading…
x
Reference in New Issue
Block a user