Blob Blame Raw
# needed for test content
%{?perl_default_filter}
%global __provides_exclude_from %{?_provides_exclude_from:%_provides_exclude_from|}%{_datadir}/fedora-review/
%global __requires_exclude_from %{?_requires_exclude_from:%_requires_exclude_from|}%{_datadir}/fedora-review/test/

#invoke with "--with tests" to enable tests
%bcond_with tests

# See notes in make_release which patches this.
## global     git_tag  .f03e4e7

# Support jenkins build number if available.
%global     build_nr %(echo "${BUILD_NUMBER:+.}${BUILD_NUMBER:-%%{nil\\}}")

Name:       fedora-review
Version:    0.6.1
Release:    6%{?build_nr}%{?git_tag}%{?dist}
Summary:    Review tool for fedora rpm packages

License:    GPLv2+
URL:        https://pagure.io/FedoraReview
Source0:    https://releases.pagure.org/FedoraReview/%{name}-%{version}%{?git_tag}.tar.gz

# Add mock-option '--no-bootstrap-chroot' to defaults, if mock >= 1.4.1
Patch0:     https://pagure.io/fork/besser82/FedoraReview/c/95c04ed7230671bc813fa1e5df99dc01101f1e85.patch#/fedora-review-0.6.1-fix_mock_gteq_141.patch

BuildArch:  noarch

BuildRequires:  python-BeautifulSoup
BuildRequires:  python-bugzilla
BuildRequires:  python-packaging
BuildRequires:  python-straight-plugin
%if 0%{?rhel} && 0%{?rhel} < 7
BuildRequires:  python-unittest2
%endif
BuildRequires:  python2-devel
BuildRequires:  rpm-python

Requires:       packagedb-cli
Requires:       fedora-packager
Requires:       python-BeautifulSoup
Requires:       python-bugzilla
Requires:       python-kitchen
Requires:       python-packaging
Requires:       python-straight-plugin
Requires:       packagedb-cli
Requires:       rpm-python
# licensecheck used to be in rpmdevtools, moved to devscripts later
# this is compatible with both situations without ifdefs
Requires:       %{_bindir}/licensecheck
%if 0%{?fedora} > 21
Requires:       dnf-plugins-core
%else
Requires:       yum-utils
%endif

# Let's be consistent with the name used on fedorahosted
provides:       FedoraReview = %{version}-%{release}

Provides:       %{name}-php-phpci = %{version}-%{release}
Obsoletes:      %{name}-php-phpci < %{version}-%{release}


%description
This tool automates much of the dirty work when reviewing a package
for the Fedora Package Collection like:

    * Downloading SRPM & SPEC.
    * Download upstream source
    * Check md5sums
    * Build and install package in mock.
    * Run rpmlint.
    * Generate a review template, which becomes the starting
      point for the review work.

The tool is composed of plugins, one for each supported language.
As of today, there is plugins for C/C++, Ruby, java, R, perl and
python.  There is also support for external tests that can be written
in a simple way in bash.


%package plugin-ruby
Summary: Enhanced ruby tests for fedora-review
Requires: %{name} = %{version}-%{release}

%description plugin-ruby
fedora-review ruby-specific tests, not installed by default.


%package tests
Summary: Test and test data files for fedora-review
Requires: %{name} = %{version}-%{release}
Requires: python-nose

%description tests
Tests are packaged separately due to space concerns.


%prep
%autosetup -p 1


%build
%py2_build


%install
%py2_install
pkg_dir="$RPM_BUILD_ROOT/%{python_sitelib}/FedoraReview"
ln -s %{_datadir}/%{name}/scripts $pkg_dir/scripts
ln -s %{_datadir}/%{name}/plugins $pkg_dir/plugins
cd test
bash < restore-links.sh
rm restore-links.sh remember-links
cd ..
cp -ar test "$RPM_BUILD_ROOT%{_datadir}/%{name}"
cp -a pep8.conf pylint.conf "$RPM_BUILD_ROOT%{_datadir}/%{name}"

