Blob Blame History Raw
# RHEL 6 compatibility.
%if 0%{?fedora} > 12
%global with_python3 1
%else
%{!?__python2: %global __python2 /usr/bin/python2}
%{!?python2_sitelib: %global python2_sitelib %(%{__python2} -c "from distutils.sysconfig import get_python_lib; print (get_python_lib())")}
%endif

# packages required at both test time and run time
%global test_requires2 python2-cached_property python2-productmd python-six python-setuptools
%global test_requires3 python3-cached_property python3-productmd python3-six python3-setuptools

%global srcname fedfind

Name:           fedfind
Version:        2.4.3
Release:        1%{?dist}
Summary:        Fedora Finder finds Fedora

Group:          Applications/Productivity
License:        GPLv3+
URL:            https://www.happyassassin.net/fedfind
Source0:        https://www.happyassassin.net/fedfind/releases/%{srcname}-%{version}.tar.xz
BuildArch:      noarch

BuildRequires:  python2-devel
# No python2-pytest on EL or F22
BuildRequires:  pytest
# No python2-mock on EL or F22
BuildRequires:  python-mock
BuildRequires:  %{test_requires2}
%if 0%{?with_python3}
BuildRequires:  python3-devel
BuildRequires:  python3-setuptools
BuildRequires:  python3-pytest
BuildRequires:  python3-mock
BuildRequires:  %{test_requires3}
%endif # if with_python3
# Not available on EPEL, so made optional in code
# Recommends:   python-subprocess32
Requires:       %{test_requires2}
Provides:       python2-fedfind = %{version}-%{release}
Provides:       python-fedfind = %{version}-%{release}

%description
Fedora Finder finds Fedora. For now, that means it finds Fedora images
- for stable releases, milestone pre-releases, TC/RC composes, and
nightly builds. It provides a simple CLI for showing image URLs, and
can be used as a library by tools which need to find and do stuff with
Fedora images.

%if 0%{?with_python3}
%package -n python3-fedfind
Summary:        Fedora Finder finds Fedora (using Python 3)
Group:          Applications/Productivity
Requires:       %{test_requires3}
# old name from pre-Fedora packaging on happyassassin
Obsoletes:      fedfind3 < %{version}-%{release}
Provides:       fedfind3 = %{version}-%{release}

%description -n python3-fedfind
Fedora Finder finds Fedora. For now, that means it finds Fedora images
- for stable releases, milestone pre-releases, TC/RC composes, and
nightly builds. It provides a simple CLI for showing image URLs, and
can be used as a library by tools which need to find and do stuff with
Fedora images. This is the Python 3 build of the fedfind package.
%endif # with_python3


%prep
%setup -q -n %{srcname}-%{version}
%if 0%{?with_python3}
rm -rf %{py3dir}
cp -a . %{py3dir}
find %{py3dir} -name '*.py' | xargs sed -i '1s|^#!.*python2|#!%{__python3}|'
%endif # with_python3

%build
%{__python2} setup.py build

%if 0%{?with_python3}
pushd %{py3dir}
%{__python3} setup.py build
popd
%endif # with_python3

%install
rm -rf %{buildroot}

# Must do the python3 install first because the scripts in /usr/bin are
# overwritten with every setup.py install (and we want the python2 version
# to be the default for now).
%if 0%{?with_python3}
pushd %{py3dir}
%{__python3} setup.py install --skip-build --root %{buildroot}
popd
%endif # with_python3

%{__python2} setup.py install --skip-build --root %{buildroot}

%check
%{__python2} setup.py test

%if 0%{?with_python3}
pushd %{py3dir}
%{__python3} setup.py test
popd
%endif # with_python3

%files
%doc README.md CHANGELOG.md
%license COPYING
%{python2_sitelib}/%{srcname}*
%{_bindir}/fedfind

%if 0%{?with_python3}
%files -n python3-fedfind
%doc README.md CHANGELOG.md
%license COPYING
%{python3_sitelib}/%{srcname}*
%endif # with_python3


%changelog
* Wed Mar 30 2016 Adam Williamson <awilliam@redhat.com> - 2.4.3-1
- new release 2.4.3 (re-add milestone release support)

* Wed Mar 30 2016 Adam Williamson <awilliam@redhat.com> - 2.4.2-1
- new release 2.4.2 (temp get_package_nvras workaround for PDC problem)

* Mon Mar 21 2016 Adam Williamson <awilliam@redhat.com> - 2.4.1-1
- new release 2.4.1 (CLI search by cid / label, get_package_nvras)
- enable tests

* Thu Mar 17 2016 Adam Williamson <awilliam@redhat.com> - 2.3.0-1
- new release 2.3.0 (drop 'payload', support candidates synced to alt)

* Thu Mar 17 2016 Adam Williamson <awilliam@redhat.com> - 2.2.3-1
- new release 2.2.3 (fix a get_release bug which broke check-compose)

* Wed Mar 16 2016 Adam Williamson <awilliam@redhat.com> - 2.2.2-1
- new release 2.2.2 (fix get_size for Python 3)
    
* Wed Mar 16 2016 Adam Williamson <awilliam@redhat.com> - 2.2.1-1
- new release 2.2.1 (quite big changes to Pungi 4 compose handling)

