[packages/R] - added timezone patch (rely on /etc/timezone and not systemd timedatectl to detect system timezone)
qboosh
qboosh at pld-linux.org
Mon Apr 27 22:29:08 CEST 2020
commit 61a870cbff91d9dece7e95255d90932265e8bdf0
Author: Jakub Bogusz <qboosh at pld-linux.org>
Date: Mon Apr 27 22:29:23 2020 +0200
- added timezone patch (rely on /etc/timezone and not systemd timedatectl to detect system timezone)
R-timezone.patch | 65 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++
R.spec | 2 ++
2 files changed, 67 insertions(+)
---
diff --git a/R.spec b/R.spec
index 605831e..eecea77 100644
--- a/R.spec
+++ b/R.spec
@@ -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
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
================================================================
---- gitweb:
http://git.pld-linux.org/gitweb.cgi/packages/R.git/commitdiff/61a870cbff91d9dece7e95255d90932265e8bdf0
More information about the pld-cvs-commit
mailing list