From 715b40d6b9902701f060a10681d7d6135f352c46 Mon Sep 17 00:00:00 2001 From: Tomas Kopecek Date: Mon, 7 May 2018 15:20:42 +0200 Subject: [PATCH] spec changes for py3 hub Fixes: https://pagure.io/koji/issue/905 --- .coveragerc3 | 1 - Makefile | 8 ++-- koji.spec | 121 ++++++++++++++++++++++++++++++++++++++++------- plugins/Makefile | 10 ++-- 4 files changed, 112 insertions(+), 28 deletions(-) diff --git a/.coveragerc3 b/.coveragerc3 index b2b47e03..6fa60728 100644 --- a/.coveragerc3 +++ b/.coveragerc3 @@ -5,7 +5,6 @@ omit = /usr/* tests/* - hub/* util/* [report] diff --git a/Makefile b/Makefile index f88379c6..155ec9dc 100644 --- a/Makefile +++ b/Makefile @@ -80,10 +80,10 @@ test3: coverage3 erase PYTHONPATH=hub/.:plugins/hub/.:plugins/builder/.:plugins/cli/.:cli/. coverage3 run \ --rcfile .coveragerc3 --source . \ - /usr/bin/nosetests \ - tests/test_lib tests/test_cli - coverage3 report --rcfile .coveragerc3 - coverage3 html --rcfile .coveragerc3 + /usr/bin/nosetests-3 \ + tests/test_lib tests/test_cli tests/test_hub + coverage report --rcfile .coveragerc3 + coverage html --rcfile .coveragerc3 @echo Full coverage report at file://${PWD}/htmlcov/index.html test-tarball: diff --git a/koji.spec b/koji.spec index 907b2d89..b2748539 100644 --- a/koji.spec +++ b/koji.spec @@ -123,6 +123,20 @@ Plugins to the koji command-line interface %package hub Summary: Koji XMLRPC interface Group: Applications/Internet +License: LGPLv2 +Requires: %{name} = %{version}-%{release} +Requires: %{name}-hub-code +%if 0%{?fedora} || 0%{?rhel} > 7 +Suggests: python%{python3_pkgversion}-%{name}-hub +Suggests: python%{python3_pkgversion}-%{name}-hub-plugins +%endif + +%description hub +koji-hub is the XMLRPC interface to the koji database + +%package -n python2-%{name}-hub +Summary: Koji XMLRPC interface +Group: Applications/Internet License: LGPLv2 and GPLv2 # rpmdiff lib (from rpmlint) is GPLv2 (only) Requires: httpd @@ -134,25 +148,78 @@ Requires: python-psycopg2 Requires: %{name} = %{version}-%{release} # we need the python2 lib here Requires: python2-%{name} = %{version}-%{release} +# py2 xor py3 +Provides: %{name}-hub-code = %{version}-%{release} -%description hub +%description -n python2-%{name}-hub koji-hub is the XMLRPC interface to the koji database +%if 0%{with python3} +%package -n python%{python3_pkgversion}-%{name}-hub +Summary: Koji XMLRPC interface +Group: Applications/Internet +License: LGPLv2 and GPLv2 +# rpmdiff lib (from rpmlint) is GPLv2 (only) +Requires: httpd +Requires: mod_wsgi +%if 0%{?fedora} >= 21 || 0%{?rhel} >= 7 +Requires: mod_auth_gssapi +%endif +Requires: python-psycopg2 +Requires: %{name} = %{version}-%{release} +# we need the python2 lib here +Requires: python%{python3_pkgversion}-%{name} = %{version}-%{release} +# py2 xor py3 +Provides: %{name}-hub-code = %{version}-%{release} + +%description -n python%{python3_pkgversion}-%{name}-hub +koji-hub is the XMLRPC interface to the koji database +%endif + %package hub-plugins Summary: Koji hub plugins Group: Applications/Internet License: LGPLv2 -Requires: %{name} = %{version}-%{release} -Requires: %{name}-hub = %{version}-%{release} -Requires: python-qpid >= 0.7 -%if 0%{?rhel} >= 6 -Requires: python-qpid-proton +Requires: %{name}-hub-plugins-code +%if 0%{?fedora} || 0%{?rhel} > 7 +Suggests: python%{python3_pkgversion}-%{name}-hub-plugins %endif -Requires: cpio %description hub-plugins Plugins to the koji XMLRPC interface +%package -n python2-%{name}-hub-plugins +Summary: Koji hub plugins +Group: Applications/Internet +License: LGPLv2 +Requires: python2-%{name}-hub = %{version}-%{release} +Requires: python-qpid >= 0.7 +%if 0%{?fedora} >= 27 || 0%{?rhel} >= 6 +Requires: python-qpid-proton +%endif +Requires: cpio +Provides: %{name}-hub-plugins-code + +%description -n python2-%{name}-hub-plugins +Plugins to the koji XMLRPC interface + +%if 0%{with python3} +%package -n python%{python3_pkgversion}-%{name}-hub-plugins +Summary: Koji hub plugins +Group: Applications/Internet +License: LGPLv2 +Requires: python%{python3_pkgversion}-%{name}-hub = %{version}-%{release} +Requires: python-qpid >= 0.7 +%if 0%{?fedora} >= 27 || 0%{?rhel} >= 6 +Requires: python%{python3_pkgversion}-qpid-proton +%endif +Requires: cpio +Provides: %{name}-hub-plugins-code + +%description -n python%{python3_pkgversion}-%{name}-hub-plugins +Plugins to the koji XMLRPC interface +%endif + %package builder-plugins Summary: Koji builder plugins Group: Applications/Internet @@ -270,12 +337,11 @@ koji-web is a web UI to the Koji system. rm -rf $RPM_BUILD_ROOT make DESTDIR=$RPM_BUILD_ROOT PYTHON=%{__python2} %{?install_opt} install %if 0%{with python3} -cd koji -make DESTDIR=$RPM_BUILD_ROOT PYTHON=%{__python3} %{?install_opt} install -cd ../cli -make DESTDIR=$RPM_BUILD_ROOT PYTHON=%{__python3} %{?install_opt} install -cd ../plugins -make DESTDIR=$RPM_BUILD_ROOT PYTHON=%{__python3} %{?install_opt} install +for d in koji cli plugins hub ; do + pushd $d + make DESTDIR=$RPM_BUILD_ROOT PYTHON=%{__python3} %{?install_opt} install + popd +done # alter python interpreter in koji CLI sed -i 's/\#\!\/usr\/bin\/python2/\#\!\/usr\/bin\/python3/' $RPM_BUILD_ROOT/usr/bin/koji %endif @@ -319,20 +385,39 @@ rm -rf $RPM_BUILD_ROOT %files hub %defattr(-,root,root) -%{_datadir}/koji-hub -%dir %{_libexecdir}/koji-hub %config(noreplace) /etc/httpd/conf.d/kojihub.conf %dir /etc/koji-hub %config(noreplace) /etc/koji-hub/hub.conf %dir /etc/koji-hub/hub.conf.d -%files hub-plugins +%files -n python2-%{name}-hub %defattr(-,root,root) -%dir %{_prefix}/lib/koji-hub-plugins -%{_prefix}/lib/koji-hub-plugins/*.py* +%{_datadir}/koji-hub/*.py* +%dir %{_libexecdir}/koji-hub + +%if 0%{with python3} +%files -n python%{python3_pkgversion}-%{name}-hub +%defattr(-,root,root) +%{_datadir}/koji-hub/*.py +%{_datadir}/koji-hub/__pycache__ +%dir %{_libexecdir}/koji-hub +%endif + +%files hub-plugins %dir /etc/koji-hub/plugins %config(noreplace) /etc/koji-hub/plugins/*.conf +%files -n python2-%{name}-hub-plugins +%defattr(-,root,root) +%{_prefix}/lib/koji-hub-plugins/*.py* + +%if 0%{with python3} +%files -n python%{python3_pkgversion}-%{name}-hub-plugins +%defattr(-,root,root) +%{_prefix}/lib/koji-hub-plugins/*.py +%{_prefix}/lib/koji-hub-plugins/__pycache__ +%endif + %files builder-plugins %defattr(-,root,root) %dir /etc/kojid/plugins diff --git a/plugins/Makefile b/plugins/Makefile index f775bda4..0d97881c 100644 --- a/plugins/Makefile +++ b/plugins/Makefile @@ -29,16 +29,16 @@ install: echo "ERROR: A destdir is required"; \ exit 1; \ fi + mkdir -p $(DESTDIR)/$(HUBPLUGINDIR); \ + install -p -m 644 $(HUBFILES) $(DESTDIR)/$(HUBPLUGINDIR); \ + $(PYTHON) -c "import compileall; compileall.compile_dir('$(DESTDIR)/$(HUBPLUGINDIR)', 1, '$(HUBPLUGINDIR)', 1)"; \ + mkdir -p $(DESTDIR)/$(HUBCONFDIR); \ + install -p -m 644 $(HUBCONFFILES) $(DESTDIR)/$(HUBCONFDIR); \ if [ "$(PYMAJORVER)" == "2" ] ; then \ - mkdir -p $(DESTDIR)/$(HUBPLUGINDIR); \ mkdir -p $(DESTDIR)/$(BUILDERPLUGINDIR); \ - install -p -m 644 $(HUBFILES) $(DESTDIR)/$(HUBPLUGINDIR); \ install -p -m 644 $(BUILDERFILES) $(DESTDIR)/$(BUILDERPLUGINDIR); \ - $(PYTHON) -c "import compileall; compileall.compile_dir('$(DESTDIR)/$(HUBPLUGINDIR)', 1, '$(HUBPLUGINDIR)', 1)"; \ $(PYTHON) -c "import compileall; compileall.compile_dir('$(DESTDIR)/$(BUILDERPLUGINDIR)', 1, '$(BUILDERPLUGINDIR)', 1)"; \ - mkdir -p $(DESTDIR)/$(HUBCONFDIR); \ mkdir -p $(DESTDIR)/$(BUILDERCONFDIR); \ - install -p -m 644 $(HUBCONFFILES) $(DESTDIR)/$(HUBCONFDIR); \ install -p -m 644 $(BUILDERCONFFILES) $(DESTDIR)/$(BUILDERCONFDIR); \ fi