Blob Blame History Raw
%global distname fedrepo_req

# Note that enabling python3 will disable python2
%if 0%{?fedora} || 0%{?rhel} > 7
%bcond_without python3
%else
%bcond_with python3
%endif

%if %{with python3}
%global python_version 3
%else
%global python_version 2
%endif
%global used_python_sitelib %{expand:%{python%{python_version}_sitelib}}


Name:           fedrepo-req
Version:        1.11.1
Release:        1%{?dist}
Summary:        CLI for Fedora package repo requests
License:        GPLv2+
URL:            https://pagure.io/fedrepo_req
Source0:        https://pypi.io/packages/source/f/%{distname}/%{distname}-%{version}.tar.gz

BuildArch:      noarch

BuildRequires:  help2man

%if %{with python3}
BuildRequires:  python3-devel
BuildRequires:  python3-bugzilla
BuildRequires:  python3-fedora
BuildRequires:  python3-PyYAML
BuildRequires:  python3-six
BuildRequires:  python3-setuptools
BuildRequires:  python3-requests
BuildRequires:  python3-click
BuildRequires:  python3-setuptools
BuildRequires:  python3-click
BuildRequires:  python3-requests
BuildRequires:  python3-mock
BuildRequires:  python3-pytest

%else
BuildRequires:  python2-devel
BuildRequires:  python-bugzilla
BuildRequires:  python-fedora
BuildRequires:  python-six

%if 0%{?fedora} || 0%{?rhel} > 7
BuildRequires:  python2-setuptools
BuildRequires:  python2-click
BuildRequires:  python2-requests
%if 0%{?fedora} < 28
BuildRequires:  PyYAML
%else
BuildRequires:  python2-pyyaml
%endif

%else
BuildRequires:  python-setuptools
BuildRequires:  python-click
BuildRequires:  python-requests
BuildRequires:  PyYAML
%endif

# For tests
%if 0%{?fedora} || 0%{?rhel} > 7
BuildRequires:  python2-mock
BuildRequires:  python2-pytest
%else
BuildRequires:  python-mock
%if 0%{?rhel}
BuildRequires:  pytest
%else
BuildRequires: python-pytest
%endif
%endif
%endif

Requires: python%{python_version}-fedrepo-req = %{version}-%{release}

# Some people are confused that the repo is called fedrepo_req while the rpm is
# called fedrepo-req.  This line should allow people to search for and install
# 'fedrepo_req' by name.
Provides: fedrepo_req


%description
CLI for Fedora package request

%if %{with python3}

%package -n python3-fedrepo-req
Summary:        Common dependencies for fedrepo-req and fedrepo-req-admin
%{?python_provide:%python_provide python3-fedrepo-req}

# To provide a clear upgrade path:
Obsoletes: python2-fedrepo-req < %{version}-%{release}
Conflicts: python2-fedrepo-req < %{version}-%{release}

Requires:  git-core
Requires:  python3-bugzilla
Requires:  python3-fedora
Requires:  python3-PyYAML
Requires:  python3-six
Requires:  python3-requests
Requires:  python3-click

%description -n python3-fedrepo-req
Common dependencies for fedrepo-req and fedrepo-req-admin

%else

%package -n python2-fedrepo-req
Summary:        Common dependencies for fedrepo-req and fedrepo-req-admin
%{?python_provide:%python_provide python2-fedrepo-req}

Requires:  git-core
Requires:  python-bugzilla
Requires:  python-fedora
Requires:  python-six

%if 0%{?fedora} || 0%{?rhel} > 7
Requires:  python2-click
Requires:  python2-requests
%if 0%{?fedora} < 28
BuildRequires:  PyYAML
%else
BuildRequires:  python2-pyyaml
%endif
%else
Requires:  python-click
Requires:  python-requests
Requires:  PyYAML
%endif

%description -n python2-fedrepo-req
Common dependencies for fedrepo-req and fedrepo-req-admin

%endif

%package -n fedrepo-req-admin
Summary:        CLI tool for processing Fedora packaging repo requests

Requires: python%{python_version}-fedrepo-req = %{version}-%{release}

%description -n fedrepo-req-admin
CLI tool for processing Fedora packaging repo requests


%prep
%setup -q -n %{distname}-%{version}


%build
%if %{with python3}
%py3_build
%else
%py2_build
%endif

