Blob Blame History Raw
%{!?python_sitelib: %global python_sitelib %(%{__python} -c "from distutils.sysconfig import get_python_lib; print get_python_lib()")}
%{!?python_version: %global python_version %(%{__python} -c "import sys; sys.stdout.write(sys.version[:3])")}

# From README.txt
# Python 2.6 or later but Python 3.x is not supported (yet).
%global with_python3 0

# http://bugs.mysql.com/68610 - Missing man pages
%if 0%{?fedora} >= 14
%global with_buildman 0
%else
%global with_buildman 0
%endif

Name:           mysql-utilities
Version:        1.2.1
Release:        2%{?dist}
Summary:        MySQL Utilities

Group:          Applications/Databases
License:        GPLv2
URL:            https://launchpad.net/mysql-utilities
# wget http://bazaar.launchpad.net/~mysql/mysql-utilities/trunk/tarball/301 -O mysql-utilities-1.2.1.tgz
Source0:        %{name}-%{version}.tgz

# Fix man page destination path
# http://bugs.mysql.com/68323
Patch0:         %{name}-man.patch


BuildArch:      noarch
BuildRequires:  python2-devel >= 2.6
BuildRequires:  mysql-connector-python
%if %{with_buildman}
# Man pages generated by upstream setup.py
BuildRequires:  python-sphinx >= 1.0
%else
# To generate our minimal man pages
BuildRequires:  help2man
%endif
%if %{with_python3}
BuildRequires:  python3-devel
%endif

Requires:       mysql-connector-python


%description
The MySQL Utilities is a set of easy-to-use scripts intended to make working
with servers easier. It is part of the MySQL Workbench.

Documentation:
http://dev.mysql.com/doc/workbench/en/mysql-utilities.html


%prep
%setup -q -n ~mysql/%{name}/trunk

%patch0 -p0 -b .manpath


%build
%if %{with_buildman}
%{__python} setup.py build_man
%else
: Minimal man pages will be generated
%endif


%install 
install --directory %{buildroot}%{_mandir}/man1

%if %{with_python3}
: Python 3 build
%{__python3} setup.py install --skip-profile --root %{buildroot}
rm -rf build
%endif

: Python 2 build - end with this for tests
%{__python} setup.py install --skip-profile --root %{buildroot}

# http://bugs.mysql.com/68614 - Issue with python 2.6
%if "%{python_version}" < "2.7"
: drop commands requiring python 2.7
rm %{buildroot}%{_bindir}/mysqlauditadmin
rm %{buildroot}%{_bindir}/mysqlauditgrep
%endif

%if ! %{with_buildman}
: Generate minimal man pages

export PYTHONPATH=%{buildroot}/%{python_sitelib}
ls -l %{python_sitelib}/mysql/connector
ln -s %{python_sitelib}/mysql/connector \
      %{buildroot}%{python_sitelib}/mysql/connector

for cmd in %{buildroot}%{_bindir}/*
do
  %{__python} $cmd --version
  name=$(basename $cmd)
  help2man --no-info \
           --output %{buildroot}%{_mandir}/man1/$name.1 \
           "%{__python} $cmd"
done

rm -f %{buildroot}%{python_sitelib}/mysql/connector
%endif


%check
%if "%{python_version}" >= "2.7"
%{__python} check.py
%endif


%files
%doc CHANGES.txt LICENSE.txt
%if "%{python_version}" >= "2.7"
%{_bindir}/mysqlauditadmin
%{_bindir}/mysqlauditgrep
%endif
%{_bindir}/mysqldbcompare
%{_bindir}/mysqldbcopy
%{_bindir}/mysqldbexport
%{_bindir}/mysqldbimport
%{_bindir}/mysqldiff
%{_bindir}/mysqldiskusage
%{_bindir}/mysqlfailover
%{_bindir}/mysqlindexcheck
%{_bindir}/mysqlmetagrep
%{_bindir}/mysqlprocgrep
%{_bindir}/mysqlreplicate
%{_bindir}/mysqlrpladmin
%{_bindir}/mysqlrplcheck
%{_bindir}/mysqlrplshow
%{_bindir}/mysqlserverclone
%{_bindir}/mysqlserverinfo
# http://bugs.mysql.com/68322
%exclude %{_bindir}/mysqluc
%{_bindir}/mysqluserclone
%{python_sitelib}/mysql/utilities
%{python_sitelib}/mysql_utilities*
%{_mandir}/man1/mysql*
%exclude %{_mandir}/man1/mysqluc*
# empty file already provided by mysql-connector-python
%exclude %{python_sitelib}/mysql/__init*


%changelog
* Fri Mar  8 2013 Remi Collet <remi@fedoraproject.org> - 1.2.1-2
- generate minimal man pages using help2man
  http://bugs.mysql.com/68610 - Missing man pages
- drop mysqlauditadmin and mysqlauditgrep on EPEL-6
  http://bugs.mysql.com/68614 - Issue with python 2.6

* Fri Mar  8 2013 Remi Collet <remi@fedoraproject.org> - 1.2.1-1
- update to 1.2.1
- no man pages, http://bugs.mysql.com/68610

* Fri Feb  8 2013 Remi Collet <remi@fedoraproject.org> - 1.2.0-1
- update to 1.2.0
- new commands: mysqlauditadmin and mysqlauditgrep

* Wed Jan  9 2013 Remi Collet <remi@fedoraproject.org> - 1.1.1-1
- update to 1.1.1

* Thu Oct  4 2012 Remi Collet <remi@fedoraproject.org> - 1.1.0-1
- update to 1.1.0
- new command mysqluc removed (broken)

* Fri Aug 10 2012 Remi Collet <remi@fedoraproject.org> - 1.0.6-1
- update to 1.0.6

* Fri Jul 20 2012 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.0.5-4
- Rebuilt for https://fedoraproject.org/wiki/Fedora_18_Mass_Rebuild

* Sun May 27 2012 Remi Collet <remi@fedoraproject.org> - 1.0.5-3
- no man for EL-6 (missing recent python-sphinx)

* Sun Apr 15 2012 Remi Collet <remi@fedoraproject.org> - 1.0.5-2
- fix BR to python2-devel
- incorrect-fsf-address and non-executable-script referenced as
  Oracle BUG#13956819
- remove mut man page (command not installed)

* Wed Apr 11 2012 Remi Collet <remi@fedoraproject.org> - 1.0.5-1
- initial RPM