#4 Enable Python 3 for Fedora 30+ and EL8+
Merged 6 months ago by ngompa. Opened 6 months ago by ngompa.
rpms/ ngompa/koji enable-py3-koji  into  master

@@ -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

- 

file modified
+8 -7

@@ -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>

  Date: Thu, 7 Mar 2019 12:22:12 +0100

  Subject: [PATCH] Apply Fedora instance configuration

  

  Signed-off-by: Patrick Uiterwijk <patrick@puiterwijk.org>

  ---

-  cli/koji.conf | 24 +++++++++++-------------

-  1 file changed, 11 insertions(+), 13 deletions(-)

+  cli/koji.conf | 25 +++++++++++--------------

+  1 file changed, 11 insertions(+), 14 deletions(-)

  

  diff --git a/cli/koji.conf b/cli/koji.conf

- index addd4e3..4fcb2ae 100644

+ index addd4e3..3588c19 100644

  --- a/cli/koji.conf

  +++ b/cli/koji.conf

  @@ -3,18 +3,23 @@

@@ -39,10 +39,11 @@ 

   

   ;the service name of the principal being used by the hub

   ;krbservice = host

- @@ -29,16 +34,9 @@

+ @@ -28,17 +33,9 @@

+  ;enable to lookup dns canonical hostname for krb auth

   ;krb_canon_host = no

   

-  

+ -

  -;configuration for SSL authentication

  -

  -;client certificate

@@ -53,7 +54,7 @@ 

  -

  -;enabled plugins for CLI, runroot and save_failed_tree are available

  -;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

  +plugins = runroot

   

file modified
+355 -101

@@ -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

- %global _python_bytecompile_extra 1

+ %global _python_bytecompile_extra 0

  

- # Enable Python 3 builds for Fedora + EPEL >5

- # NOTE: do **NOT** change 'epel' to 'rhel' here, as this spec is also

- %if 0%{?fedora} || 0%{?rhel} > 7

+ %bcond_without python2

  %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

- %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

  

  # 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_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

- %global use_systemd 1

- %else

+ # If the definition isn't available for python3_pkgversion, define it

+ %{?!python3_pkgversion:%global python3_pkgversion 3}

+ 

+ %if 0%{?rhel} && 0%{?rhel} < 7

  %global use_systemd 0

  %global install_opt TYPE=sysv

+ %else

+ %global use_systemd 1

  %endif

  

  Name: koji

  Version: 1.17.0

- Release: 1%{?dist}

- # koji.ssl libs (from plague) are GPLv2+

+ Release: 2%{?dist}

+ # the included arch lib from yum's rpmUtils is GPLv2+

  License: LGPLv2 and GPLv2+

  Summary: Build system tools

  URL: https://pagure.io/koji/

@@ -41,125 +89,192 @@ 

  Patch100: fedora-config.patch

  

  BuildArch: noarch

- %if 0%{with python3}

- Requires: python3-%{name} = %{version}-%{release}

- Requires: python3-pycurl

- Requires: python3-libcomps

+ %if 0%{py3_support}

+ Requires: python%{python3_pkgversion}-%{name} = %{version}-%{release}

+ Requires: python%{python3_pkgversion}-libcomps

  %else

  Requires: python2-%{name} = %{version}-%{release}

- %if 0%{?fedora}

- Requires: python2-libcomps

- Requires: python2-pycurl

- %endif

- %if 0%{?rhel}

- Requires: python-pycurl

- %endif

- %if 0%{?rhel} >= 7

+ %if 0%{?fedora} || 0%{?rhel} >= 7

  Requires: python-libcomps

  %endif

  %endif

- BuildRequires: python

- BuildRequires: python-sphinx

  %if %{use_systemd}

  BuildRequires: systemd

  BuildRequires: pkgconfig

  %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

  Koji is a system for building and tracking RPMS.  The base package

  contains shared libraries and the command-line interface.

  

+ %if 0%{py2_support}

  %package -n python2-%{name}

  Summary: Build system tools python library

  %{?python_provide:%python_provide python2-%{name}}

- BuildRequires: python2-devel

- Requires: python-krbV >= 1.0.13

+ BuildRequires: python-devel

+ %if 0%{?fedora} >= 25 || 0%{?rhel} >= 8

+ Requires: python2-rpm

+ %else

  Requires: rpm-python

+ %endif

  Requires: pyOpenSSL

  Requires: python-requests

+ %if 0%{?fedora} >= 23 || 0%{?rhel} >= 7

  Requires: python-requests-kerberos

+ %else

+ Requires: python-krbV >= 1.0.13

+ %endif

  Requires: python-dateutil

  Requires: python-six

  

  %description -n python2-%{name}