%check
export FEDREPO_REQ_TEST_CONFIG=true
%if %{with python3}
export PYTHONPATH=%{buildroot}/%{python3_sitelib}
export LC_ALL=C.UTF-8
export LANG=C.UTF-8
py.test-3 tests/
%else
export PYTHONPATH=%{buildroot}/%{python2_sitelib}
py.test tests/
%endif

unset FEDREPO_REQ_TEST_CONFIG


%install
# Set where the config file is so that generating the man pages will not traceback
export FEDREPO_REQ_CONFIG=%{buildroot}/%{_sysconfdir}/fedrepo_req/config.ini

%if %{with python3}
export PYTHONPATH=%{buildroot}/%{python3_sitelib}
export LC_ALL=C.UTF-8
export LANG=C.UTF-8
%py3_install
%else
export PYTHONPATH=%{buildroot}/%{python2_sitelib}
%py2_install
%endif

cat >append-to-manual <<EOF
[see also]
%{_pkgdocdir}/README.md
EOF

mkdir -p %{buildroot}/%{_mandir}/man1
help2man -N --version-string=%{version} --include=append-to-manual %{buildroot}/%{_bindir}/fedrepo-req > %{buildroot}/%{_mandir}/man1/fedrepo-req.1
help2man -N --version-string=%{version} --include=append-to-manual %{buildroot}/%{_bindir}/fedrepo-req-branch > %{buildroot}/%{_mandir}/man1/fedrepo-req-branch.1
help2man -N --version-string=%{version} --include=append-to-manual %{buildroot}/%{_bindir}/fedrepo-req-admin > %{buildroot}/%{_mandir}/man1/fedrepo-req-admin.1
unset FEDREPO_REQ_CONFIG


%files
%doc README.md
%license LICENSE
%{used_python_sitelib}/%{distname}/fedrepo_req.py*
%{used_python_sitelib}/%{distname}/fedrepo_req_branch.py*
%{_bindir}/fedrepo-req
%{_bindir}/fedrepo-req-branch
%{_mandir}/man1/fedrepo-req.1*
%{_mandir}/man1/fedrepo-req-branch.1*
%if %{with python3}
%{python3_sitelib}/%{distname}/__pycache__/fedrepo_req.*.pyc
%{python3_sitelib}/%{distname}/__pycache__/fedrepo_req_branch.*.pyc
%endif


%if %{with python3}

%files -n python3-fedrepo-req
%doc README.md
%license LICENSE
%dir %{_sysconfdir}/fedrepo_req/
%config(noreplace) %{_sysconfdir}/fedrepo_req/config.ini
%dir %{python3_sitelib}/%{distname}/
%{python3_sitelib}/%{distname}/__init__.py
%{python3_sitelib}/%{distname}/bugzilla.py
%{python3_sitelib}/%{distname}/config.py
%{python3_sitelib}/%{distname}/exceptions.py
%{python3_sitelib}/%{distname}/fas.py
%{python3_sitelib}/%{distname}/git.py
%{python3_sitelib}/%{distname}/pagure.py
%{python3_sitelib}/%{distname}/pdc.py
%{python3_sitelib}/%{distname}/request_utils.py
%{python3_sitelib}/%{distname}/utils.py
%{python3_sitelib}/%{distname}*.egg-info
%{python3_sitelib}/%{distname}/__pycache__/
%exclude %{python3_sitelib}/%{distname}/__pycache__/fedrepo_req.*.pyc
%exclude %{python3_sitelib}/%{distname}/__pycache__/fedrepo_req_admin.*.pyc
%exclude %{python3_sitelib}/%{distname}/__pycache__/fedrepo_req_branch.*.pyc

%else

%files -n python2-fedrepo-req
%doc README.md
%license LICENSE
%dir %{_sysconfdir}/fedrepo_req/
%config(noreplace) %{_sysconfdir}/fedrepo_req/config.ini
%dir %{python2_sitelib}/%{distname}/
%{python2_sitelib}/%{distname}/__init__.py*
%{python2_sitelib}/%{distname}/bugzilla.py*
%{python2_sitelib}/%{distname}/config.py*
%{python2_sitelib}/%{distname}/exceptions.py*
%{python2_sitelib}/%{distname}/fas.py*
%{python2_sitelib}/%{distname}/git.py*
%{python2_sitelib}/%{distname}/pagure.py*
%{python2_sitelib}/%{distname}/pdc.py*
%{python2_sitelib}/%{distname}/request_utils.py*
%{python2_sitelib}/%{distname}/utils.py*
%{python2_sitelib}/%{distname}*.egg-info

