- Enable Python 3 for Fedora 30+ and EL8+

- Sync packaging changes from upstream
epel9
Neal Gompa 6 years ago
parent b972d16a89
commit 12a63677fe

@ -1,87 +0,0 @@
From d20928c9d90e95147c6627c0dc3de31920e658b7 Mon Sep 17 00:00:00 2001
From: Adam Williamson <awilliam@redhat.com>
Date: Tue, 8 Jan 2019 11:20:26 -0800
Subject: [PATCH] Fix `is_conn_error()` for Python 3.3+ change to
`socket.error`
In Python 3.3+, `socket.error` is no longer a distinct exception.
It is - as the docs say - "A deprecated alias of OSError". This
means that this check:
`isinstance(e, socket.error)`
is effectively equivalent to:
`isinstance(e, OSError)`
This is a problem, because `requests.exceptions.ConnectionError`
(another exception type we handle later in `is_conn_error()`) is
a subclass of `OSError` - so on Python 3 we never actually reach
the block that's intended to handle that exception type. We hit
the `isinstance(e, socket.error)` block at the start instead, and
of course the exception doesn't have an `errno` attribute, so we
just return `False` at that point.
There are a few different ways we could fix this; this commit
does it by ditching the `isinstance` checks, and dropping the
shortcut `return False` bailout from the early block. We'll still
ultimately return `False` unless the error is actually one of the
other types we handle; it just costs a couple more `isinstance`
checks.
I don't think replacing the `isinstance socket.error` checks is
really necessary at all. We can just check for an `errno` attr,
and if there is one and it's one of the values we check for...
that seems safe enough to treat as a connection error.
This also changes the second check to be a check of `e2`, not
`e` - I'm *fairly* sure this is what's actually intended, and
the current code was a copy-paste error.
Fixes: #1192
Signed-off-by: Adam Williamson <awilliam@redhat.com>
---
koji/__init__.py | 19 ++++++++++---------
1 file changed, 10 insertions(+), 9 deletions(-)
diff --git a/koji/__init__.py b/koji/__init__.py
index aba10ec1..c4fd4756 100644
--- a/koji/__init__.py
+++ b/koji/__init__.py
@@ -1978,11 +1978,13 @@ def is_cert_error(e):
def is_conn_error(e):
"""Determine if an error seems to be from a dropped connection"""
- if isinstance(e, socket.error):
- if getattr(e, 'errno', None) in (errno.ECONNRESET, errno.ECONNABORTED, errno.EPIPE):
- return True
- # else
- return False
+ # This is intended for the case where e is a socket error.
+ # as `socket.error` is just an alias for `OSError` in Python 3
+ # there is no value to an `isinstance` check here; let's just
+ # assume that if the exception has an 'errno' and it's one of
+ # these values, this is a connection error.
+ if getattr(e, 'errno', None) in (errno.ECONNRESET, errno.ECONNABORTED, errno.EPIPE):
+ return True
if isinstance(e, six.moves.http_client.BadStatusLine):
return True
try:
@@ -1994,10 +1996,9 @@ def is_conn_error(e):
e3 = getattr(e2, 'args', [None, None])[1]
if isinstance(e3, six.moves.http_client.BadStatusLine):
return True
- if isinstance(e2, socket.error):
- # same check as unwrapped socket error
- if getattr(e, 'errno', None) in (errno.ECONNRESET, errno.ECONNABORTED, errno.EPIPE):
- return True
+ # same check as unwrapped socket error
+ if getattr(e2, 'errno', None) in (errno.ECONNRESET, errno.ECONNABORTED, errno.EPIPE):
+ return True
except (TypeError, AttributeError):
pass
# otherwise
--
2.20.1

