]> git.pld-linux.org Git - packages/R.git/commitdiff
- added timezone patch (rely on /etc/timezone and not systemd timedatectl to detect...
authorJakub Bogusz <qboosh@pld-linux.org>
Mon, 27 Apr 2020 20:29:23 +0000 (22:29 +0200)
committerJakub Bogusz <qboosh@pld-linux.org>
Mon, 27 Apr 2020 20:29:23 +0000 (22:29 +0200)
R-timezone.patch [new file with mode: 0644]
R.spec

diff --git a/R-timezone.patch b/R-timezone.patch
new file mode 100644 (file)
index 0000000..34f414a
--- /dev/null
@@ -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
diff --git a/R.spec b/R.spec
index 605831e608753730aa7cb069e25935e0ac92078a..eecea77737c9b2b3effc5cc2d021c6fc24aa775e 100644 (file)
--- 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
This page took 0.108611 seconds and 4 git commands to generate.