From 76b3de9b22caebee8f71414befe3eec101a1ccd2 Mon Sep 17 00:00:00 2001 From: Neal Gompa Date: Jan 07 2019 14:13:24 +0000 Subject: Revise the pagure-dist-git spec to build similarly to Pagure itself We don't build Pagure for both Python versions, so there's no reason to do the same for pagure-dist-git. In addition, the spec is greatly simplified now and is compatible with Pagure instances running on Fedora in Python 3. Finally, the setuptools data has been updated to indicate the correct minimum version of Pagure this is compatible with and a similar description to what is used in the spec file. Signed-off-by: Neal Gompa --- diff --git a/README.rst b/README.rst index 18ee674..d12b2f4 100644 --- a/README.rst +++ b/README.rst @@ -3,8 +3,8 @@ pagure-dist-git .. split here -This project implements a dynamic Git auth backend for Pagure for Fedora and CentOS -dist-git setups, which have slightly different access models than standard on Pagure. +This project implements a dynamic Git auth backend for Pagure for Dist-Git, +which has a slightly different access model than regular Pagure Git systems. Configuration ============= diff --git a/pagure-dist-git.spec b/pagure-dist-git.spec index 581698a..e7aeaf8 100644 --- a/pagure-dist-git.spec +++ b/pagure-dist-git.spec @@ -1,93 +1,65 @@ -# Python3 packaging is turned off until pagure itself is ported to python3. -%global with_python3 1 - -# Current EL releases & older Fedora use "python-*" -%if 0%{?el6} || 0%{?el7} || 0%{?fedora} < 25 -%define py_prefix python -%global with_python3 0 -%if 0%{?el6} || 0%{?el7} -BuildRequires: python-devel +%{?python_enable_dependency_generator} + +%if 0%{?rhel} && 0%{?rhel} < 8 +# Since the Python 3 stack in EPEL is missing too many dependencies, +# we're sticking with Python 2 there for now. +# And Pagure in Fedora 28 and lower is built for Python 2... +%global __python %{__python2} +%global python_pkgversion 2 +%global python_version %{python2_version} %else -BuildRequires: python2-devel +# Default to Python 3 when F29+ +%global __python %{__python3} +%global python_pkgversion %{python3_pkgversion} +%global python_version %{python3_version} %endif -%else -# Newer Fedora releases use "pythonX-*" -%define py_prefix python2 -BuildRequires: python2-devel -%endif - -%{!?_licensedir: %global license %%doc} - -%global modname pagure-dist-git -%global sum Pagure Git auth backend for Fedora and CentOS dist-git setups +# For now, to keep behavior consistent (and matching pagure package) +%global _python_bytecompile_extra 1 Name: pagure-dist-git Version: 1.2 Release: 1%{?dist} -Summary: %{sum} +Summary: Pagure Git auth backend for Dist-Git setups License: GPLv2+ -URL: http://pypi.python.org/pypi/pagure-dist-git -Source0: https://pypi.io/packages/source/p/%{modname}/%{modname}-%{version}.tar.gz +URL: https://pagure.io/pagure-dist-git +Source0: https://releases.pagure.org/%{name}/%{name}-%{version}.tar.gz BuildArch: noarch -# https://fedoraproject.org/wiki/Packaging:Guidelines#Noarch_with_Unported_Dependencies -ExclusiveArch: x86_64 noarch - - -%description -This implements access control list checks for Fedora and CentOS dist-git. -%package -n %{py_prefix}-%{modname} -Summary: Pagure Git auth backend for Fedora and CentOS dist-git -%{?python_provide:%python_provide python2-%{modname}} +BuildRequires: python%{python_pkgversion}-devel +BuildRequires: python%{python_pkgversion}-setuptools -BuildRequires: %{py_prefix}-devel -BuildRequires: %{py_prefix}-setuptools -# For tests -BuildRequires: %{py_prefix}-mock -BuildRequires: %{py_prefix}-pdc-client -BuildRequires: %{py_prefix}-nose -BuildRequires: pagure >= 5.2 +%if %{rhel} && 0%{?rhel} < 8 +Requires: python%{python_pkgversion}-pdc-client Requires: pagure >= 5.2 +%endif -%description -n %{py_prefix}-%{modname} -This implements access control list checks for Fedora and CentOS dist-git. - -%if 0%{?with_python3} -%package -n python3-%{modname} -Summary: Pagure Git auth backend for Fedora and CentOS dist-git -%{?python_provide:%python_provide python3-%{modname}} - -BuildRequires: python3-devel -BuildRequires: python3-setuptools -# For tests -BuildRequires: python3-mock -BuildRequires: python3-pdc-client -BuildRequires: python3-nose -BuildRequires: pagure >= 5.1 +# This is actually an extension to Pagure itself and can't be built this way +# So we're changing it all up.. +Obsoletes: python-%{name} < 1.2-2 +Obsoletes: python2-%{name} < 1.2-2 +Obsoletes: python3-%{name} < 1.2-2 +# However, we'll preserve some backwards compatibility here +Provides: python%{python_pkgversion}-%{name} = %{version}-%{release} -Requires: python3-pagure >= 5.1 +%description +This project hosts the logic to generate gitolite's configuration file for +Dist-Git, which has a different access model than regular Pagure Git systems. -%description -n python3-%{modname} -This implements access control list checks for Fedora and CentOS dist-git. -%endif %prep -%autosetup -n %{modname}-%{version} +%autosetup + %build -%py2_build -%if 0%{?with_python3} -%py3_build -%endif +%py_build + %install -%py2_install -%if 0%{?with_python3} -%py3_install -%endif +%py_install + # Install the different cron job scripts mkdir -p $RPM_BUILD_ROOT/%{_libexecdir}/pagure-dist-git/ @@ -97,27 +69,19 @@ install -p -m 644 scripts/*.py $RPM_BUILD_ROOT/%{_libexecdir}/pagure-dist-git/ %check # These tests don't currently pass because Pagure doesn't ship its testsuite exit 0 -nosetests -v -%if 0%{?with_python3} -nosetests-3 -v -%endif +nosetests-%{python_version} -v -%files -n %{py_prefix}-%{modname} -%doc README.rst -%license LICENSE -%{python2_sitelib}/dist_git_auth.py* -%{python2_sitelib}/pagure_dist_git-%{version}* -%{_libexecdir}/pagure-dist-git/ -%if 0%{?with_python3} -%files -n python3-%{modname} +%files %doc README.rst %license LICENSE -%{python3_sitelib}/dist_git_auth.py* -%{python3_sitelib}/__pycache__/* -%{python3_sitelib}/pagure_dist_git-%{version}* -%{_libexecdir}/pagure-dist-git/ +%{python_sitelib}/dist_git_auth.py* +%{python_sitelib}/pagure_dist_git-%{version}* +%if 0%{?python_pkgversion} != 2 +%{python3_sitelib}/__pycache__/dist_git_auth*.pyc %endif +%{_datadir}/pagure_dist_git/ +%{_libexecdir}/pagure-dist-git/ %changelog diff --git a/setup.py b/setup.py index 0a4aca0..676e19f 100644 --- a/setup.py +++ b/setup.py @@ -6,7 +6,7 @@ long_description = long_description.split('split here', 1)[1] f.close() install_requires = [ - 'pagure', + 'pagure>=5.2', ] tests_require = [ 'nose', @@ -16,7 +16,7 @@ tests_require = [ setup( name='pagure-dist-git', version='1.2', - description="Pagure Git auth backend for Fedora and CentOS dist-git", + description="Pagure Git auth backend for Dist-Git setups", long_description=long_description, author='Pierre-Yves Chibon', author_email='pingou@fedoraproject.org',