- Koji is a system for building and tracking RPMS.  The base package

- contains shared libraries and the command-line interface.

+ desc

+ %endif

  

- %if 0%{with python3}

- %package -n python3-%{name}

+ %if 0%{py3_support}

+ %package -n python%{python3_pkgversion}-%{name}

  Summary: Build system tools python library

- %{?python_provide:%python_provide python3-%{name}}

- BuildRequires: python3-devel

- Requires: python3-rpm

- Requires: python3-pyOpenSSL

- Requires: python3-requests

- Requires: python3-requests-kerberos

- Requires: python3-dateutil

- Requires: python3-six

- 

- %description -n python3-%{name}

- Koji is a system for building and tracking RPMS.  The base package

- contains shared libraries and the command-line interface.

+ %{?python_provide:%python_provide python%{python3_pkgversion}-%{name}}

+ BuildRequires: python%{python3_pkgversion}-devel

+ %if 0%{?fedora} >= 25 || 0%{?rhel} >= 8

+ Requires: python%{python3_pkgversion}-rpm

+ %else

+ Requires: rpm-python%{python3_pkgversion}

+ %endif

+ Requires: python%{python3_pkgversion}-pyOpenSSL

+ Requires: python%{python3_pkgversion}-requests

+ Requires: python%{python3_pkgversion}-requests-kerberos

+ Requires: python%{python3_pkgversion}-dateutil

+ Requires: python%{python3_pkgversion}-six

+ 

+ %description -n python%{python3_pkgversion}-%{name}

+ desc

  %endif

  

+ %if 0%{py2_support}

  %package -n python2-%{name}-cli-plugins

  Summary: Koji client plugins

  License: LGPLv2

- Requires: %{name} = %{version}-%{release}

+ Requires: python2-%{name} = %{version}-%{release}

  

  %description -n python2-%{name}-cli-plugins

  Plugins to the koji command-line interface

+ %endif

  

- %if 0%{with python3}

- %package -n python3-%{name}-cli-plugins

+ %if 0%{py3_support}

+ %package -n python%{python3_pkgversion}-%{name}-cli-plugins

  Summary: Koji client plugins

  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

  %endif

  

  %package hub

  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

  # 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: 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

+ %endif

  

  %package hub-plugins

  Summary: Koji hub plugins

  License: LGPLv2

- Requires: %{name}-hub = %{version}-%{release}

- Requires: python-qpid >= 0.7

- Requires: python-qpid-proton

- Requires: cpio

+ Requires: %{name}-hub-plugins-code = %{version}-%{release}

+ %if 0%{?fedora} || 0%{?rhel} > 7

+ Suggests: python%{python3_pkgversion}-%{name}-hub-plugins

+ %endif

  

  %description hub-plugins

  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

  Summary: Koji RPM builder daemon

  License: LGPLv2 and GPLv2+

  #mergerepos (from createrepo) is GPLv2+

- Requires: python2-%{name} = %{version}-%{release}

  Requires: mock >= 0.9.14

  Requires(pre): /usr/sbin/useradd

  Requires: squashfs-tools

- Requires: python2-multilib

  %if %{use_systemd}

  Requires(post): systemd

  Requires(preun): systemd

@@ -173,8 +288,17 @@ 

  Requires: /usr/bin/cvs

  Requires: /usr/bin/svn

  Requires: /usr/bin/git

- Requires: python-cheetah

  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

  koji-builder is the daemon that runs on build machines and executes

@@ -183,7 +307,7 @@ 

  %package vm

  Summary: Koji virtual machine management daemon

  License: LGPLv2

- Requires: python2-%{name} = %{version}-%{release}

+ Requires: %{name} = %{version}-%{release}

  %if %{use_systemd}

  Requires(post): systemd

  Requires(preun): systemd

@@ -194,8 +318,13 @@ 

  Requires(preun): /sbin/chkconfig

  Requires(preun): /sbin/service

  %endif

+ %if 0%{py3_support} > 1

+ Requires: python%{python3_pkgversion}-libvirt

+ Requires: python%{python3_pkgversion}-libxml2

+ %else

  Requires: libvirt-python

  Requires: libxml2-python

+ %endif

  Requires: /usr/bin/virt-clone

  Requires: qemu-img

  

@@ -206,8 +335,12 @@ 

  %package utils

  Summary: Koji Utilities

  License: LGPLv2

+ Requires: %{name} = %{version}-%{release}

+ %if 0%{py3_support} > 1

+ Requires: python%{python3_pkgversion}-psycopg2

+ %else

  Requires: python-psycopg2

- Requires: python2-%{name} = %{version}-%{release}

+ %endif

  %if %{use_systemd}

  Requires(post): systemd

  Requires(preun): systemd

