From a1fdd1d55a452c22ef37fd96245cb2ddc1a6dfdf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jaime=20Caama=C3=B1o=20Ruiz?= Date: Fri, 19 Jul 2019 02:09:03 +0200 Subject: [PATCH] tools: fix validation of some py3 specs Assuming the reason run_renderspec skipped py3 was to avoid speccleaner complaining about single line py2 and py3 BuildRequires, this patch changes the way to achieve that while supporting other different ways to write py3 specs that would otherwise would not be recognized as py3 only and end up with blank BuildRequires and the like, specifically: * singlespecs with py3 flavor only (new networking-l2gw spec) * py3 specs for which the package name is rendered instead of forced (networking-generic-switch) Change-Id: I62fad6d140338ee9af7eca144edb4ae6e96f6007 --- tools/run_renderspec.sh | 6 +----- tools/run_speccleaner.sh | 10 ++++++++++ 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/tools/run_renderspec.sh b/tools/run_renderspec.sh index 17d0bed6d..a92282f8a 100755 --- a/tools/run_renderspec.sh +++ b/tools/run_renderspec.sh @@ -26,11 +26,7 @@ for specstyle in $specstyles; do 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' - if grep -q '%package -n python3-' __SPEC__; then - skip="" - fi pkg_name=\$(pymod2pkg --dist $specstyle \$(basename __SPEC__ .spec.j2)) renderspec --spec-style $specstyle __SPEC__ \ - \$skip -o $WORKSPACE/logs/$specstyle/\$pkg_name.spec" + -o $WORKSPACE/logs/$specstyle/\$pkg_name.spec" done diff --git a/tools/run_speccleaner.sh b/tools/run_speccleaner.sh index 1a2ec4639..ec4756bf7 100755 --- a/tools/run_speccleaner.sh +++ b/tools/run_speccleaner.sh @@ -26,6 +26,16 @@ for spec in `find $WORKSPACE/logs/suse/ -name "${FIND_STR}.spec" -type f -print` # https://github.com/openSUSE/spec-cleaner/issues/173 sed -i 's/%{__python2}/python2/g' $spec sed -i 's/%{__python3}/python3/g' $spec + # NOTE(jaicaa): spec-cleaner does not like py2 and py3 single + # line BuildRequires, pick py2: + # BuildRequires: python-X python3-X -> BuildRequires: python-X + # BuildRequires: python3-X python-X -> BuildRequires: python-X + # BuildRequires: python2-X python3-X -> BuildRequires: python2-X + # BuildRequires: python3-X python2-X -> BuildRequires: python2-X + sed -i 's/^\(BuildRequires:.*\)python-\(.*\b\).*python3-\2$/\1python-\2/g' $spec + sed -i 's/^\(BuildRequires:.*\)python3-\(.*\b\).*python-\2$/\1python-\2/g' $spec + sed -i 's/^\(BuildRequires:.*\)python2-\(.*\b\).*python3-\2$/\1python2-\2/g' $spec + sed -i 's/^\(BuildRequires:.*\)python3-\(.*\b\).*python2-\2$/\1python2-\2/g' $spec spec-cleaner -m -d --no-copyright --diff-prog "diff -uw" \ $spec > $tmpdir/`basename ${spec}`.cleaner.diff & let count+=1