From 56a9222ffc2609d0674a1588936130c426f3bd2b Mon Sep 17 00:00:00 2001 From: Michael Chirico Date: Mon, 6 Jan 2025 11:05:54 +0800 Subject: [PATCH 1/9] Initial attempt at alpine image --- .devcontainer/r-devel-alpine/Dockerfile | 18 ++++++++++++++++++ .devcontainer/r-devel-alpine/devcontainer.json | 0 2 files changed, 18 insertions(+) create mode 100644 .devcontainer/r-devel-alpine/Dockerfile create mode 100644 .devcontainer/r-devel-alpine/devcontainer.json diff --git a/.devcontainer/r-devel-alpine/Dockerfile b/.devcontainer/r-devel-alpine/Dockerfile new file mode 100644 index 0000000000..91ed491441 --- /dev/null +++ b/.devcontainer/r-devel-alpine/Dockerfile @@ -0,0 +1,18 @@ +FROM docker.io/rhub/r-minimal:devel + +RUN apk update \ + && apk add --no-cache git + +COPY DESCRIPTION . + +RUN Rscript -e ' \ +read.dcf("DESCRIPTION", c("Imports", "Suggests")) |> \ + tools:::.split_dependencies() |> \ + names() |> \ + setdiff(tools:::.get_standard_package_names()$base) |> \ + install.packages() \ +' + +# setup cc() +WORKDIR /root +COPY .devcontainer/.Rprofile . diff --git a/.devcontainer/r-devel-alpine/devcontainer.json b/.devcontainer/r-devel-alpine/devcontainer.json new file mode 100644 index 0000000000..e69de29bb2 From 7b9329d5ea74fb6fbd2eb56bd28b8eab29257f90 Mon Sep 17 00:00:00 2001 From: Michael Chirico Date: Mon, 6 Jan 2025 13:12:22 +0800 Subject: [PATCH 2/9] need devcontainer.json --- .devcontainer/r-devel-alpine/devcontainer.json | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/.devcontainer/r-devel-alpine/devcontainer.json b/.devcontainer/r-devel-alpine/devcontainer.json index e69de29bb2..da60569c93 100644 --- a/.devcontainer/r-devel-alpine/devcontainer.json +++ b/.devcontainer/r-devel-alpine/devcontainer.json @@ -0,0 +1,10 @@ +{ + "build": { "dockerfile": "Dockerfile", "context": "../.." }, + "customizations": { "vscode": { + "extensions": [ + "REditorSupport.r", + "ms-vscode.cpptools-extension-pack" + ] + }} + } + \ No newline at end of file From 5040eb0eb3493fd3af35cc35c5ceb356c43e2cc8 Mon Sep 17 00:00:00 2001 From: Michael Chirico Date: Mon, 6 Jan 2025 13:25:52 +0800 Subject: [PATCH 3/9] Specify repos --- .devcontainer/r-devel-alpine/Dockerfile | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/.devcontainer/r-devel-alpine/Dockerfile b/.devcontainer/r-devel-alpine/Dockerfile index 91ed491441..2c0c266a52 100644 --- a/.devcontainer/r-devel-alpine/Dockerfile +++ b/.devcontainer/r-devel-alpine/Dockerfile @@ -1,7 +1,8 @@ FROM docker.io/rhub/r-minimal:devel RUN apk update \ - && apk add --no-cache git + && apk add --no-cache git \ + && echo 'options("repos"="https://cloud.r-project.org")' >> /usr/local/lib/R/etc/Rprofile.site COPY DESCRIPTION . @@ -10,7 +11,7 @@ read.dcf("DESCRIPTION", c("Imports", "Suggests")) |> \ tools:::.split_dependencies() |> \ names() |> \ setdiff(tools:::.get_standard_package_names()$base) |> \ - install.packages() \ + install.packages(repos="https://cloud.r-project.org") \ ' # setup cc() From a154fb1705b65fbf84e9212a85d4749d9be01989 Mon Sep 17 00:00:00 2001 From: Michael Chirico Date: Mon, 6 Jan 2025 14:14:41 +0800 Subject: [PATCH 4/9] Extra libs required for installation --- .devcontainer/r-devel-alpine/Dockerfile | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.devcontainer/r-devel-alpine/Dockerfile b/.devcontainer/r-devel-alpine/Dockerfile index 2c0c266a52..8582ce8c69 100644 --- a/.devcontainer/r-devel-alpine/Dockerfile +++ b/.devcontainer/r-devel-alpine/Dockerfile @@ -1,7 +1,8 @@ FROM docker.io/rhub/r-minimal:devel RUN apk update \ - && apk add --no-cache git \ + && apk add --no-cache \ + gcc git musl-dev openmp pkgconf zlib-dev \ && echo 'options("repos"="https://cloud.r-project.org")' >> /usr/local/lib/R/etc/Rprofile.site COPY DESCRIPTION . From 8d98d783b43a29650f0abbb914fc30db9e63932e Mon Sep 17 00:00:00 2001 From: Michael Chirico Date: Mon, 6 Jan 2025 06:15:04 +0000 Subject: [PATCH 5/9] Adapt 'config' to also work on alpine --- configure | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/configure b/configure index 2402ecef1f..8e450c10b8 100755 --- a/configure +++ b/configure @@ -34,15 +34,11 @@ else NOZLIB=0 lib=`pkg-config --libs zlib` cflag=`pkg-config --cflags zlib` - expr -- "$lib" : ".*-lz$" >> config.log # -- for FreeBSD, #4652 + echo "$lib" | grep -qE '[-]lz($| )' >> config.log if [ $? -ne 0 ]; then - expr -- "$lib" : ".*-lz " >> config.log - # would use \b in one expr but MacOS does not support \b - if [ $? -ne 0 ]; then - echo "*** pkg-config is installed and 'pkg-config --exists zlib' succeeds but" - echo "*** 'pkg-config --libs zlib' returns '${lib}' which does not include the standard -lz." - msg=1 - fi + echo "*** pkg-config is installed and 'pkg-config --exists zlib' succeeds but" + echo "*** 'pkg-config --libs zlib' returns '${lib}' which does not include the standard -lz." + msg=1 fi fi fi From 22abde02b753d2b74282634aa9503c7d4b5b5e2b Mon Sep 17 00:00:00 2001 From: Michael Chirico Date: Mon, 6 Jan 2025 06:30:04 +0000 Subject: [PATCH 6/9] TZDIR is also necessary --- .devcontainer/r-devel-alpine/Dockerfile | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.devcontainer/r-devel-alpine/Dockerfile b/.devcontainer/r-devel-alpine/Dockerfile index 8582ce8c69..39194563d3 100644 --- a/.devcontainer/r-devel-alpine/Dockerfile +++ b/.devcontainer/r-devel-alpine/Dockerfile @@ -2,9 +2,11 @@ FROM docker.io/rhub/r-minimal:devel RUN apk update \ && apk add --no-cache \ - gcc git musl-dev openmp pkgconf zlib-dev \ + gcc git musl-dev openmp pkgconf tzdata zlib-dev \ && echo 'options("repos"="https://cloud.r-project.org")' >> /usr/local/lib/R/etc/Rprofile.site +ENV TZDIR=/usr/share/zoneinfo + COPY DESCRIPTION . RUN Rscript -e ' \ From 481f1113be768b0f87ad82b704fdb63b5512d47a Mon Sep 17 00:00:00 2001 From: Michael Chirico Date: Mon, 6 Jan 2025 06:32:47 +0000 Subject: [PATCH 7/9] json ws --- .devcontainer/r-devel-alpine/devcontainer.json | 1 - 1 file changed, 1 deletion(-) diff --git a/.devcontainer/r-devel-alpine/devcontainer.json b/.devcontainer/r-devel-alpine/devcontainer.json index da60569c93..74c039fb7a 100644 --- a/.devcontainer/r-devel-alpine/devcontainer.json +++ b/.devcontainer/r-devel-alpine/devcontainer.json @@ -7,4 +7,3 @@ ] }} } - \ No newline at end of file From 2198f597cadacff1c02228800c27866965e1c2a5 Mon Sep 17 00:00:00 2001 From: Michael Chirico Date: Mon, 6 Jan 2025 09:00:39 +0000 Subject: [PATCH 8/9] Disable 1590.05, re-enable 1590.06 --- inst/tests/tests.Rraw | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/inst/tests/tests.Rraw b/inst/tests/tests.Rraw index a86e7a8a63..2d46b7e5f5 100644 --- a/inst/tests/tests.Rraw +++ b/inst/tests/tests.Rraw @@ -8448,11 +8448,8 @@ baseR = base::order(c(x2,x1,x1,x2)) # are so relaxed now that they barely testing anything. It appears base R behaviour is undefined in this rare case of identical strings in different encodings. test(1590.04, identical(baseR, INT(1,4,2,3)) || identical(baseR, INT(2,3,1,4)) || identical(baseR, 1:4)) Encoding(x2) = "unknown" -# TODO(#6350): Decide if this test should be adjusted for Alpine Linux, or just dropped. -if (!file.exists("/etc/alpine-release")) { - test(1590.05, x1!=x2) - test(1590.06, forderv( c(x2,x1,x1,x2)), INT(1,4,2,3)) # consistent with Windows-1252 result, tested further below -} +# test(1590.05, x1!=x2) # Skip this test of R's own behavior since R itself does not give platform-consistent results, #6350 +test(1590.06, forderv( c(x2,x1,x1,x2)), INT(1,4,2,3)) # consistent with Windows-1252 result, tested further below baseR = base::order(c(x2,x1,x1,x2)) test(1590.07, identical(baseR, INT(1,4,2,3)) || identical(baseR, INT(2,3,1,4)) || identical(baseR, 1:4)) Sys.setlocale("LC_CTYPE", ctype) From 8c20925c287c4179c24ccb2e9b43bb683a799637 Mon Sep 17 00:00:00 2001 From: Michael Chirico Date: Mon, 6 Jan 2025 01:06:34 -0800 Subject: [PATCH 9/9] Disable test again, to be explored later --- inst/tests/tests.Rraw | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/inst/tests/tests.Rraw b/inst/tests/tests.Rraw index 2d46b7e5f5..724c6f1630 100644 --- a/inst/tests/tests.Rraw +++ b/inst/tests/tests.Rraw @@ -8449,7 +8449,8 @@ baseR = base::order(c(x2,x1,x1,x2)) test(1590.04, identical(baseR, INT(1,4,2,3)) || identical(baseR, INT(2,3,1,4)) || identical(baseR, 1:4)) Encoding(x2) = "unknown" # test(1590.05, x1!=x2) # Skip this test of R's own behavior since R itself does not give platform-consistent results, #6350 -test(1590.06, forderv( c(x2,x1,x1,x2)), INT(1,4,2,3)) # consistent with Windows-1252 result, tested further below +# TODO(#6350): Restore this test. On Alpine, forder() finds this input to be sorted, but we want to be platform-independent. +if (!file.exists("/etc/alpine-release")) test(1590.06, forderv( c(x2,x1,x1,x2)), INT(1,4,2,3)) # consistent with Windows-1252 result, tested further below baseR = base::order(c(x2,x1,x1,x2)) test(1590.07, identical(baseR, INT(1,4,2,3)) || identical(baseR, INT(2,3,1,4)) || identical(baseR, 1:4)) Sys.setlocale("LC_CTYPE", ctype)