From faab265411a61972692c5b96ae8a026a0dc135d5 Mon Sep 17 00:00:00 2001 From: Elliott Sales de Andrade Date: Mon, 5 Mar 2018 21:12:57 -0500 Subject: [PATCH] Initial import (#1551449). --- .gitignore | 1 + 0001-Fix-system-timezone-memoization.patch | 31 +++++++ R-lubridate.spec | 97 ++++++++++++++++++++++ README.md | 3 - sources | 1 + 5 files changed, 130 insertions(+), 3 deletions(-) create mode 100644 .gitignore create mode 100644 0001-Fix-system-timezone-memoization.patch create mode 100644 R-lubridate.spec delete mode 100644 README.md create mode 100644 sources diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..d093f73 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +/lubridate_1.7.3.tar.gz diff --git a/0001-Fix-system-timezone-memoization.patch b/0001-Fix-system-timezone-memoization.patch new file mode 100644 index 0000000..4049b5e --- /dev/null +++ b/0001-Fix-system-timezone-memoization.patch @@ -0,0 +1,31 @@ +From 997e5e05d70892222fb07c2d6ad483ad1e9a9607 Mon Sep 17 00:00:00 2001 +From: Elliott Sales de Andrade +Date: Sun, 4 Mar 2018 20:13:49 -0500 +Subject: [PATCH 1/2] Fix system timezone memoization. + +The result of `get_system_tz` comes from a `STRING_ELT`, which seems to +be automatically garbage collected, causing the static character pointer +to point to an invalid location. Duplicating the string is a small leak, +but prevents this invalid access. + +Signed-off-by: Elliott Sales de Andrade +--- + src/update.cpp | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/src/update.cpp b/src/update.cpp +index 4cddbb1..1f4a694 100644 +--- a/src/update.cpp ++++ b/src/update.cpp +@@ -95,7 +95,7 @@ const char* get_system_tz() { + + const char* local_tz() { + // initialize once per session +- static const char* SYS_TZ = get_system_tz(); ++ static const char* SYS_TZ = strdup(get_system_tz()); + const char* tz_env = std::getenv("TZ"); + if (tz_env == NULL) { + return SYS_TZ; +-- +2.14.3 + diff --git a/R-lubridate.spec b/R-lubridate.spec new file mode 100644 index 0000000..ca69db3 --- /dev/null +++ b/R-lubridate.spec @@ -0,0 +1,97 @@ +%global packname lubridate +%global rlibdir %{_libdir}/R/library + +# knitr is not yet available. +%global with_doc 0 + +Name: R-%{packname} +Version: 1.7.3 +Release: 1%{?dist} +Summary: Make dealing with dates a little easier + +License: GPLv2+ and ASL 2.0 +URL: https://cran.r-project.org/web/packages/%{packname}/index.html +Source0: https://cran.r-project.org/src/contrib/%{packname}_%{version}.tar.gz +# https://github.com/tidyverse/lubridate/pull/649 +Patch0001: 0001-Fix-system-timezone-memoization.patch + +# Here's the R view of the dependencies world: +# Depends: R-methods +# Imports: R-stringr R-Rcpp +# Suggests: R-testthat R-knitr R-covr +# LinkingTo: +# Enhances: + +Requires: R-methods +Requires: R-stringr +Requires: tzdata +BuildRequires: tzdata +BuildRequires: R-devel tex(latex) R-methods +BuildRequires: R-stringr R-Rcpp-devel +BuildRequires: R-testthat +%if %{with_doc} +BuildRequires: R-knitr +%endif + +%description +Functions to work with date-times and time-spans: fast and user friendly +parsing of date-time data, extraction and updating of components of a +date-time (years, months, days, hours, minutes, and seconds), algebraic +manipulation on date-time and time-span objects. The 'lubridate' package +has a consistent and memorable syntax that makes working with dates easy +and fun. Parts of the 'CCTZ' source code, released under the Apache 2.0 +License, are included in this package. See + for more details. + + +%prep +%setup -q -c -n %{packname} +pushd %{packname} +%patch0001 -p1 +popd + +# Don't need coverage; it's not packaged either. +sed -i 's/, covr//g' %{packname}/DESCRIPTION + + +%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 + +# Used to update sources; don't need to package it. +rm %{buildroot}%{rlibdir}/%{packname}/cctz.sh + + +%check +%if %{with_doc} +%{_bindir}/R CMD check %{packname} +%else +_R_CHECK_FORCE_SUGGESTS_=0 %{_bindir}/R CMD check %{packname} --ignore-vignettes +%endif + + +%files +%dir %{rlibdir}/%{packname} +%doc %{rlibdir}/%{packname}/doc +%doc %{rlibdir}/%{packname}/html +%{rlibdir}/%{packname}/DESCRIPTION +%doc %{rlibdir}/%{packname}/CITATION +%doc %{rlibdir}/%{packname}/NEWS.md +%{rlibdir}/%{packname}/INDEX +%{rlibdir}/%{packname}/NAMESPACE +%{rlibdir}/%{packname}/Meta +%{rlibdir}/%{packname}/R +%{rlibdir}/%{packname}/help +%{rlibdir}/%{packname}/data +%{rlibdir}/%{packname}/libs +%{rlibdir}/%{packname}/pkgdown + + +%changelog +* Sun Mar 04 2018 Elliott Sales de Andrade 1.7.3-1 +- initial package for Fedora diff --git a/README.md b/README.md deleted file mode 100644 index 25e6536..0000000 --- a/README.md +++ /dev/null @@ -1,3 +0,0 @@ -# R-lubridate - -The R-lubridate package \ No newline at end of file diff --git a/sources b/sources new file mode 100644 index 0000000..b1bf806 --- /dev/null +++ b/sources @@ -0,0 +1 @@ +SHA512 (lubridate_1.7.3.tar.gz) = 66d9912ae0fdb61a07acc7ba245918c78a46493f88cc03bf732882908906a30105bc8dd87b59e913488851e1afa66f0d18490647d055202f66f7206320040a87