@ -1,15 +1,15 @@
From 47d9f103194e65611a472db42eff03eabe423739 Mon Sep 17 00:00:00 2001 From e28b662b29f688954a8ebe772e21cb7025ba47b6 Mon Sep 17 00:00:00 2001
From: Patrick Uiterwijk <patrick@puiterwijk.org> From: Patrick Uiterwijk <patrick@puiterwijk.org>
Date: Thu, 7 Mar 2019 12:22:12 +0100 Date: Thu, 7 Mar 2019 12:22:12 +0100
Subject: [PATCH] Apply Fedora instance configuration Subject: [PATCH] Apply Fedora instance configuration
Signed-off-by: Patrick Uiterwijk <patrick@puiterwijk.org> Signed-off-by: Patrick Uiterwijk <patrick@puiterwijk.org>
--- ---
cli/koji.conf | 24 +++++++++++------------- cli/koji.conf | 25 +++++++++++--------------
1 file changed, 11 insertions(+), 13 deletions(-) 1 file changed, 11 insertions(+), 14 deletions(-)
diff --git a/cli/koji.conf b/cli/koji.conf diff --git a/cli/koji.conf b/cli/koji.conf
index addd4e3..4fcb2ae 100644 index addd4e3..3588c19 100644
--- a/cli/koji.conf --- a/cli/koji.conf
+++ b/cli/koji.conf +++ b/cli/koji.conf
@@ -3,18 +3,23 @@ @@ -3,18 +3,23 @@
@ -39,10 +39,11 @@ index addd4e3..4fcb2ae 100644
;the service name of the principal being used by the hub ;the service name of the principal being used by the hub
;krbservice = host ;krbservice = host
@@ -29,16 +34,9 @@ @@ -28,17 +33,9 @@
;enable to lookup dns canonical hostname for krb auth
;krb_canon_host = no ;krb_canon_host = no
-
-;configuration for SSL authentication -;configuration for SSL authentication
- -
-;client certificate -;client certificate
@ -53,7 +54,7 @@ index addd4e3..4fcb2ae 100644
- -
-;enabled plugins for CLI, runroot and save_failed_tree are available -;enabled plugins for CLI, runroot and save_failed_tree are available
-;plugins = -;plugins =
+;enabled plugins for CLI, runroot is enabled by deafult for fedora +;enabled plugins for CLI, runroot is enabled by default for fedora
+;save_failed_tree is available +;save_failed_tree is available
+plugins = runroot +plugins = runroot

