rpm-packaging/tools/run_speccleaner.sh
Haikel Guemar 220bb64df0 Tooling: set default behaviour
Tools will run on current directory if no input is given.
Add tools/README.rst for brief documentation

Change-Id: Id8c68c12191591d70ae22293b0b99048998fb1a4
2016-07-07 20:43:40 +02:00

33 lines
838 B
Bash
Executable File

#!/bin/bash
set -e
basedir=${1:-$PWD}
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