%endif

%files -n fedrepo-req-admin
%doc README.md
%license LICENSE
%{used_python_sitelib}/%{distname}/fedrepo_req_admin.py*
%{_bindir}/fedrepo-req-admin
%{_mandir}/man1/fedrepo-req-admin.1*
%if %{with python3}
%{python3_sitelib}/%{distname}/__pycache__/fedrepo_req_admin.*.pyc
%endif


%changelog
* Sun Feb 18 2018 mprahl <mprahl@redhat.com> - 1.11.1-1
- new version

* Wed Feb 07 2018 mprahl <mprahl@redhat.com> - 1.11.0-1
- new version

* Wed Feb 07 2018 Fedora Release Engineering <releng@fedoraproject.org> - 1.10.0-3
- Rebuilt for https://fedoraproject.org/wiki/Fedora_28_Mass_Rebuild

* Tue Feb  6 2018 Peter Oliver <rpm@mavit.org.uk> - 1.10.0-2
- Link to full documentation from generated man pages.

* Wed Jan 17 2018 mprahl <mprahl@redhat.com> - 1.10.0-1
- Support Fedora 28 requests
- Stop allowing EPEL branches on official EL packages that are on all arches
- Add retry attempts on failed API calls
- Don't allow someone to request a repo for a Bugzilla bug they aren't the owner of

* Fri Oct 20 2017 Matt Prahl <mprahl@redhat.com> - 1.9.0-1
- Bump to version 1.9.0

* Fri Oct 6 2017 Matt Prahl <mprahl@redhat.com> - 1.8.0-1
- Bump to version 1.8.0

* Mon Sep 11 2017 Matt Prahl <mprahl@redhat.com> - 1.7.0-1
- Bump to version 1.7.0

* Fri Sep 01 2017 Matt Prahl <mprahl@redhat.com> - 1.6.0-4
- Change requirement from git to git-core in Python 3 version

* Mon Aug 28 2017 Matt Prahl <mprahl@redhat.com> - 1.6.0-3
- Add compatibility for older python-bugzilla versions

* Sat Aug 26 2017 Matt Prahl <mprahl@redhat.com> - 1.6.0-2
- Fix the f25 build

* Sat Aug 26 2017 Matt Prahl <mprahl@redhat.com> - 1.6.0-1
- Bump to version 1.6.0

* Wed Aug 23 2017 Miro HronĨok <mhroncok@redhat.com> - 1.5.0-3
- Use Python 3 on Fedora

* Tue Aug 22 2017 Matt Prahl <mprahl@redhat.com> - 1.5.0-2
- More fixes on requirements for PyYAML in rawhide builds
- Remove f24 support

* Tue Aug 22 2017 Matt Prahl <mprahl@redhat.com> - 1.5.0-1
- Bump to version 1.5.0
- More fixes on requirements for PyYAML in rawhide builds

* Sun Aug 20 2017 Matt Prahl <mprahl@redhat.com> - 1.4.0-2
- Change requirement from git to git-core
- Fix requirements for PyYAML in rawhide builds

* Thu Aug 17 2017 Matt Prahl <mprahl@redhat.com> - 1.4.0-1
- Bump to version 1.4.0

* Tue Aug 15 2017 Matt Prahl <mprahl@redhat.com> - 1.3.0-1
- Bump to version 1.3.0

* Tue Aug 15 2017 Matt Prahl <mprahl@redhat.com> - 1.2.0-1
- Bump to version 1.2.0

* Mon Aug 14 2017 Matt Prahl <mprahl@redhat.com> - 1.0.0-2
- Add man pages

* Thu Aug 10 2017 Matt Prahl <mprahl@redhat.com> - 1.0.0-1
- Bump to version 1.0.0

* Wed Aug 09 2017 Matt Prahl <mprahl@redhat.com> - 0.8.0-1
- Bump to version 0.8.0

* Wed Aug 09 2017 Ralph Bean <rbean@redhat.com> - 0.6.0-2
- Add provides on fedrepo_req, for convenience and ease!

* Tue Aug 08 2017 Matt Prahl <mprahl@redhat.com> - 0.6.0-1
- Bump to version 0.6.0

* Fri Jul 07 2017 Matt Prahl <mprahl@redhat.com> - 0.1.6-1
- Initial packaging