@ -1,15 +1,60 @@
# This package depends on automagic byte compilation # This package depends on selective manual byte compilation
# https://fedoraproject.org/wiki/Changes/No_more_automagic_Python_bytecompilation_phase_2 # https://fedoraproject.org/wiki/Changes/No_more_automagic_Python_bytecompilation_phase_2
%global _python_bytecompile_extra 1 %global _python_bytecompile_extra 0
# Enable Python 3 builds for Fedora + EPEL >5 %bcond_without python2
# NOTE: do **NOT** change 'epel' to 'rhel' here, as this spec is also
%if 0%{?fedora} || 0%{?rhel} > 7
%bcond_without python3 %bcond_without python3
# If the definition isn't available for python3_pkgversion, define it
%{?!python3_pkgversion:%global python3_pkgversion 3} # We can build varying amounts of Koji for python2 and python3 based on
# the py[23]_support macro values. Valid values are:
# undefined or 0 -- do not build
# 1 -- build just the cli and lib
# 2 -- build everything we can
# For executable scripts, py3 wins if we build it
# The following rules tweak these settings based on options and environment
# Default to building both fully
%define py2_support 2
%define py3_support 2
%if 0%{?rhel} >= 8
# and no python2 on rhel8+
%define py2_support 0
%else %else
%bcond_with python3 %if 0%{?rhel}
# No python3 for older rhel
%define py3_support 0
%endif
%endif
%if 0%{?fedora} >= 33
# no py2 after F33
%define py2_support 0
%define py3_support 2
%else
%if 0%{?fedora} >= 30
%define py2_support 1
%define py3_support 2
%else
%if 0%{?fedora}
# match what the older Fedoras already have
%define py2_support 2
%define py3_support 1
%endif
%endif
%endif
# Lastly enforce the bcond parameters
%if %{without python2}
%define py2_support 0
%endif
%if %{without python3}
%define py3_support 0
%endif
%if ! %{py2_support}
# use python3
%define __python %{__python3}
%endif %endif
# Compatibility with RHEL. These macros have been added to EPEL but # Compatibility with RHEL. These macros have been added to EPEL but
@ -21,17 +66,20 @@
%{!?py2_build: %global py2_build %{expand: CFLAGS="%{optflags}" %{__python2} setup.py %{?py_setup_args} build --executable="%{__python2} -s"}} %{!?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_install: %global py2_install %{expand: CFLAGS="%{optflags}" %{__python2} setup.py %{?py_setup_args} install -O1 --skip-build --root %{buildroot}}}
%if 0%{?fedora} || 0%{?rhel} >= 7 # If the definition isn't available for python3_pkgversion, define it
%global use_systemd 1 %{?!python3_pkgversion:%global python3_pkgversion 3}
%else
%if 0%{?rhel} && 0%{?rhel} < 7
%global use_systemd 0 %global use_systemd 0
%global install_opt TYPE=sysv %global install_opt TYPE=sysv
%else
%global use_systemd 1
%endif %endif
Name: koji Name: koji
Version: 1.17.0 Version: 1.17.0
Release: 1%{?dist} Release: 2%{?dist}
# koji.ssl libs (from plague) are GPLv2+ # the included arch lib from yum's rpmUtils is GPLv2+
License: LGPLv2 and GPLv2+ License: LGPLv2 and GPLv2+
Summary: Build system tools Summary: Build system tools
URL: https://pagure.io/koji/ URL: https://pagure.io/koji/
@ -41,125 +89,192 @@ Source0: https://releases.pagure.org/koji/koji-%{version}.tar.bz2
Patch100: fedora-config.patch Patch100: fedora-config.patch
BuildArch: noarch BuildArch: noarch
%if 0%{with python3} %if 0%{py3_support}
Requires: python3-%{name} = %{version}-%{release} Requires: python%{python3_pkgversion}-%{name} = %{version}-%{release}
Requires: python3-pycurl Requires: python%{python3_pkgversion}-libcomps
Requires: python3-libcomps
%else %else
Requires: python2-%{name} = %{version}-%{release} Requires: python2-%{name} = %{version}-%{release}
%if 0%{?fedora} %if 0%{?fedora} || 0%{?rhel} >= 7
Requires: python2-libcomps
Requires: python2-pycurl
%endif
%if 0%{?rhel}
Requires: python-pycurl
%endif
%if 0%{?rhel} >= 7
Requires: python-libcomps Requires: python-libcomps
%endif %endif
%endif %endif
BuildRequires: python
BuildRequires: python-sphinx
%if %{use_systemd} %if %{use_systemd}
BuildRequires: systemd BuildRequires: systemd
BuildRequires: pkgconfig BuildRequires: pkgconfig
%endif %endif
# For backwards compatibility, we want to Require: python2-koji for Fedora <= 26 so dependent
# packages have some time to switch their Requires lines to python2-koji instead of Koji.
%if 0%{?fedora} && 0%{?fedora} <= 26
Requires: python2-%{name} = %{version}-%{release}
Requires: python2-pycurl
Requires: python2-libcomps
%endif
%description %description
Koji is a system for building and tracking RPMS. The base package Koji is a system for building and tracking RPMS. The base package
contains shared libraries and the command-line interface. contains shared libraries and the command-line interface.
%if 0%{py2_support}
%package -n python2-%{name} %package -n python2-%{name}
Summary: Build system tools python library Summary: Build system tools python library
%{?python_provide:%python_provide python2-%{name}} %{?python_provide:%python_provide python2-%{name}}
BuildRequires: python2-devel BuildRequires: python-devel
Requires: python-krbV >= 1.0.13 %if 0%{?fedora} >= 25 || 0%{?rhel} >= 8
Requires: python2-rpm
%else
Requires: rpm-python Requires: rpm-python
%endif
Requires: pyOpenSSL Requires: pyOpenSSL
Requires: python-requests Requires: python-requests
%if 0%{?fedora} >= 23 || 0%{?rhel} >= 7
Requires: python-requests-kerberos Requires: python-requests-kerberos
%else
Requires: python-krbV >= 1.0.13
%endif
Requires: python-dateutil Requires: python-dateutil
Requires: python-six Requires: python-six
%description -n python2-%{name} %description -n python2-%{name}
Koji is a system for building and tracking RPMS. The base package desc
contains shared libraries and the command-line interface. %endif
%if 0%{with python3} %if 0%{py3_support}
%package -n python3-%{name} %package -n python%{python3_pkgversion}-%{name}
Summary: Build system tools python library Summary: Build system tools python library
%{?python_provide:%python_provide python3-%{name}} %{?python_provide:%python_provide python%{python3_pkgversion}-%{name}}
BuildRequires: python3-devel BuildRequires: python%{python3_pkgversion}-devel
Requires: python3-rpm %if 0%{?fedora} >= 25 || 0%{?rhel} >= 8
Requires: python3-pyOpenSSL Requires: python%{python3_pkgversion}-rpm
Requires: python3-requests %else
Requires: python3-requests-kerberos Requires: rpm-python%{python3_pkgversion}
Requires: python3-dateutil %endif
Requires: python3-six Requires: python%{python3_pkgversion}-pyOpenSSL
Requires: python%{python3_pkgversion}-requests
%description -n python3-%{name} Requires: python%{python3_pkgversion}-requests-kerberos
Koji is a system for building and tracking RPMS. The base package Requires: python%{python3_pkgversion}-dateutil
contains shared libraries and the command-line interface. Requires: python%{python3_pkgversion}-six
%description -n python%{python3_pkgversion}-%{name}
desc
%endif %endif
%if 0%{py2_support}
%package -n python2-%{name}-cli-plugins %package -n python2-%{name}-cli-plugins
Summary: Koji client plugins Summary: Koji client plugins
License: LGPLv2 License: LGPLv2
Requires: %{name} = %{version}-%{release} Requires: python2-%{name} = %{version}-%{release}
%description -n python2-%{name}-cli-plugins %description -n python2-%{name}-cli-plugins
Plugins to the koji command-line interface Plugins to the koji command-line interface
%endif
%if 0%{with python3} %if 0%{py3_support}
%package -n python3-%{name}-cli-plugins %package -n python%{python3_pkgversion}-%{name}-cli-plugins
Summary: Koji client plugins Summary: Koji client plugins
License: LGPLv2 License: LGPLv2
Requires: %{name} = %{version}-%{release} Requires: python%{python3_pkgversion}-%{name} = %{version}-%{release}
%description -n python3-%{name}-cli-plugins %description -n python%{python3_pkgversion}-%{name}-cli-plugins
Plugins to the koji command-line interface Plugins to the koji command-line interface
%endif %endif
%package hub %package hub
Summary: Koji XMLRPC interface Summary: Koji XMLRPC interface
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
%if 0%{py2_support} > 1
%package -n python2-%{name}-hub
Summary: Koji XMLRPC interface
License: LGPLv2 and GPLv2 License: LGPLv2 and GPLv2
# rpmdiff lib (from rpmlint) is GPLv2 (only) # rpmdiff lib (from rpmlint) is GPLv2 (only)
Requires: httpd Requires: httpd
Requires: mod_wsgi Requires: mod_wsgi
%if 0%{?fedora} >= 21 || 0%{?rhel} >= 7
Requires: mod_auth_gssapi
%endif
Requires: python-psycopg2 Requires: python-psycopg2
Requires: python2-%{name} = %{version}-%{release} 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
%endif
%if 0%{py3_support} > 1
%package -n python%{python3_pkgversion}-%{name}-hub
Summary: Koji XMLRPC interface
License: LGPLv2 and GPLv2
# rpmdiff lib (from rpmlint) is GPLv2 (only)
Requires: httpd
Requires: python%{python3_pkgversion}-mod_wsgi
%if 0%{?fedora} >= 21 || 0%{?rhel} >= 7
Requires: mod_auth_gssapi
%endif
Requires: python%{python3_pkgversion}-psycopg2
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 koji-hub is the XMLRPC interface to the koji database
%endif
%package hub-plugins %package hub-plugins
Summary: Koji hub plugins Summary: Koji hub plugins
License: LGPLv2 License: LGPLv2
Requires: %{name}-hub = %{version}-%{release} Requires: %{name}-hub-plugins-code = %{version}-%{release}
Requires: python-qpid >= 0.7 %if 0%{?fedora} || 0%{?rhel} > 7
Requires: python-qpid-proton Suggests: python%{python3_pkgversion}-%{name}-hub-plugins
Requires: cpio %endif
%description hub-plugins %description hub-plugins
Plugins to the koji XMLRPC interface Plugins to the koji XMLRPC interface
%if 0%{py2_support} > 1
%package -n python2-%{name}-hub-plugins
Summary: Koji hub plugins
License: LGPLv2
Requires: python2-%{name}-hub = %{version}-%{release}
Requires: python2-qpid-proton
Requires: cpio
Provides: %{name}-hub-plugins-code = %{version}-%{release}
%description -n python2-%{name}-hub-plugins
Plugins to the koji XMLRPC interface
%endif
%if 0%{py3_support} > 1
%package -n python%{python3_pkgversion}-%{name}-hub-plugins
Summary: Koji hub plugins
License: LGPLv2
Requires: python%{python3_pkgversion}-%{name}-hub = %{version}-%{release}
Requires: python%{python3_pkgversion}-qpid-proton
Requires: cpio
Provides: %{name}-hub-plugins-code = %{version}-%{release}
%description -n python%{python3_pkgversion}-%{name}-hub-plugins
Plugins to the koji XMLRPC interface
%endif
%package builder-plugins
Summary: Koji builder plugins
License: LGPLv2
Requires: %{name} = %{version}-%{release}
Requires: %{name}-builder = %{version}-%{release}
%description builder-plugins
Plugins for the koji build daemon
%package builder %package builder
Summary: Koji RPM builder daemon Summary: Koji RPM builder daemon
License: LGPLv2 and GPLv2+ License: LGPLv2 and GPLv2+
#mergerepos (from createrepo) is GPLv2+ #mergerepos (from createrepo) is GPLv2+
Requires: python2-%{name} = %{version}-%{release}
Requires: mock >= 0.9.14 Requires: mock >= 0.9.14
Requires(pre): /usr/sbin/useradd Requires(pre): /usr/sbin/useradd
Requires: squashfs-tools Requires: squashfs-tools
Requires: python2-multilib
%if %{use_systemd} %if %{use_systemd}
Requires(post): systemd Requires(post): systemd
Requires(preun): systemd Requires(preun): systemd
@ -173,8 +288,17 @@ Requires(preun): /sbin/service
Requires: /usr/bin/cvs Requires: /usr/bin/cvs
Requires: /usr/bin/svn Requires: /usr/bin/svn
Requires: /usr/bin/git Requires: /usr/bin/git
Requires: python-cheetah
Requires: createrepo >= 0.9.2 Requires: createrepo >= 0.9.2
%if 0%{py3_support} > 1
Requires: python%{python3_pkgversion}-%{name} = %{version}-%{release}
Requires: python%{python3_pkgversion}-librepo
Requires: python%{python3_pkgversion}-multilib
Requires: python%{python3_pkgversion}-cheetah
%else
Requires: python2-%{name} = %{version}-%{release}
Requires: python2-multilib
Requires: python-cheetah
%endif
%description builder %description builder
koji-builder is the daemon that runs on build machines and executes koji-builder is the daemon that runs on build machines and executes
@ -183,7 +307,7 @@ tasks that come through the Koji system.
%package vm %package vm
Summary: Koji virtual machine management daemon Summary: Koji virtual machine management daemon
License: LGPLv2 License: LGPLv2
Requires: python2-%{name} = %{version}-%{release} Requires: %{name} = %{version}-%{release}
%if %{use_systemd} %if %{use_systemd}
Requires(post): systemd Requires(post): systemd
Requires(preun): systemd Requires(preun): systemd
@ -194,8 +318,13 @@ Requires(post): /sbin/service
Requires(preun): /sbin/chkconfig Requires(preun): /sbin/chkconfig
Requires(preun): /sbin/service Requires(preun): /sbin/service
%endif %endif
%if 0%{py3_support} > 1
Requires: python%{python3_pkgversion}-libvirt
Requires: python%{python3_pkgversion}-libxml2
%else
Requires: libvirt-python Requires: libvirt-python
Requires: libxml2-python Requires: libxml2-python
%endif
Requires: /usr/bin/virt-clone Requires: /usr/bin/virt-clone
Requires: qemu-img Requires: qemu-img
@ -206,8 +335,12 @@ virtual machine. This package is not required for most installations.
%package utils %package utils
Summary: Koji Utilities Summary: Koji Utilities
License: LGPLv2 License: LGPLv2
Requires: %{name} = %{version}-%{release}
%if 0%{py3_support} > 1
Requires: python%{python3_pkgversion}-psycopg2
%else
Requires: python-psycopg2 Requires: python-psycopg2
Requires: python2-%{name} = %{version}-%{release} %endif
%if %{use_systemd} %if %{use_systemd}
Requires(post): systemd Requires(post): systemd
Requires(preun): systemd Requires(preun): systemd
@ -220,64 +353,157 @@ Utilities for the Koji system
%package web %package web
Summary: Koji Web UI Summary: Koji Web UI
License: LGPLv2 License: LGPLv2
Requires: %{name} = %{version}-%{release}
Requires: %{name}-web-code = %{version}-%{release}
%if 0%{?fedora} || 0%{?rhel} > 7
Suggests: python%{python3_pkgversion}-%{name}-web
%endif
%description web
koji-web is a web UI to the Koji system.
%if 0%{py2_support} > 1
%package -n python2-%{name}-web
Summary: Koji Web UI
License: LGPLv2
%{?python_provide:%python_provide python2-%{name}-web}
Requires: httpd Requires: httpd
Requires: mod_wsgi Requires: mod_wsgi
%if 0%{?fedora} >= 21 || 0%{?rhel} >= 7
Requires: mod_auth_gssapi Requires: mod_auth_gssapi
%else
Requires: mod_auth_kerb
Requires: python-krbV >= 1.0.13
%endif
Requires: python-psycopg2 Requires: python-psycopg2
Requires: python-cheetah Requires: python-cheetah
Requires: python2-%{name} = %{version}-%{release} Requires: python2-%{name} = %{version}-%{release}
Requires: python-krbV >= 1.0.13 Provides: %{name}-web-code = %{version}-%{release}
%description web %description -n python2-%{name}-web
koji-web is a web UI to the Koji system. koji-web is a web UI to the Koji system.
%endif
%if 0%{py3_support} > 1
%package -n python%{python3_pkgversion}-%{name}-web
Summary: Koji Web UI
License: LGPLv2
%{?python_provide:%python_provide python%{python3_pkgversion}-%{name}-web}
Requires: httpd
Requires: python%{python3_pkgversion}-mod_wsgi
Requires: mod_auth_gssapi
Requires: python%{python3_pkgversion}-psycopg2
Requires: python%{python3_pkgversion}-cheetah
Requires: python%{python3_pkgversion}-%{name} = %{version}-%{release}
Provides: %{name}-web-code = %{version}-%{release}
%description -n python%{python3_pkgversion}-%{name}-web
koji-web is a web UI to the Koji system.
%endif
%prep %prep
%setup -q %setup -q
%patch100 -p1 -b .fedoraconfig %patch100 -p1 -b .fedoraconfig
%build %build
# Nothing to build
%install %install
rm -rf $RPM_BUILD_ROOT %if 0%{py2_support} < 2 && 0%{py3_support} < 2
make DESTDIR=$RPM_BUILD_ROOT %{?install_opt} install echo "At least one python must be built with full support"
%if 0%{with python3} exit 1
cd koji %endif
make DESTDIR=$RPM_BUILD_ROOT PYTHON=python3 %{?install_opt} install
cd ../cli # python2 build
make DESTDIR=$RPM_BUILD_ROOT PYTHON=python3 %{?install_opt} install %if 0%{py2_support} > 1
cd ../plugins make DESTDIR=$RPM_BUILD_ROOT PYTHON=%{__python2} %{?install_opt} install
make DESTDIR=$RPM_BUILD_ROOT PYTHON=python3 %{?install_opt} 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_opt} install
popd
done
%endif
%endif
# python3 build
%if 0%{py3_support} > 1
make DESTDIR=$RPM_BUILD_ROOT PYTHON=%{__python3} %{?install_opt} install
# alter python interpreter in koji CLI # alter python interpreter in koji CLI
sed -i 's/\#\!\/usr\/bin\/python2/\#\!\/usr\/bin\/python3/' $RPM_BUILD_ROOT/usr/bin/koji scripts='%{_bindir}/koji %{_sbindir}/kojid %{_sbindir}/kojira %{_sbindir}/koji-shadow
%{_sbindir}/koji-gc %{_sbindir}/kojivmd'
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_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
%endif %endif
%if 0%{?fedora} <= 29 %if 0%{?fedora} <= 29
# This changed in 1.17.0, make sure that existing installs do not break # This changed in 1.17.0, make sure that existing installs do not break
ln -s /usr/share/koji-hub %RPM_BUILD_ROOT/usr/libexec/koji-hub ln -s /usr/share/koji-hub %RPM_BUILD_ROOT/usr/libexec/koji-hub
%endif %endif
%if 0%{?fedora} >= 28
# handle extra byte compilation
extra_dirs='
%{_prefix}/lib/koji-builder-plugins
%{_prefix}/koji-hub-plugins
%{_datadir}/koji-hub
%{_datadir}/koji-web/lib/kojiweb
%{_datadir}/koji-web/scripts'
%if 0%{py2_support} > 1
for fn in $extra_dirs ; do
%py_byte_compile %{__python2} %{buildroot}$fn
done
%endif
%if 0%{py3_support} > 1
for fn in $extra_dirs ; do
%py_byte_compile %{__python3} %{buildroot}$fn
done
%endif
%endif
%files %files
%{_bindir}/* %{_bindir}/*
%config(noreplace) /etc/koji.conf %config(noreplace) /etc/koji.conf
%dir /etc/koji.conf.d %dir /etc/koji.conf.d
%doc docs Authors COPYING LGPL %doc docs Authors COPYING LGPL
%if 0%{py2_support}
%files -n python2-%{name} %files -n python2-%{name}
%{python2_sitelib}/%{name} %{python2_sitelib}/%{name}
%{python2_sitelib}/koji_cli %{python2_sitelib}/koji_cli
%endif
%if 0%{with python3} %if 0%{py3_support}
%files -n python%{python3_pkgversion}-koji %files -n python%{python3_pkgversion}-koji
%{python3_sitelib}/%{name} %{python3_sitelib}/%{name}
%{python3_sitelib}/koji_cli %{python3_sitelib}/koji_cli
%endif %endif
%if 0%{py2_support}
%files -n python2-%{name}-cli-plugins %files -n python2-%{name}-cli-plugins
%{python2_sitelib}/koji_cli_plugins %{python2_sitelib}/koji_cli_plugins
# we don't have config files for default plugins yet # we don't have config files for default plugins yet
#%%dir %%{_sysconfdir}/koji/plugins #%%dir %%{_sysconfdir}/koji/plugins
#%%config(noreplace) %%{_sysconfdir}/koji/plugins/*.conf #%%config(noreplace) %%{_sysconfdir}/koji/plugins/*.conf
%endif
%if 0%{with python3} %if 0%{py3_support}
%files -n python%{python3_pkgversion}-%{name}-cli-plugins %files -n python%{python3_pkgversion}-%{name}-cli-plugins
%{python3_sitelib}/koji_cli_plugins %{python3_sitelib}/koji_cli_plugins
# we don't have config files for default plugins yet # we don't have config files for default plugins yet
@ -286,23 +512,45 @@ ln -s /usr/share/koji-hub %RPM_BUILD_ROOT/usr/libexec/koji-hub
%endif %endif
%files hub %files hub
%{_datadir}/koji-hub
%if 0%{?fedora} <= 29
# Compatibility symlink
%{_libexecdir}/koji-hub
%endif
%dir %{_datarootdir}/koji-hub
%config(noreplace) /etc/httpd/conf.d/kojihub.conf %config(noreplace) /etc/httpd/conf.d/kojihub.conf
%dir /etc/koji-hub %dir /etc/koji-hub
%config(noreplace) /etc/koji-hub/hub.conf %config(noreplace) /etc/koji-hub/hub.conf
%dir /etc/koji-hub/hub.conf.d %dir /etc/koji-hub/hub.conf.d
%if 0%{py2_support} > 1
%files -n python2-%{name}-hub
%{_datadir}/koji-hub/*.py*
%endif
%if 0%{py3_support} > 1
%files -n python%{python3_pkgversion}-%{name}-hub
%{_datadir}/koji-hub/*.py
%{_datadir}/koji-hub/__pycache__
%endif
%files hub-plugins %files hub-plugins
%dir %{_prefix}/lib/koji-hub-plugins
%{_prefix}/lib/koji-hub-plugins/*.py*
%{_prefix}/lib/koji-hub-plugins/__pycache__/
%dir /etc/koji-hub/plugins %dir /etc/koji-hub/plugins
/etc/koji-hub/plugins/*.conf %config(noreplace) /etc/koji-hub/plugins/*.conf
%if 0%{py2_support} > 1
%files -n python2-%{name}-hub-plugins
%{_prefix}/lib/koji-hub-plugins/*.py*
%endif
%if 0%{py3_support} > 1
%files -n python%{python3_pkgversion}-%{name}-hub-plugins
%{_prefix}/lib/koji-hub-plugins/*.py
%{_prefix}/lib/koji-hub-plugins/__pycache__
%endif
%files builder-plugins
%dir /etc/kojid/plugins
%config(noreplace) /etc/kojid/plugins/*.conf
%dir %{_prefix}/lib/koji-builder-plugins
%{_prefix}/lib/koji-builder-plugins/*.py*
%if 0%{py3_support} > 1
%{_prefix}/lib/koji-builder-plugins/__pycache__
%endif
%files utils %files utils
%{_sbindir}/kojira %{_sbindir}/kojira
@ -322,20 +570,25 @@ ln -s /usr/share/koji-hub %RPM_BUILD_ROOT/usr/libexec/koji-hub
%config(noreplace) /etc/koji-shadow/koji-shadow.conf %config(noreplace) /etc/koji-shadow/koji-shadow.conf
%files web %files web
%{_datadir}/koji-web
%dir /etc/kojiweb %dir /etc/kojiweb
%config(noreplace) /etc/kojiweb/web.conf %config(noreplace) /etc/kojiweb/web.conf
%config(noreplace) /etc/httpd/conf.d/kojiweb.conf %config(noreplace) /etc/httpd/conf.d/kojiweb.conf
%dir /etc/kojiweb/web.conf.d %dir /etc/kojiweb/web.conf.d
%if 0%{py2_support} > 1
%files -n python2-%{name}-web
%{_datadir}/koji-web
%endif
%if 0%{py3_support} > 1
%files -n python%{python3_pkgversion}-%{name}-web
%{_datadir}/koji-web
%endif
%files builder %files builder
%{_sbindir}/kojid %{_sbindir}/kojid
%dir %{_libexecdir}/kojid %dir %{_libexecdir}/kojid
%{_libexecdir}/kojid/mergerepos %{_libexecdir}/kojid/mergerepos
%defattr(-,root,root)
%dir %{_prefix}/lib/koji-builder-plugins
%{_prefix}/lib/koji-builder-plugins/*.py*
%{_prefix}/lib/koji-builder-plugins/__pycache__/
%if %{use_systemd} %if %{use_systemd}
%{_unitdir}/kojid.service %{_unitdir}/kojid.service
%else %else
@ -343,10 +596,7 @@ ln -s /usr/share/koji-hub %RPM_BUILD_ROOT/usr/libexec/koji-hub
%config(noreplace) /etc/sysconfig/kojid %config(noreplace) /etc/sysconfig/kojid
%endif %endif
%dir /etc/kojid %dir /etc/kojid
%dir /etc/kojid/plugins
%config(noreplace) /etc/kojid/kojid.conf %config(noreplace) /etc/kojid/kojid.conf
%config(noreplace) /etc/kojid/plugins/runroot.conf
%config(noreplace) /etc/kojid/plugins/save_failed_tree.conf
%attr(-,kojibuilder,kojibuilder) /etc/mock/koji %attr(-,kojibuilder,kojibuilder) /etc/mock/koji
%pre builder %pre builder
@ -409,7 +659,6 @@ if [ $1 = 0 ]; then
/sbin/service kojivmd stop &> /dev/null /sbin/service kojivmd stop &> /dev/null
/sbin/chkconfig --del kojivmd /sbin/chkconfig --del kojivmd
fi fi
%endif
%if %{use_systemd} %if %{use_systemd}
@ -432,8 +681,13 @@ if [ $1 = 0 ]; then
/sbin/chkconfig --del kojira /sbin/chkconfig --del kojira
fi fi
%endif %endif
%endif
%changelog %changelog
* Thu Mar 07 2019 Neal Gompa <ngompa13@gmail.com> - 1.17.0-2
- Enable Python 3 for Fedora 30+ and EL8+
- Sync packaging changes from upstream
* Thu Mar 07 2019 Patrick Uiterwijk <puiterwijk@redhat.com> - 1.17.0-1 * Thu Mar 07 2019 Patrick Uiterwijk <puiterwijk@redhat.com> - 1.17.0-1
- Rebase to 1.17.0 - Rebase to 1.17.0

Loading…
Cancel
Save