python-rpm-generators/tests/pythonname.sh
Troy Dawson e25505c276 RHEL 9.0.0 Alpha bootstrap
The content of this branch was automatically imported from Fedora ELN
with the following as its source:
https://src.fedoraproject.org/rpms/python-rpm-generators#bfb7f70b994d667b703a6b16c2b35d5056572800
2020-10-14 20:10:06 -07:00

37 lines
1.8 KiB
Bash
Executable File

#!/usr/bin/bash -eux
rpmbuild -ba pythonname.spec
X_Y=$(rpm --eval '%python3_version')
RPMDIR=$(rpm --eval '%_topdir')/RPMS/noarch
echo "Provides for python${X_Y}-foo"
rpm -qp --provides ${RPMDIR}/python${X_Y}-foo-0-0.noarch.rpm
rpm -qp --provides ${RPMDIR}/python${X_Y}-foo-0-0.noarch.rpm | grep -q '^python-foo = 0-0$'
rpm -qp --provides ${RPMDIR}/python${X_Y}-foo-0-0.noarch.rpm | grep -q '^python3-foo = 0-0$'
echo "Provides for python3-foo"
rpm -qp --provides ${RPMDIR}/python3-foo-0-0.noarch.rpm
rpm -qp --provides ${RPMDIR}/python3-foo-0-0.noarch.rpm | grep -q '^python-foo = 0-0$'
rpm -qp --provides ${RPMDIR}/python3-foo-0-0.noarch.rpm | grep -q '^python'${X_Y}'-foo = 0-0$'
echo "Provides for python2-foo"
rpm -qp --provides ${RPMDIR}/python2-foo-0-0.noarch.rpm
rpm -qp --provides ${RPMDIR}/python2-foo-0-0.noarch.rpm | grep -q '^python-foo = 0-0$' && exit 1 || true
echo "Provides for python-foo"
rpm -qp --provides ${RPMDIR}/python-foo-0-0.noarch.rpm
rpm -qp --provides ${RPMDIR}/python-foo-0-0.noarch.rpm | grep -q '^python2-foo = 0-0$' && exit 1 || true
echo "Provides for python3.5-foo"
rpm -qp --provides ${RPMDIR}/python3.5-foo-0-0.noarch.rpm
rpm -qp --provides ${RPMDIR}/python3.5-foo-0-0.noarch.rpm | grep -q '^python-foo = 0-0$' && exit 1 || true
rpm -qp --provides ${RPMDIR}/python3.5-foo-0-0.noarch.rpm | grep -q '^python3-foo = 0-0$' && exit 1 || true
echo "Provides for python3-python_provide"
rpm -qp --provides ${RPMDIR}/python3-python_provide-0-0.noarch.rpm
test $(rpm -qp --provides ${RPMDIR}/python3-python_provide-0-0.noarch.rpm | grep python-python_provide | wc -l) -eq 1
echo "Provides for python3-py_provides"
rpm -qp --provides ${RPMDIR}/python3-py_provides-0-0.noarch.rpm
test $(rpm -qp --provides ${RPMDIR}/python3-py_provides-0-0.noarch.rpm | grep python-py_provides | wc -l) -eq 1