diff options
author | Jakub Bogusz | 2020-04-27 20:29:23 (GMT) |
---|---|---|
committer | Jakub Bogusz | 2020-04-27 20:29:23 (GMT) |
commit | 61a870cbff91d9dece7e95255d90932265e8bdf0 (patch) | |
tree | a25334e7e5fa39d88090a38d2bef1764f3a27880 | |
parent | 32b874d0a22eec4f7961957e9b7316b196cba5b0 (diff) | |
download | R-61a870cbff91d9dece7e95255d90932265e8bdf0.zip R-61a870cbff91d9dece7e95255d90932265e8bdf0.tar.gz |
- added timezone patch (rely on /etc/timezone and not systemd timedatectl to detect system timezone)
-rw-r--r-- | R-timezone.patch | 65 | ||||
-rw-r--r-- | R.spec | 2 |
2 files changed, 67 insertions, 0 deletions
diff --git a/R-timezone.patch b/R-timezone.patch new file mode 100644 index 0000000..34f414a --- /dev/null +++ b/R-timezone.patch @@ -0,0 +1,65 @@ +--- R-3.6.3/src/library/base/R/datetime.R.orig 2019-03-29 00:02:16.000000000 +0100 ++++ R-3.6.3/src/library/base/R/datetime.R 2020-04-26 21:37:03.276695328 +0200 +@@ -70,62 +70,6 @@ + } else tzdir <- "" + } + +- ## First try timedatectl: should work on any modern Linux +- ## as part of systemd (and probably nowhere else) +- if (nzchar(Sys.which("timedatectl"))) { +- inf <- system("timedatectl", intern = TRUE) +- ## typical format: +- ## " Time zone: Europe/London (GMT, +0000)" +- ## " Time zone: Europe/Vienna (CET, +0100)" +- lines <- grep("Time zone: ", inf) +- if (length(lines)) { +- tz <- sub(" .*", "", sub(" *Time zone: ", "", inf[lines[1L]])) +- ## quick sanity check +- if(nzchar(tzdir)) { +- if(file.exists(file.path(tzdir, tz))) { +- cacheIt(tz) +- return(tz) +- } else +- warning(sprintf("%s indicates the non-existent timezone name %s", +- sQuote("timedatectl"), sQuote(tz)), +- call. = FALSE, immediate. = TRUE, domain = NA) +- } else { +- cacheIt(tz) +- return(tz) +- } +- } +- } +- +- ## Debian/Ubuntu Linux do things differently, so try that next. +- ## Derived loosely from PR#17186 +- ## As the Java sources say +- ## +- ## 'There's no spec of the file format available. This parsing +- ## assumes that there's one line of an Olson tzid followed by a +- ## '\n', no leading or trailing spaces, no comments.' +- ## +- ## but we do trim whitespace and do a sanity check (Java does not) +- if (grepl("linux", R.Version()$platform, ignore.case = TRUE) && +- file.exists("/etc/timezone")) { +- tz0 <- try(readLines("/etc/timezone")) +- if(!inherits(tz0, "try-error") && length(tz0) == 1L) { +- tz <- trimws(tz0) +- ## quick sanity check +- if(nzchar(tzdir)) { +- if(file.exists(file.path(tzdir, tz))) { +- cacheIt(tz) +- return(tz) +- } else +- warning(sprintf("%s indicates the non-existent timezone name %s", +- sQuote("/etc/timezone"), sQuote(tz)), +- call. = FALSE, immediate. = TRUE, domain = NA) +- } else { +- cacheIt(tz) +- return(tz) +- } +- } +- } +- + ## non-Debian Linux (if not covered above), macOS, *BSD, ... + ## According to the glibc's (at least 2.26) + ## manual/time.texi, it can be configured to use @@ -23,6 +23,7 @@ Source0: ftp://stat.ethz.ch/R-CRAN/src/base/R-3/%{name}-%{version}.tar.gz # Source0-md5: 506c9576ba33e1262ad5b5624db9d96a Source1: %{name}.desktop Source2: %{name}.xpm +Patch0: %{name}-timezone.patch URL: http://www.r-project.org/ # yes, it is, or tests will fail BuildRequires: /etc/localtime @@ -118,6 +119,7 @@ Narzędzia R w Javie. %prep %setup -q +%patch0 -p1 %build %{__aclocal} -I m4 |