b18f044dbe
When eg. running "tox -elint -- barbican", the rendering works fine but then the spec is not checked because barbican.spec.j2 renders to openstack-barbican.spec . Be more relaxed when trying to find the rendered spec file. Change-Id: I589c3f64bffcbadb9457fd96b29197e684516c86
40 lines
1015 B
Bash
Executable File
40 lines
1015 B
Bash
Executable File
#!/bin/bash
|
|
|
|
set -e
|
|
|
|
# 1st positional arg is the working dir
|
|
basedir=${1:-$PWD}
|
|
# 2nd positional arg is the find -name parameter
|
|
FIND_STR=${2:-*}
|
|
|
|
WORKSPACE=${WORKSPACE:-$basedir}
|
|
|
|
echo "run checks over specfiles from $WORKSPACE/logs/"
|
|
|
|
thome=$(mktemp -d)
|
|
cat openstack/openstack-macros/macros.openstack-singlespec > $thome/.rpmmacros
|
|
|
|
failed=0
|
|
for spec in `find $WORKSPACE/logs/suse/ -name "*${FIND_STR}.spec" -type f -print` ; do
|
|
echo "Checking $spec"
|
|
egrep -q '^Source:' $spec && {
|
|
echo "$spec should not have Source: lines. Please use Source0: instead."
|
|
failed=1
|
|
}
|
|
egrep -q '^%setup' $spec && {
|
|
echo "$spec should not use '%setup'. Please use '%autosetup' instead."
|
|
failed=1
|
|
}
|
|
|
|
pushd $(dirname $spec) >/dev/null
|
|
HOME=$thome rpmspec -q --qf "%{VERSION}\n" $(basename $spec) >/dev/null || {
|
|
echo "$spec does not parse properly. Please check your syntax."
|
|
failed=1
|
|
}
|
|
popd > /dev/null
|
|
done
|
|
|
|
rm -rf $thome
|
|
|
|
exit $failed
|