* Thu Mar 03 2016 Adam Williamson <awilliam@redhat.com> - 2.1.1-1
- new release 2.1.1 (fix check_expected)

* Thu Mar 03 2016 Adam Williamson <awilliam@redhat.com> - 2.1.0-2
- version the python2-fedfind and python-fedfind provides

* Wed Mar 02 2016 Adam Williamson <awilliam@redhat.com> - 2.1.0-1
- new release 2.1.0 (various bugfixes)
- twiddle description a bit

* Mon Feb 29 2016 Adam Williamson <awilliam@redhat.com> - 2.0.0-1
- new release 2.0.0 (major rewrite for Pungi 4)
- add productmd requirement

* Wed Feb 03 2016 Fedora Release Engineering <releng@fedoraproject.org> - 1.6.2-3
- Rebuilt for https://fedoraproject.org/wiki/Fedora_24_Mass_Rebuild

* Tue Nov 10 2015 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.6.2-2
- Rebuilt for https://fedoraproject.org/wiki/Changes/python3.5

* Fri Oct 02 2015 Adam Williamson <awilliam@redhat.com> - 1.6.2-1
- new release 1.6.2: adjust for new Postrelease nightly location

* Tue Sep 29 2015 Adam Williamson <awilliam@redhat.com> - 1.6.1-1
- new release 1.6.1: behind the scenes stuff, docs changes

* Sat Sep 19 2015 Adam Williamson <awilliam@redhat.com> - 1.6-1
- new release 1.6: image tweaks, post-release daily handling

* Thu Sep 03 2015 Adam Williamson <awilliam@redhat.com> - 1.5.1-1
- new release 1.5.1: image 'size' property, more image parsing tweaks

* Thu Aug 27 2015 Adam Williamson <awilliam@redhat.com> - 1.5-1
- new release 1.5: rsync retries, release wait, tests, expected image changes

* Fri Aug 21 2015 Adam Williamson <awilliam@redhat.com> - 1.4.2-1
- new release 1.4.2: py3 fix

* Fri Aug 21 2015 Adam Williamson <awilliam@redhat.com> - 1.4.1-1
- new release 1.4.1: branched guessing, rsync cleanups, bugfixes

* Thu Aug 20 2015 Adam Williamson <awilliam@redhat.com> - 1.4-1
- new release 1.4: use multicall instead of multiprocess, improve caching

* Thu Aug 20 2015 Adam Williamson <awilliam@redhat.com> - 1.3-1
- new release 1.3: check compose status, image parsing improvements, speedups

* Thu Jul 23 2015 Adam Williamson <awilliam@redhat.com> - 1.2-1
- new release 1.2: proper logging, some small fixes

* Wed Jun 17 2015 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.1.5-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_23_Mass_Rebuild

* Thu Apr 30 2015 Adam Williamson <awilliam@redhat.com> - 1.1.5-1
- new release: add a 'generic URL' output, allow --milestone Branched/Rawhide

* Thu Apr 23 2015 Adam Williamson <awilliam@redhat.com> - 1.1.4-1
- new release: drop shebangs from non-exec files, fix them in exec files
- rename 'fedfind3' to 'python3-fedfind'
- drop the executables from the python3 package (not really needed)

* Thu Apr 16 2015 Adam Williamson <awilliam@redhat.com> - 1.1.3-1
- new release: drop bundled cached_property

* Tue Mar 10 2015 Adam Williamson <awilliam@redhat.com> - 1.1.2-1
- new release: fix path for milestone releases

* Thu Feb 26 2015 Adam Williamson <awilliam@redhat.com> - 1.1.1-1
- 1.1.1: handle a python3 argparse bug causing a crash when no subcmd given

* Thu Feb 26 2015 Adam Williamson <awilliam@redhat.com> - 1.1.0-1
- new release 1.1.0: cleaner URL pref implementation, Python 3 support
- add a fedfind3 package for Python 3

* Wed Feb 25 2015 Adam Williamson <awilliam@redhat.com> - 1.0.8-1
- 1.0.8: use dl.fp.o not download.fp.o URLs for TC/RC images

* Wed Feb 25 2015 Adam Williamson <awilliam@redhat.com> - 1.0.7-1
- 1.0.7: fix a bug in finding nightly images by type

* Wed Feb 18 2015 Adam Williamson <awilliam@redhat.com> - 1.0.6-1
- consolidate image versioning with python-wikitcms/relval, bugfixes

* Thu Feb 12 2015 Adam Williamson <awilliam@redhat.com> - 1.0.5-1
- new release 1.0.5: image detection bugfixes, no koji dep, cleanups

* Mon Feb 09 2015 Adam Williamson <awilliam@redhat.com> - 1.0.4-1
- new release 1.0.4: fix EL 6 compat

* Mon Feb 09 2015 Adam Williamson <awilliam@redhat.com> - 1.0.3-1
- new release 1.0.3: bugfixes, Python 2.6 / RHEL 6 compatibility

* Fri Feb 06 2015 Adam Williamson <awilliam@redhat.com> - 1.0.2-1
- new release 1.0.2: misc. bugfixes and CLI reorg

* Fri Feb 06 2015 Adam Williamson <awilliam@redhat.com> - 1.0.1-1
- add ppc to arches

* Thu Feb 05 2015 Adam Williamson <awilliam@redhat.com> - 1.0-1
- first package build of fedfind