From c973565352915b29bc0c8d42ae14d7c44662fe0b Mon Sep 17 00:00:00 2001
From: Tomas Kopecek <tkopecek@redhat.com>
Date: Sep 22 2020 12:47:15 +0000
Subject: [PATCH 1/7] wi[


---

diff --git a/koji.spec b/koji.spec
index a5f3d78..5ae7ae4 100644
--- a/koji.spec
+++ b/koji.spec
@@ -62,6 +62,9 @@
 %{!?python2_sitearch: %global python2_sitearch %(%{__python2} -c "from distutils.sysconfig import get_python_lib; print(get_python_lib(1))")}
 %{!?py2_build: %global py2_build %{expand: CFLAGS="%{optflags}" %{__python2} setup.py %{?py_setup_args} build --executable="%{__python2} -s"}}
 %{!?py2_install: %global py2_install %{expand: CFLAGS="%{optflags}" %{__python2} setup.py %{?py_setup_args} install -O1 --skip-build --root %{buildroot}}}
+%{!?py2_eggversion: %global py2_eggversion %(%{__python2} -c "import sys; print('py%s%s' % (sys.version_info.major, sys.version_info.minor))")}
+%{!?py3_eggversion: %global py3_eggversion %(%{__python3} -c "import sys; print('py%s%s' % (sys.version_info.major, sys.version_info.minor))")}
+
 
 # If the definition isn't available for python3_pkgversion, define it
 %{?!python3_pkgversion:%global python3_pkgversion 3}
@@ -377,6 +380,14 @@ koji-web is a web UI to the Koji system.
 %autosetup -p1
 
 %build
+%if 0%{py2_support}
+mkdir -p py2_egg
+%{__python2} setup.py egg_info --egg-base py2_egg
+%endif
+%if 0%{with python3}
+mkdir -p py3_egg
+%{__python3} setup.py egg_info --egg-base py3_egg
+%endif
 
 %install
 rm -rf $RPM_BUILD_ROOT
@@ -398,6 +409,10 @@ for d in koji cli plugins ; do
 done
 %endif
 %endif
+%if 0%{py2_support}
+    mkdir -p $RPM_BUILD_ROOT%{python2_sitearch}/%{name}-%{version}-%{py2_eggversion}.egg-info
+    install -p -m 644 py2_egg/koji.egg-info/* $RPM_BUILD_ROOT%{python2_sitearch}/%{name}-%{version}-%{py2_eggversion}.egg-info
+%fi
 
 
 # python3 build
@@ -422,6 +437,10 @@ done
 sed -i 's|#!/usr/bin/python2|#!/usr/bin/python3|' $RPM_BUILD_ROOT/usr/bin/koji
 %endif
 %endif
+%if 0%{py3_support}
+mkdir -p $RPM_BUILD_ROOT%{python3_sitearch}/%{name}-%{version}-%{py3_eggversion}.egg-info
+install -p -m 644 py3_egg/koji.egg-info/* $RPM_BUILD_ROOT%{python3_sitearch}/%{name}-%{version}-%{py3_eggversion}.egg-info
+%endif
 
 %if 0%{?fedora}
 # handle extra byte compilation
@@ -474,12 +493,14 @@ rm -rf $RPM_BUILD_ROOT
 %files -n python2-%{name}
 %{python2_sitearch}/%{name}
 %{python2_sitearch}/koji_cli
+%{python2_sitearch}/%{name}-%{version}-%{py2_eggversion}.egg-info
 %endif
 
 %if 0%{py3_support}
 %files -n python%{python3_pkgversion}-koji
 %{python3_sitearch}/%{name}
 %{python3_sitearch}/koji_cli
+%{python3_sitearch}/%{name}-%{version}-%{py3_eggversion}.egg-info
 %endif
 
 %if 0%{py2_support}

From 019b918f772fde06a9d02476b51276f7692d378f Mon Sep 17 00:00:00 2001
From: Tomas Kopecek <tkopecek@redhat.com>
Date: Sep 22 2020 12:47:47 +0000
Subject: [PATCH 2/7] wi[


---

diff --git a/koji.spec b/koji.spec
index 5ae7ae4..a28a9ff 100644
--- a/koji.spec
+++ b/koji.spec
@@ -412,7 +412,7 @@ done
 %if 0%{py2_support}
     mkdir -p $RPM_BUILD_ROOT%{python2_sitearch}/%{name}-%{version}-%{py2_eggversion}.egg-info
     install -p -m 644 py2_egg/koji.egg-info/* $RPM_BUILD_ROOT%{python2_sitearch}/%{name}-%{version}-%{py2_eggversion}.egg-info
-%fi
+%endif
 
 
 # python3 build

From 1c59debd0ce549ca72c0aef5a8fa962cbced8779 Mon Sep 17 00:00:00 2001
From: Tomas Kopecek <tkopecek@redhat.com>
Date: Sep 22 2020 13:26:32 +0000
Subject: [PATCH 3/7] wip


---

diff --git a/koji.spec b/koji.spec
index a28a9ff..f5b8642 100644
--- a/koji.spec
+++ b/koji.spec
@@ -49,6 +49,8 @@
 %define py3_support 0
 %endif
 
+%define py2_support 0
+
 %if ! %{py2_support}
 # use python3
 %define __python %{__python3}
@@ -107,6 +109,7 @@ Requires: python-libcomps
 BuildRequires: systemd
 BuildRequires: pkgconfig
 %endif
+BuildRequires: python-setuptools
 
 %description
 Koji is a system for building and tracking RPMS.  The base package
@@ -384,7 +387,7 @@ koji-web is a web UI to the Koji system.
 mkdir -p py2_egg
 %{__python2} setup.py egg_info --egg-base py2_egg
 %endif
-%if 0%{with python3}
+%if 0%{py3_support}
 mkdir -p py3_egg
 %{__python3} setup.py egg_info --egg-base py3_egg
 %endif

From 21b106ba12e2168aabff06758e6e3835145202b1 Mon Sep 17 00:00:00 2001
From: Tomas Kopecek <tkopecek@redhat.com>
Date: Sep 22 2020 13:28:49 +0000
Subject: [PATCH 4/7] wip


---

diff --git a/koji.spec b/koji.spec
index f5b8642..cf1eb9a 100644
--- a/koji.spec
+++ b/koji.spec
@@ -391,6 +391,7 @@ mkdir -p py2_egg
 mkdir -p py3_egg
 %{__python3} setup.py egg_info --egg-base py3_egg
 %endif
+%py3_build
 
 %install
 rm -rf $RPM_BUILD_ROOT

From 709a77441f4681fe284c3179e912d5f6558042a8 Mon Sep 17 00:00:00 2001
From: Tomas Kopecek <tkopecek@redhat.com>
Date: Sep 22 2020 13:29:29 +0000
Subject: [PATCH 5/7] wip


---

diff --git a/koji.spec b/koji.spec
index cf1eb9a..bdd1230 100644
--- a/koji.spec
+++ b/koji.spec
@@ -391,7 +391,6 @@ mkdir -p py2_egg
 mkdir -p py3_egg
 %{__python3} setup.py egg_info --egg-base py3_egg
 %endif
-%py3_build
 
 %install
 rm -rf $RPM_BUILD_ROOT
@@ -504,7 +503,7 @@ rm -rf $RPM_BUILD_ROOT
 %files -n python%{python3_pkgversion}-koji
 %{python3_sitearch}/%{name}
 %{python3_sitearch}/koji_cli
-%{python3_sitearch}/%{name}-%{version}-%{py3_eggversion}.egg-info
+##%{python3_sitearch}/%{name}-%{version}-%{py3_eggversion}.egg-info
 %endif
 
 %if 0%{py2_support}

From c2ee4bcd5bf765d96aff3f2ed10f121de8e352ed Mon Sep 17 00:00:00 2001
From: Tomas Kopecek <tkopecek@redhat.com>
Date: Sep 22 2020 13:29:52 +0000
Subject: [PATCH 6/7] wip


---

diff --git a/koji.spec b/koji.spec
index bdd1230..f5b8642 100644
--- a/koji.spec
+++ b/koji.spec
@@ -503,7 +503,7 @@ rm -rf $RPM_BUILD_ROOT
 %files -n python%{python3_pkgversion}-koji
 %{python3_sitearch}/%{name}
 %{python3_sitearch}/koji_cli
-##%{python3_sitearch}/%{name}-%{version}-%{py3_eggversion}.egg-info
+%{python3_sitearch}/%{name}-%{version}-%{py3_eggversion}.egg-info
 %endif
 
 %if 0%{py2_support}

From 29b490a7897ace5ef78c06b14877cc5e9664472e Mon Sep 17 00:00:00 2001
From: Tomas Kopecek <tkopecek@redhat.com>
Date: Sep 22 2020 13:43:32 +0000
Subject: [PATCH 7/7] Install egginfo for python-koji rpms


Fixes: https://pagure.io/koji/issue/912

---

diff --git a/koji.spec b/koji.spec
index f5b8642..bd7e7ab 100644
--- a/koji.spec
+++ b/koji.spec
@@ -49,8 +49,6 @@
 %define py3_support 0
 %endif
 
-%define py2_support 0
-
 %if ! %{py2_support}
 # use python3
 %define __python %{__python3}
@@ -67,7 +65,6 @@
 %{!?py2_eggversion: %global py2_eggversion %(%{__python2} -c "import sys; print('py%s%s' % (sys.version_info.major, sys.version_info.minor))")}
 %{!?py3_eggversion: %global py3_eggversion %(%{__python3} -c "import sys; print('py%s%s' % (sys.version_info.major, sys.version_info.minor))")}
 
-
 # If the definition isn't available for python3_pkgversion, define it
 %{?!python3_pkgversion:%global python3_pkgversion 3}
 
@@ -109,7 +106,6 @@ Requires: python-libcomps
 BuildRequires: systemd
 BuildRequires: pkgconfig
 %endif
-BuildRequires: python-setuptools
 
 %description
 Koji is a system for building and tracking RPMS.  The base package
@@ -121,8 +117,10 @@ Summary: Build system tools python library
 %{?python_provide:%python_provide python2-%{name}}
 %if 0%{?fedora} >= 30
 BuildRequires: python2-devel
+BuildRequires: python2-setuptools
 %else
 BuildRequires: python-devel
+BuildRequires: python%{python3_pkgversion}-setuptools
 %endif
 %if 0%{?fedora} || 0%{?rhel} >= 8
 Requires: python2-rpm
@@ -413,8 +411,8 @@ done
 %endif
 %endif
 %if 0%{py2_support}
-    mkdir -p $RPM_BUILD_ROOT%{python2_sitearch}/%{name}-%{version}-%{py2_eggversion}.egg-info
-    install -p -m 644 py2_egg/koji.egg-info/* $RPM_BUILD_ROOT%{python2_sitearch}/%{name}-%{version}-%{py2_eggversion}.egg-info
+mkdir -p $RPM_BUILD_ROOT%{python2_sitearch}/%{name}-%{version}-%{py2_eggversion}.egg-info
+install -p -m 644 py2_egg/koji.egg-info/* $RPM_BUILD_ROOT%{python2_sitearch}/%{name}-%{version}-%{py2_eggversion}.egg-info
 %endif
 
 

