commit b17af3977507b0cb03266d4b5af6b38dce61b69d
Author: Leigh Scott <leigh123linux(a)googlemail.com>
Date: Tue Mar 26 19:22:46 2019 +0000
Patch F30 to use python3
py3.patch | 84 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
rfpkg.spec | 89 +++++++++++++++++++++++++++++++++++++++++++++++++++++---------
2 files changed, 160 insertions(+), 13 deletions(-)
---
diff --git a/py3.patch b/py3.patch
new file mode 100644
index 0000000..2a2f45c
--- /dev/null
+++ b/py3.patch
@@ -0,0 +1,84 @@
+--- a/src/rfpkg/__init__.py
++++ b/src/rfpkg/__init__.py
+@@ -1,3 +1,4 @@
++from __future__ import absolute_import
+ # rfpkg - a Python library for RPM Packagers
+ #
+ # Copyright (C) 2011 Red Hat Inc.
+@@ -10,15 +11,17 @@
+ # option) any later version. See
http://www.gnu.org/copyleft/gpl.html for
+ # the full text of the license.
+
++from future import standard_library
++standard_library.install_aliases()
+ import pyrpkg
+ import os
+-import cli
++from . import cli
+ import git
+ import re
+ import rpmfusion_cert
+ import platform
+ import subprocess
+-import urlparse
++import urllib.parse
+ import koji
+
+
+@@ -97,7 +100,7 @@
+ except:
+ self._kojiprofile = self._orig_kojiprofile
+ return
+- for arch in self.secondary_arch.keys():
++ for arch in list(self.secondary_arch.keys()):
+ if self.repo_name in self.secondary_arch[arch]:
+ self._kojiprofile = arch
+ return
+@@ -125,7 +128,7 @@
+ """Loads a RPM Fusion package repository."""
+
+ if self.push_url:
+- parts = urlparse.urlparse(self.push_url)
++ parts = urllib.parse.urlparse(self.push_url)
+
+ if self.distgit_namespaced:
+ path_parts = [p for p in parts.path.split("/") if p]
+--- a/src/rfpkg/__main__.py
++++ b/src/rfpkg/__main__.py
+@@ -10,6 +10,7 @@
+ # option) any later version. See
http://www.gnu.org/copyleft/gpl.html for
+ # the full text of the license.
+
++from __future__ import print_function
+ import os
+ import sys
+ import logging
+--- a/src/rfpkg/cli.py
++++ b/src/rfpkg/cli.py
+@@ -1,3 +1,4 @@
++from __future__ import print_function
+ # cli.py - a cli client class module for rfpkg
+ #
+ # Copyright (C) 2011 Red Hat Inc.
+@@ -19,7 +19,7 @@
+ import textwrap
+ import hashlib
+
+-import pkgdb2client
++import rfpkgdb2client
+
+
+ class rfpkgClient(cliClient):
+@@ -78,8 +78,8 @@
+ self.push()
+
+ branch = self.cmd.branch_merge
+- pkgdb = pkgdb2client.PkgDB(
+- login_callback=pkgdb2client.ask_password,
url="https://admin.rpmfusion.org/pkgdb")
++ pkgdb = rfpkgdb2client.PkgDB(
++ login_callback=rfpkgdb2client.ask_password,
url="https://admin.rpmfusion.org/pkgdb")
+ pkgdb.retire_packages(repo_name, branch, namespace=namespace)
+ except Exception as e:
+ self.log.error('Could not retire package: %s' % e)
+
+
diff --git a/rfpkg.spec b/rfpkg.spec
index 10f131d..2d438fb 100644
--- a/rfpkg.spec
+++ b/rfpkg.spec
@@ -5,55 +5,100 @@
Name: rfpkg
Version: 1.25.6
-Release: 1%{?dist}
+Release: 2%{?dist}
Summary: RPM Fusion utility for working with dist-git
License: GPLv2+
Group: Applications/System
URL:
https://github.com/rpmfusion-infra/rfpkg
Source0: %url/archive/v%{version}/%{name}-%{version}.tar.gz
+Patch0: py3.patch
BuildArch: noarch
+
+# fedpkg command switched to python3 on Fedora 30 and RHEL > 8:
+%if 0%{?fedora} > 29 || 0%{?rhel} > 8
+%bcond_with python2
+%else
+%bcond_without python2
+%endif
+
+BuildRequires: bash-completion
+BuildRequires: git
+
+Requires: bodhi-client
+Requires: redhat-rpm-config
+Requires: koji
+
+%if %{with python2}
+# This package redefines __python and can use the python_ macros
+%global __python %{__python2}
+
BuildRequires: python2-devel
BuildRequires: python2-setuptools
BuildRequires: python2-setuptools pkgconfig
-
# We br these things for man page generation due to imports
BuildRequires: rpmfusion-cert
BuildRequires: packagedb-cli > 2.2
BuildRequires: pyrpkg >= 1.44
-BuildRequires: bash-completion
-
# For testing
BuildRequires: python-nose
BuildRequires: python-mock
-BuildRequires: git
Requires: pyrpkg >= 1.45
-Requires: redhat-rpm-config
Requires: python-pycurl
-requires: koji
Requires: python-fedora
Requires: rpmfusion-cert
Requires: rpmfusion-packager >= 0.6.1
-Requires: bodhi-client
Requires: packagedb-cli > 2.2
-%if 0%{?rhel} == 5 || 0%{?rhel} == 4
-Requires: python-kitchen
-%endif
+%else # python3
+# This package redefines __python and can use the python_ macros
+%global __python %{__python3}
+
+BuildRequires: python3-devel
+BuildRequires: python3-setuptools
+BuildRequires: python3-setuptools pkgconfig
+
+# We br these things for man page generation due to imports
+BuildRequires: python3-rpmfusion-cert
+BuildRequires: rfpkgdb-cli
+BuildRequires: python3-rpkg
+
+# For testing
+BuildRequires: python3-nose
+BuildRequires: python3-mock
+
+Requires: python3-rpkg
+Requires: redhat-rpm-config
+Requires: python3-pycurl
+Requires: python3-fedora
+Requires: python3-rpmfusion-cert
+Requires: rpmfusion-packager >= 0.6.3-2
+Requires: bodhi-client
+Requires: rfpkgdb-cli
+%endif
%description
RPM Fusion utility for working with dist-git.
%prep
%setup -q
+%if 0%{?fedora} > 29 || 0%{?rhel} > 8
+%patch0 -p1
+%endif
%build
-%{__python2} setup.py build
+%if %{with python2}
+%py2_build
%{__python2} src/rfpkg_man_page.py > rfpkg.1
+%else
+%py3_build
+%{__python3} src/rfpkg_man_page.py > rfpkg.1
+%endif
%install
-%{__python2} setup.py install --skip-build --root $RPM_BUILD_ROOT
+%if %{with python2}
+%py2_install
sed -e 's|^#!python|#!%{__python2}|g' -i $RPM_BUILD_ROOT%{_bindir}/rfpkg
sed -e 's|^#!python|#!%{__python2}|g' -i
$RPM_BUILD_ROOT%{python2_sitelib}/rfpkg/__main__.py
@@ -65,14 +110,29 @@ install -p -m 0644 rfpkg.1 $RPM_BUILD_ROOT%{_mandir}/man1
# The completion file must be named similarly to the command.
mv $RPM_BUILD_ROOT%{compdir}/rfpkg.bash $RPM_BUILD_ROOT%{compdir}/rfpkg
%endif
+%else
+%py3_install
+
+sed -e 's|^#!python|#!%{__python3}|g' -i $RPM_BUILD_ROOT%{_bindir}/rfpkg
+sed -e 's|^#!python|#!%{__python3}|g' -i
$RPM_BUILD_ROOT%{python3_sitelib}/rfpkg/__main__.py
+chmod a+x $RPM_BUILD_ROOT%{python3_sitelib}/rfpkg/__main__.py
+
+mkdir -p $RPM_BUILD_ROOT%{_mandir}/man1
+install -p -m 0644 rfpkg.1 $RPM_BUILD_ROOT%{_mandir}/man1
+%endif
%files
%doc README
%license COPYING
%{_bindir}/rfpkg
+%if %{with python2}
%{python2_sitelib}/rfpkg/
%{python2_sitelib}/rfpkg-%{version}-py%{python2_version}.egg-info/
+%else
+%{python3_sitelib}/rfpkg/
+%{python3_sitelib}/rfpkg-%{version}-py%{python3_version}.egg-info/
+%endif
%{_mandir}/man1/rfpkg.1*
%(dirname %{compdir})
%dir %{_sysconfdir}/rpkg
@@ -82,6 +142,9 @@ mv $RPM_BUILD_ROOT%{compdir}/rfpkg.bash
$RPM_BUILD_ROOT%{compdir}/rfpkg
%changelog
+* Tue Mar 26 2019 Leigh Scott <leigh123linux(a)googlemail.com> - 1.25.6-2
+- Switch to python3 for f30
+
* Mon Sep 03 2018 Sérgio Basto <sergio(a)serjux.com> - 1.25.6-1
- Update to 1.25.6 Fix new warnings of rpkg modules are deprecated