@@ -220,64 +353,157 @@ 

  %package web

  Summary: Koji Web UI

  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: mod_wsgi

+ %if 0%{?fedora} >= 21 || 0%{?rhel} >= 7

  Requires: mod_auth_gssapi

+ %else

+ Requires: mod_auth_kerb

+ Requires: python-krbV >= 1.0.13

+ %endif

  Requires: python-psycopg2

  Requires: python-cheetah

  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.

+ %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

  %setup -q

+ 

  %patch100 -p1 -b .fedoraconfig

  

+ 

  %build

+ # Nothing to build

+ 

  

  %install

- rm -rf $RPM_BUILD_ROOT

- make DESTDIR=$RPM_BUILD_ROOT %{?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

+ %if 0%{py2_support} < 2  &&  0%{py3_support} < 2

+ echo "At least one python must be built with full support"

+ exit 1

+ %endif

+ 

+ # python2 build

+ %if 0%{py2_support} > 1

+ make DESTDIR=$RPM_BUILD_ROOT PYTHON=%{__python2} %{?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

- 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

  %if 0%{?fedora} <= 29

  # 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

  %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

  %{_bindir}/*

  %config(noreplace) /etc/koji.conf

  %dir /etc/koji.conf.d

  %doc docs Authors COPYING LGPL

  

+ %if 0%{py2_support}

  %files -n python2-%{name}

  %{python2_sitelib}/%{name}

  %{python2_sitelib}/koji_cli

+ %endif

  

- %if 0%{with python3}

+ %if 0%{py3_support}

  %files -n python%{python3_pkgversion}-koji

  %{python3_sitelib}/%{name}

  %{python3_sitelib}/koji_cli

  %endif

  

+ %if 0%{py2_support}

  %files -n python2-%{name}-cli-plugins

  %{python2_sitelib}/koji_cli_plugins

  # we don't have config files for default plugins yet

  #%%dir %%{_sysconfdir}/koji/plugins

  #%%config(noreplace) %%{_sysconfdir}/koji/plugins/*.conf

+ %endif

  

- %if 0%{with python3}

+ %if 0%{py3_support}

  %files -n python%{python3_pkgversion}-%{name}-cli-plugins

  %{python3_sitelib}/koji_cli_plugins

  # we don't have config files for default plugins yet

@@ -286,23 +512,45 @@ 

  %endif

  

  %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

  %dir /etc/koji-hub

  %config(noreplace) /etc/koji-hub/hub.conf

  %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

- %dir %{_prefix}/lib/koji-hub-plugins

- %{_prefix}/lib/koji-hub-plugins/*.py*

- %{_prefix}/lib/koji-hub-plugins/__pycache__/

  %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

  %{_sbindir}/kojira

@@ -322,20 +570,25 @@ 

  %config(noreplace) /etc/koji-shadow/koji-shadow.conf

  

  %files web

- %{_datadir}/koji-web

  %dir /etc/kojiweb

  %config(noreplace) /etc/kojiweb/web.conf

  %config(noreplace) /etc/httpd/conf.d/kojiweb.conf

  %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

  %{_sbindir}/kojid

  %dir %{_libexecdir}/kojid

  %{_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}

  %{_unitdir}/kojid.service

  %else

@@ -343,10 +596,7 @@ 

  %config(noreplace) /etc/sysconfig/kojid

  %endif

  %dir /etc/kojid

- %dir /etc/kojid/plugins

  %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

  

  %pre builder

@@ -409,7 +659,6 @@ 

    /sbin/service kojivmd stop &> /dev/null

    /sbin/chkconfig --del kojivmd

  fi

- %endif

  

  %if %{use_systemd}

  

@@ -432,8 +681,13 @@ 

    /sbin/chkconfig --del kojira

  fi

  %endif

+ %endif

  

  %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

  - Rebase to 1.17.0

  

This PR synchronizes changes from upstream Koji's packaging to support using Python 3 for Fedora 30 onward, including EL8.

For Fedora < 30 and EL < 8, it'll use the configuration it has previously.

rebased onto 4b7869a

6 months ago

rebased onto de5268f

6 months ago

= 21? is such check really needed?

Probably not, I'll change this check to make more sense.

rebased onto 12a6367

6 months ago

Pull-Request has been merged by ngompa

6 months ago

koji-builder-1.17.0-4.fc31 requires:
× /usr/bin/python2
✔ /usr/bin/python3

koji-builder-1.17.0-4.fc31 requires:
× /usr/bin/python2
✔ /usr/bin/python3

This will be true until the /usr/libexec/kojid/mergerepos is dropped from Koji. I'm planning on preparing a patch for that to be dropped in Koji 1.18.