diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..2c7304b --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +/brio_1.1.0.tar.gz diff --git a/0001-Fix-return-type-of-fgetc.patch b/0001-Fix-return-type-of-fgetc.patch new file mode 100644 index 0000000..251063b --- /dev/null +++ b/0001-Fix-return-type-of-fgetc.patch @@ -0,0 +1,31 @@ +From 6beb3df583413a7084a9b2f6ffa6de3ea9817368 Mon Sep 17 00:00:00 2001 +From: Elliott Sales de Andrade +Date: Mon, 7 Sep 2020 23:52:27 -0400 +Subject: [PATCH] Fix return type of fgetc. + +On x86, this seems to work by fluke, but on other systems, it does not +work because `(char)EOF` never equals `EOF`, causing an infinite loop. + +Signed-off-by: Elliott Sales de Andrade +--- + src/file_line_endings.c | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/src/file_line_endings.c b/src/file_line_endings.c +index 4587994..e8c8709 100644 +--- a/src/file_line_endings.c ++++ b/src/file_line_endings.c +@@ -14,8 +14,8 @@ SEXP brio_file_line_endings(SEXP path) { + error("Could not open file: %s", path_c); + } + +- char c; +- char prev_c = '\0'; ++ int c; ++ int prev_c = '\0'; + while ((c = fgetc(fp)) != EOF) { + if (c == '\n') { + if (prev_c == '\r') { +-- +2.26.2 + diff --git a/R-brio.spec b/R-brio.spec new file mode 100644 index 0000000..2b6ec3e --- /dev/null +++ b/R-brio.spec @@ -0,0 +1,74 @@ +%global packname brio +%global packver 1.1.0 +%global rlibdir %{_libdir}/R/library + +Name: R-%{packname} +Version: 1.1.0 +Release: 1%{?dist} +Summary: Basic R Input Output + +License: MIT +URL: https://CRAN.R-project.org/package=%{packname} +Source0: https://cran.r-project.org/src/contrib/%{packname}_%{packver}.tar.gz +# https://github.com/r-lib/brio/pull/9 +Patch0001: 0001-Fix-return-type-of-fgetc.patch + +# Here's the R view of the dependencies world: +# Depends: +# Imports: +# Suggests: R-testthat >= 2.1.0, R-covr +# LinkingTo: +# Enhances: + +BuildRequires: R-devel +BuildRequires: tex(latex) +BuildRequires: R-testthat >= 2.1.0 + +%description +Functions to handle basic input output, these functions always read and write +UTF-8 (8-bit Unicode Transformation Format) files and provide more explicit +control over line endings. + + +%prep +%setup -q -c -n %{packname} + +pushd %{packname} +%patch0001 -p1 +# Don't need coverage; it's not packaged either. +sed -i 's/, covr//g' DESCRIPTION +popd + + +%build + + +%install +mkdir -p %{buildroot}%{rlibdir} +%{_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 +%{_bindir}/R CMD check %{packname} + + +%files +%dir %{rlibdir}/%{packname} +%doc %{rlibdir}/%{packname}/html +%{rlibdir}/%{packname}/DESCRIPTION +%doc %{rlibdir}/%{packname}/NEWS.md +%license %{rlibdir}/%{packname}/LICENSE +%{rlibdir}/%{packname}/INDEX +%{rlibdir}/%{packname}/NAMESPACE +%{rlibdir}/%{packname}/Meta +%{rlibdir}/%{packname}/R +%{rlibdir}/%{packname}/help +%dir %{rlibdir}/%{packname}/libs +%{rlibdir}/%{packname}/libs/%{packname}.so + + +%changelog +* Mon Sep 07 2020 Elliott Sales de Andrade - 1.1.0-1 +- initial package for Fedora diff --git a/sources b/sources new file mode 100644 index 0000000..abaccbe --- /dev/null +++ b/sources @@ -0,0 +1 @@ +SHA512 (brio_1.1.0.tar.gz) = 70e13328f606ff4e33f7533fb2bda7101c01100f38eba896833489227fc20ffc45c7ff9a38fa43076469f0134f6380ad2ad8f2d89ca77702a2664d408d3c168b