%global packname TH.data
%global packver 1.0
%global packrel 10

%bcond_with check

# Cannot use . in name
Name:             R-TH-data
Version:          %{packver}.%{packrel}
Release:          1
Summary:          Data for other R packages

License:          GPLv3
URL:              https://CRAN.R-project.org/package=TH.data
Source0:          ftp://cran.r-project.org/pub/R/contrib/main/%{packname}_%{packver}-%{packrel}.tar.gz

Requires:         R-core
Suggests:         R-gdata
Suggests:         R-plyr
Suggests:         R-dplyr

BuildRequires:    R-devel
BuildRequires:    tex(latex), tex(upquote.sty)
%if 0%{with check}
BuildRequires:    R-gdata
BuildRequires:    R-plyr
BuildRequires:    R-dplyr
%endif
BuildArch:        noarch

%description
Data for other R packages.


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


%build


%install
mkdir -p $RPM_BUILD_ROOT%{_datadir}/R/library
%{_bindir}/R CMD INSTALL -l $RPM_BUILD_ROOT%{_datadir}/R/library %{packname}
test -d %{packname}/src && (cd %{packname}/src; rm -f *.o *.so)
rm -rf $RPM_BUILD_ROOT%{_datadir}/R/library/R.css


%check
%if %{with check}
%{_bindir}/R CMD check %{packname}
%else
%{_bindir}/R CMD check --no-install %{packname}
%endif


%files
%dir %{_datadir}/R/library/%{packname}
%doc %{_datadir}/R/library/%{packname}/html
%{_datadir}/R/library/%{packname}/DESCRIPTION
%{_datadir}/R/library/%{packname}/INDEX
%{_datadir}/R/library/%{packname}/NAMESPACE
%{_datadir}/R/library/%{packname}/Meta
%{_datadir}/R/library/%{packname}/data/
%{_datadir}/R/library/%{packname}/help
%{_datadir}/R/library/%{packname}/rda/
%{_datadir}/R/library/%{packname}/PSGLMM_MEE/
%{_datadir}/R/library/%{packname}/demo/


%changelog
* Thu Jun 16 2022 misaka00251 <misaka00251@misakanet.cn> - 1.0.10-1
- Init package (Thanks to fedora team)
