From 88b22b18b7186d7e65172910368df49ea5948dc1 Mon Sep 17 00:00:00 2001 From: Christopher O'Brien Date: Apr 13 2021 12:55:05 +0000 Subject: [PATCH 1/2] attempting to bridge the gap with pip uses the appropriate rpm macros for installing python wheels to provide the base koji lib. Packages the resulting dist-info data as well. --- diff --git a/koji.spec b/koji.spec index 01d133d..6083f3d 100644 --- a/koji.spec +++ b/koji.spec @@ -100,6 +100,7 @@ Requires: python-libcomps BuildRequires: systemd BuildRequires: pkgconfig BuildRequires: make +BuildRequires: sed %description Koji is a system for building and tracking RPMS. The base package @@ -356,8 +357,17 @@ koji-web is a web UI to the Koji system. %prep %autosetup -p1 +# we'll be packaging these separately and don't want them registered +# to the wheel we will produce. +sed -e '/util\/koji/g' -e '/koji_cli_plugins/g' -i setup.py %build +%if 0%{py2_support} +%py2_build_wheel +%endif +%if 0%{py3_support} +%py3_build_wheel +%endif %install rm -rf $RPM_BUILD_ROOT @@ -368,22 +378,43 @@ exit 1 %endif # python2 build -%if 0%{py2_support} > 1 -make DESTDIR=$RPM_BUILD_ROOT PYTHON=%{__python2} install -%else %if 0%{py2_support} -for d in koji cli plugins ; do - pushd $d - make DESTDIR=$RPM_BUILD_ROOT KOJI_MINIMAL=1 PYTHON=%{__python2} install +%py2_install_wheel %{name}-%{version}-py2-none-any.whl +mkdir -p %{buildroot}/etc/koji.conf.d +cp cli/koji.conf %{buildroot}/etc/koji.conf +%endif +%if 0%{py2_support} == 1 +pushd plugins +make DESTDIR=$RPM_BUILD_ROOT KOJI_MINIMAL=1 PYTHON=%{__python2} install +popd +%endif +%if 0%{py2_support} > 1 +for D in hub builder plugins util www vm ; do + pushd $D + make DESTDIR=$RPM_BUILD_ROOT PYTHON=%{__python2} install popd done %endif -%endif # python3 build +%if 0%{py3_support} +%py3_install_wheel %{name}-%{version}-py3-none-any.whl +mkdir -p %{buildroot}/etc/koji.conf.d +cp cli/koji.conf %{buildroot}/etc/koji.conf +%endif +%if 0%{py3_support} == 1 +pushd plugins +make DESTDIR=$RPM_BUILD_ROOT KOJI_MINIMAL=1 PYTHON=%{__python3} install +popd +%endif %if 0%{py3_support} > 1 -make DESTDIR=$RPM_BUILD_ROOT PYTHON=%{__python3} install +for D in hub builder plugins util www vm ; do + pushd $D + make DESTDIR=$RPM_BUILD_ROOT PYTHON=%{__python3} install + popd +done + # alter python interpreter in koji CLI scripts='%{_bindir}/koji %{_sbindir}/kojid %{_sbindir}/kojira %{_sbindir}/koji-shadow %{_sbindir}/koji-gc %{_sbindir}/kojivmd %{_sbindir}/koji-sweep-db @@ -391,17 +422,6 @@ scripts='%{_bindir}/koji %{_sbindir}/kojid %{_sbindir}/kojira %{_sbindir}/koji-s for fn in $scripts ; do sed -i 's|#!/usr/bin/python2|#!/usr/bin/python3|' $RPM_BUILD_ROOT$fn done -%else -%if 0%{py3_support} -# minimal -for d in koji cli plugins ; do - pushd $d - make DESTDIR=$RPM_BUILD_ROOT KOJI_MINIMAL=1 PYTHON=%{__python3} 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 %endif %if 0%{?fedora} @@ -454,12 +474,14 @@ rm -rf $RPM_BUILD_ROOT %if 0%{py2_support} %files -n python2-%{name} %{python2_sitelib}/%{name} +%{python2_sitelib}/%{name}-%{version}.*-info %{python2_sitelib}/koji_cli %endif %if 0%{py3_support} %files -n python%{python3_pkgversion}-koji %{python3_sitelib}/%{name} +%{python3_sitelib}/%{name}-%{version}.*-info %{python3_sitelib}/koji_cli %endif diff --git a/setup.py b/setup.py index 97bd675..3e14b04 100644 --- a/setup.py +++ b/setup.py @@ -47,7 +47,11 @@ setup( "Operating System :: POSIX :: Linux", "Topic :: Utilities" ], - packages=['koji', 'koji_cli', 'koji_cli_plugins'], + packages=[ + 'koji', + 'koji_cli', + 'koji_cli_plugins', + ], package_dir={ 'koji': 'koji', 'koji_cli': 'cli/koji_cli', From 733cf4877c03b7a27ed4a5f6abb82f43c2f0b2bb Mon Sep 17 00:00:00 2001 From: Jana Cupova Date: Apr 19 2021 07:41:05 +0000 Subject: [PATCH 2/2] Add build requires Fixes: https://pagure.io/koji/issue/912 --- diff --git a/koji.spec b/koji.spec index 6083f3d..ca821ba 100644 --- a/koji.spec +++ b/koji.spec @@ -115,6 +115,8 @@ BuildRequires: python2-devel %else BuildRequires: python-devel %endif +BuildRequires: python2-pip +BuildRequires: python2-wheel %if 0%{?fedora} || 0%{?rhel} >= 8 Requires: python2-rpm %else @@ -134,6 +136,8 @@ desc Summary: Build system tools python library %{?python_provide:%python_provide python%{python3_pkgversion}-%{name}} BuildRequires: python%{python3_pkgversion}-devel +BuildRequires: python3-pip +BuildRequires: python3-wheel %if 0%{?fedora} || 0%{?rhel} >= 8 Requires: python%{python3_pkgversion}-rpm %else @@ -466,12 +470,13 @@ done rm -rf $RPM_BUILD_ROOT %files -%{_bindir}/* %config(noreplace) /etc/koji.conf %dir /etc/koji.conf.d %doc docs Authors COPYING LGPL %if 0%{py2_support} +%{_bindir}/* +%{_sbindir}/* %files -n python2-%{name} %{python2_sitelib}/%{name} %{python2_sitelib}/%{name}-%{version}.*-info @@ -479,6 +484,7 @@ rm -rf $RPM_BUILD_ROOT %endif %if 0%{py3_support} +%{_bindir}/* %files -n python%{python3_pkgversion}-koji %{python3_sitelib}/%{name} %{python3_sitelib}/%{name}-%{version}.*-info