# Fix shebangs in %%{_bindir}.
for f in $RPM_BUILD_ROOT%{_bindir}/*; do
	sed -e 's~^#!.*~#!%{__python2} -stt~' < ${f} > ${f}.new
	touch -r ${f} ${f}.new
	mv -f ${f}.new ${f}
done
chmod -c 0755 $RPM_BUILD_ROOT%{_bindir}/*


%check
%if %{with tests}
cd test
export REVIEW_LOGLEVEL=warning
export MAKE_RELEASE=1
mock --quiet -r fedora-21-i386 --init
mock --quiet -r fedora-20-i386 --init
mock --quiet -r fedora-21-i386 --uniqueext=hugo --init
%{__python2} -m unittest discover -f
%endif


%files
%doc README
%license COPYING AUTHORS
%{python2_sitelib}/FedoraReview
%{python2_sitelib}/fedora_review-%{version}-py%{python2_version}.egg-info
%{_bindir}/fedora-review
%{_bindir}/fedora-create-review
%{_bindir}/koji-download-scratch
%{_mandir}/man1/%{name}.1.*
%{_mandir}/man1/fedora-create-review.1.*
%dir %{_datadir}/%{name}
%{_datadir}/%{name}/plugins
%exclude %{_datadir}/%{name}/plugins/ruby.py
%{_datadir}/%{name}/scripts
%{_datadir}/%{name}/pep8.conf
%{_datadir}/%{name}/pylint.conf

%files plugin-ruby
%{_datadir}/%{name}/plugins/ruby.py

%files tests
%doc test/README.test
%{_datadir}/%{name}/test


%changelog
* Mon Jun 05 2017 Björn Esser <besser82@fedoraproject.org> - 0.6.1-6
- Fix shebangs in %%{_bindir}

* Fri Jun 02 2017 Björn Esser <besser82@fedoraproject.org> - 0.6.1-5
- Add mock-option '--no-bootstrap-chroot' to defaults, if mock >= 1.4.1
- Update spec file to recent guidelines
- Change package url and source to Pagure

* Fri Feb 10 2017 Fedora Release Engineering <releng@fedoraproject.org> - 0.6.1-4
- Rebuilt for https://fedoraproject.org/wiki/Fedora_26_Mass_Rebuild

* Thu Oct 06 2016 Pierre-Yves Chibon <pingou@pingoured.fr> - 0.6.1-3
- Drop requirement to python-argparse now that it has been in python's stdlib
  for so long

* Tue Jul 19 2016 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 0.6.1-2
- https://fedoraproject.org/wiki/Changes/Automatic_Provides_for_Python_RPM_Packages

* Mon May 02 2016 Alec Leamas <leamas.alec@gmail.com> - 0.6.1-1.f03e4e7
- New upstream release 0.6.1

* Tue Feb 16 2016 Orion Poplawski <orion@cora.nwra.com> - 0.6.0-4
- Exclude test content from perl requires

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

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

* Wed May 20 2015 Alec Leamas <leamas.alec@gmail.com> - 0.6.0-1.afb5485
- Update to 0.6.0

* Mon May 04 2015 Pierre-Yves Chibon <pingou@pingoured.fr> - 0.5.3-1
- Update to 0.5.3

* Wed Apr 22 2015 Adam Miller <maxamillion@fedoraproject.org> - 0.5.2-3
- Add conditional for unittest2 for epel7 (thanks mcepl@redhat.com for the fix)

* Mon Jan 19 2015 Stanislav Ochotnicky <sochotnicky@redhat.com> - 0.5.2-2
- Add patch for rhbz#1151943

* Mon Jul 14 2014 Stanislav Ochotnicky <sochotnicky@redhat.com> - 0.5.2-1
- Update to latest upstream bugfix release

* Sat Jun 07 2014 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 0.5.1-3
- Rebuilt for https://fedoraproject.org/wiki/Fedora_21_Mass_Rebuild

* Mon Jan 13 2014 Stanislav Ochotnicky <sochotnicky@redhat.com> - 0.5.1-2
- Backport fixes for several bugs
- Resolves: rhbz#1044580
- Resolves: rhbz#1049042

* Fri Dec 13 2013 Stanislav Ochotnicky <sochotnicky@redhat.com> - 0.5.1-1
- Update to latest upstream (0.5.1)

* Tue Oct 15 2013 Stanislav Ochotnicky <sochotnicky@redhat.com> - 0.5.0-3
- Really use phpcompatinfo instead of phpci

* Mon Oct 14 2013 Stanislav Ochotnicky <sochotnicky@redhat.com> - 0.5.0-2
- Fix requires for licensecheck (#1016309)
- Remove separate php plugin subpackage (#971875)

* Fri Aug 30 2013 Stanislav Ochotnicky <sochotnicky@redhat.com> - 0.5.0-1
- Updating to upstream 0.5.0

* Sat Aug 03 2013 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 0.4.1-4
- Rebuilt for https://fedoraproject.org/wiki/Fedora_20_Mass_Rebuild

* Wed Jul 17 2013 Petr Pisar <ppisar@redhat.com> - 0.4.1-3
- Perl 5.18 rebuild

* Thu May 30 2013 Stanislav Ochotnicky <sochotnicky@redhat.com> - 0.4.1-2
- Backport fix for #967571

* Mon Apr 29 2013 Stanislav Ochotnicky <sochotnicky@redhat.com> - 0.4.1-1
- Update to latest upstream version

* Tue Feb 19 2013 Stanislav Ochotnicky <sochotnicky@redhat.com> - 0.4.0-4
- Fix rhbz912182
- Reorganize patches a bit

* Fri Feb  8 2013 Stanislav Ochotnicky <sochotnicky@redhat.com> - 0.4.0-3
- Fix rhbz908830 and rhbz908830
- Add patch for REVIEW_NO_MOCKGROUP_TEST environment variable
- Remove old patch

* Mon Feb 04 2013 Pierre-Yves Chibon <pingou@pingoured.fr> - 0.4.0-2
- Add Patch0 (0001-Fix-syntax-error.patch) from Ralph Bean fixing fedora-create-review

* Mon Jan 28 2013 Stanislav Ochotnicky <sochotnicky@redhat.com> - 0.4.0-1
- Updating to upstream 0.4.0

* Wed Nov 07 2012 Pierre-Yves Chibon <pingou@pingoured.fr> - 0.3.1-3
- Backport from upstream's git fix to RHBZ#874246 (Patch0)

* Thu Oct 25 2012 Stanislav Ochotnicky <sochotnicky@redhat.com> - 0.3.1-2
- Add symlink to scripts directory so they are loaded

* Tue Sep 25 2012 Stanislav Ochotnicky <sochotnicky@redhat.com> - 0.3.1-1
- Update to lastest upstream (0.3.1)
- Fix loading of system-wide plugins
- Add back suport for EL6

* Mon Sep 24 2012 Stanislav Ochotnicky <sochotnicky@redhat.com> - 0.3.0-1
- Update to lastest upstream (0.3.0)
- Remove no longer needed build workarounds

* Thu Aug  9 2012 Stanislav Ochotnicky <sochotnicky@redhat.com> - 0.2.2-1
- Update to lastest upstream (0.2.2)
- Add koji-download-scratch script

* Thu Jul 19 2012 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 0.2.0-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_18_Mass_Rebuild

* Wed Jul 11 2012 Stanislav Ochotnicky <sochotnicky@redhat.com> - 0.2.0-1
- Update to latest release (0.2.0)

* Fri Feb 24 2012 Stanislav Ochotnicky <sochotnicky@redhat.com> - 0.1.3-1
- Update to latest bugfix release

* Fri Jan 13 2012 Stanislav Ochotnicky <sochotnicky@redhat.com> - 0.1.2-1
- Update to latest bugfix release
- Add fedora-create-review script

* Fri Jan 13 2012 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 0.1.1-3
- Rebuilt for https://fedoraproject.org/wiki/Fedora_17_Mass_Rebuild

* Wed Jan 11 2012 Pierre-Yves Chibon <pingou@pingoured.fr> - 0.1.1-2
- Add wget as requires

* Wed Nov 23 2011 Stanislav Ochotnicky <sochotnicky@redhat.com> - 0.1.1-1
- New upstream bugfix release

* Wed Nov 16 2011 Stanislav Ochotnicky <sochotnicky@redhat.com> - 0.1.0-2
- Remove things not needed in el6+

* Thu Nov 10 2011 Pierre-Yves Chibon <pingou@pingoured.fr> - 0.1.0-1
- Initial packaging work for Fedora