Files
rpm-packaging/tools/run_speccleaner.sh
Thomas Bechtold b47b634de5 Introduce spec-cleaner to enforce spec styling
A new test-requirement called spec_cleaner is run on the
rendered spec files to check the style of a given spec.
This enforces a consistent style between spec files.
Also fix the currently available spec files to have a consistent
style.

Change-Id: I31957cc986e320798d5d6212e4d37fdf89b13b3d
2016-06-24 02:06:21 +02:00

33 lines
830 B
Bash
Executable File

#!/bin/bash
set -e
basedir=$1
WORKSPACE=${WORKSPACE:-$basedir}
# tempfile to store the spec-cleaner diff for all specs
tmpdir=$(mktemp -d)
echo "run spec-cleaner over specfiles from $WORKSPACE/logs/"
# 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
done
# check if some diffs are available
failed=0
for specdiff in $tmpdir/*; do
if [ -s "$specdiff" ]; then
echo "##### `basename ${specdiff}` ##### "
cat $specdiff
failed=1
fi
done
exit $failed