%global packname  pmclust
%global rlibdir  %{_libdir}/R/library


Name:             R-%{packname}
Version:          0.2.0
Release:          2%{?dist}
Summary:          Parallel Model-Based Clustering using Expectation-Gathering-Maximization Algorithm for Finite Mixture Gaussian Model
License:          GPLv2+
URL:              http://cran.r-project.org/web/packages/%{packname}/index.html
Source0:          http://cran.r-project.org/src/contrib/%{packname}_%(echo %version | awk -F'\\.' '{print $1"."$2"-"$3}').tar.gz

Requires:         R-pbdMPI R-pbdBASE R-pbdDMAT 
Requires:         R-methods R-MASS 

BuildRequires:    R-devel tex(latex) R-pbdMPI R-pbdBASE R-pbdDMAT
BuildRequires:    R-methods R-MASS openmpi-devel


%description
Aims to utilize model-based clustering (unsupervised) for high dimensional
and ultra large data, especially in a distributed manner. The code employs
pbdMPI to perform a expectation-gathering-maximization algorithm for
finite mixture Gaussian models. The unstructured dispersion matrices are
assumed in the Gaussian models. The implementation is default in the
single program multiple data programming model. The code can be executed
through pbdMPI and independent to most MPI applications. See the High
Performance Statistical Computing website for more information, documents
and examples.

%prep
%setup -q -c -n %{packname}

%build

%install
mkdir -p %{buildroot}%{rlibdir}
%_openmpi_load
%{_bindir}/R CMD INSTALL -l %{buildroot}%{rlibdir} %{packname}
test -d %{packname}/src && (cd %{packname}/src; rm -f *.o *.so)
rm -f %{buildroot}%{rlibdir}/R.css

%check
%_openmpi_load
%{_bindir}/R CMD check %{packname}


%files
%dir %{rlibdir}/%{packname}
%doc %{rlibdir}/%{packname}/doc
%doc %{rlibdir}/%{packname}/html
%{rlibdir}/%{packname}/DESCRIPTION
%{rlibdir}/%{packname}/INDEX
%{rlibdir}/%{packname}/NAMESPACE
%{rlibdir}/%{packname}/Meta
%{rlibdir}/%{packname}/R
%{rlibdir}/%{packname}/help
%{rlibdir}/%{packname}/CITATION
%{rlibdir}/%{packname}/demo
%{rlibdir}/%{packname}/libs
%{rlibdir}/%{packname}/data
%exclude %{rlibdir}/%{packname}/tests


%changelog
* Tue Apr 23 2019 Dave Love <loveshack@fedoraproject.org> - 0.2.0-2
- Rebuild for current R

* Tue May  8 2018 Dave Love <loveshack@fedoraproject.org> - 0.2.0-1
- New version
- Fix License

* Mon Oct 30 2017 Dave Love <loveshack@fedoraproject.org> - 0.1.9-1
- initial package for Fedora