Skip to content

Commit ebbf128

Browse files
Add a devcontainer on alpine (#6710)
* Initial attempt at alpine image * need devcontainer.json * Specify repos * Extra libs required for installation * Adapt 'config' to also work on alpine * TZDIR is also necessary * json ws * Disable 1590.05, re-enable 1590.06 * Disable test again, to be explored later
1 parent 99919f6 commit ebbf128

File tree

4 files changed

+38
-13
lines changed

4 files changed

+38
-13
lines changed
+22
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
FROM docker.io/rhub/r-minimal:devel
2+
3+
RUN apk update \
4+
&& apk add --no-cache \
5+
gcc git musl-dev openmp pkgconf tzdata zlib-dev \
6+
&& echo 'options("repos"="https://cloud.r-project.org")' >> /usr/local/lib/R/etc/Rprofile.site
7+
8+
ENV TZDIR=/usr/share/zoneinfo
9+
10+
COPY DESCRIPTION .
11+
12+
RUN Rscript -e ' \
13+
read.dcf("DESCRIPTION", c("Imports", "Suggests")) |> \
14+
tools:::.split_dependencies() |> \
15+
names() |> \
16+
setdiff(tools:::.get_standard_package_names()$base) |> \
17+
install.packages(repos="https://cloud.r-project.org") \
18+
'
19+
20+
# setup cc()
21+
WORKDIR /root
22+
COPY .devcontainer/.Rprofile .
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
{
2+
"build": { "dockerfile": "Dockerfile", "context": "../.." },
3+
"customizations": { "vscode": {
4+
"extensions": [
5+
"REditorSupport.r",
6+
"ms-vscode.cpptools-extension-pack"
7+
]
8+
}}
9+
}

configure

+4-8
Original file line numberDiff line numberDiff line change
@@ -34,15 +34,11 @@ else
3434
NOZLIB=0
3535
lib=`pkg-config --libs zlib`
3636
cflag=`pkg-config --cflags zlib`
37-
expr -- "$lib" : ".*-lz$" >> config.log # -- for FreeBSD, #4652
37+
echo "$lib" | grep -qE '[-]lz($| )' >> config.log
3838
if [ $? -ne 0 ]; then
39-
expr -- "$lib" : ".*-lz " >> config.log
40-
# would use \b in one expr but MacOS does not support \b
41-
if [ $? -ne 0 ]; then
42-
echo "*** pkg-config is installed and 'pkg-config --exists zlib' succeeds but"
43-
echo "*** 'pkg-config --libs zlib' returns '${lib}' which does not include the standard -lz."
44-
msg=1
45-
fi
39+
echo "*** pkg-config is installed and 'pkg-config --exists zlib' succeeds but"
40+
echo "*** 'pkg-config --libs zlib' returns '${lib}' which does not include the standard -lz."
41+
msg=1
4642
fi
4743
fi
4844
fi

inst/tests/tests.Rraw

+3-5
Original file line numberDiff line numberDiff line change
@@ -8448,11 +8448,9 @@ baseR = base::order(c(x2,x1,x1,x2))
84488448
# 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.
84498449
test(1590.04, identical(baseR, INT(1,4,2,3)) || identical(baseR, INT(2,3,1,4)) || identical(baseR, 1:4))
84508450
Encoding(x2) = "unknown"
8451-
# TODO(#6350): Decide if this test should be adjusted for Alpine Linux, or just dropped.
8452-
if (!file.exists("/etc/alpine-release")) {
8453-
test(1590.05, x1!=x2)
8454-
test(1590.06, forderv( c(x2,x1,x1,x2)), INT(1,4,2,3)) # consistent with Windows-1252 result, tested further below
8455-
}
8451+
# test(1590.05, x1!=x2) # Skip this test of R's own behavior since R itself does not give platform-consistent results, #6350
8452+
# TODO(#6350): Restore this test. On Alpine, forder() finds this input to be sorted, but we want to be platform-independent.
8453+
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
84568454
baseR = base::order(c(x2,x1,x1,x2))
84578455
test(1590.07, identical(baseR, INT(1,4,2,3)) || identical(baseR, INT(2,3,1,4)) || identical(baseR, 1:4))
84588456
Sys.setlocale("LC_CTYPE", ctype)

0 commit comments

Comments
 (0)