Allow lint runs for a single spec

Currently, a "tox -e lint" run takes a lot of time. But when
developing locally and changing a single spec template, this is
annoying.
So allow a second positional argument for the 3 tools from the tools/
directory which is a string used by the "-name" argument from
"find". With that, it is possible to call lint for a single spec
template with eg:

tox -elint python-cliff

Change-Id: I1ba05ed4e353728d251105fc7ad356d759813481
This commit is contained in:
Thomas Bechtold 2019-04-10 13:36:09 +02:00
parent e4ba384c8e
commit ccdae17907
4 changed files with 18 additions and 6 deletions

View File

@ -2,7 +2,11 @@
set -eux
# 1st positional arg is the working dir
basedir=${1:-$PWD}
# 2nd positional arg is the find -name parameter
FIND_STR=${2:-*}
specdir=${basedir}/openstack/
WORKSPACE=${WORKSPACE:-$basedir}
@ -19,7 +23,7 @@ done
count=0
echo "run renderspec over specfiles from ${specdir}"
for specstyle in $specstyles; do
find ${specdir} -name '*.spec.j2' -type f -print0 | \
find ${specdir} -name "${FIND_STR}.spec.j2" -type f -print0 | \
xargs -n 1 -0 -P 0 -I __SPEC__ bash -c "
set -e
skip='--skip-pyversion py3'

View File

@ -2,7 +2,10 @@
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}
@ -12,7 +15,8 @@ thome=$(mktemp -d)
cat openstack/openstack-macros/macros.openstack-singlespec > $thome/.rpmmacros
failed=0
for spec in $WORKSPACE/logs/suse/*.spec ; do
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

View File

@ -2,7 +2,10 @@
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}
# tempfile to store the spec-cleaner diff for all specs
@ -14,7 +17,8 @@ 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/*.spec ; do
for spec in `find $WORKSPACE/logs/suse/ -name "${FIND_STR}.spec" -type f -print` ; do
echo "spec-cleaner checking $spec"
# NOTE(toabctl):spec-cleaner can not ignore epochs currently
sed -i '/^Epoch:.*/d' $spec
# NOTE(jpena): spec-cleaner wants python2/python3 instead of

View File

@ -14,9 +14,9 @@ passenv = http_proxy HTTP_PROXY https_proxy HTTPS_PROXY no_proxy NO_PROXY
[testenv:linters]
commands =
{toxinidir}/tools/run_renderspec.sh {toxinidir}
{toxinidir}/tools/run_specchecks.sh {toxinidir}
{toxinidir}/tools/run_speccleaner.sh {toxinidir}
{toxinidir}/tools/run_renderspec.sh {toxinidir} {posargs}
{toxinidir}/tools/run_specchecks.sh {toxinidir} {posargs}
{toxinidir}/tools/run_speccleaner.sh {toxinidir} {posargs}
# compat. remove me
[testenv:lint]