Skip to content

Commit 355fa85

Browse files
committed
Support manylinux binaries in the solver
I.e. the platform is ok if the package is manylinux and the target is a linux with the same arch.
1 parent 4e0af98 commit 355fa85

3 files changed

Lines changed: 40 additions & 2 deletions

File tree

‎NEWS.md‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,11 @@
66
from a Posit Package Manager `manylinux` repository
77
(https://github.com/r-lib/pak/issues/815).
88

9+
* pkgdepends now accepts binary packages from a Posit Package Manager
10+
`manylinux` repository. pkgcache labels these with a
11+
`*-manylinux-<glibc-version>` platform now, and they are OK for any
12+
requested Linux platform with the same `cpu-vendor-os` triple.
13+
914
* Blank lines in `.Rbuildignore` no longer cause all git submodules of a
1015
package to be skipped, empty lines are now dropped (#480).
1116

‎R/platform.R‎

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,19 @@ platform_is_ok <- function(cand, exp, exp_archs = NULL) {
8585
return(TRUE)
8686
}
8787

88+
# PPM manylinux binaries are generic Linux builds, they are OK for any
89+
# expected Linux platform with the same cpu-vendor-os triple, e.g.
90+
# cand = x86_64-pc-linux-gnu-manylinux-2.28 vs
91+
# exp = x86_64-pc-linux-gnu-ubuntu-24.04
92+
mlx <- re_match(cand, "^(?<triple>.*)-manylinux-[0-9.]+$")
93+
if (
94+
!is.na(mlx$.match) &&
95+
grepl("-linux", mlx$triple) &&
96+
any(startsWith(exp, paste0(mlx$triple, "-")))
97+
) {
98+
return(TRUE)
99+
}
100+
88101
if (cand %in% c("i386+x86_64-w64-mingw32", "x86_64+i386-w64-mingw32")) {
89102
# This is a multi-arch binary, that is OK, if binaries are allowed
90103
any(c("x86_64-w64-mingw32", "i386-w64-mingw32") %in% exp)

‎tests/testthat/test-platforms.R‎

Lines changed: 22 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,17 @@ test_that("platform_is_ok", {
1616
list("i386+x86_64-w64-mingw32", c("i386-w64-mingw32", "source"), NULL),
1717
list("i386+x86_64-w64-mingw32", "x86_64-w64-mingw32", "prefer-x64"),
1818
list("i386+x86_64-w64-mingw32", "i386-w64-mingw32", NULL),
19-
list("x86_64-w64-mingw32", "x86_64-w64-mingw32", "prefer-x64")
19+
list("x86_64-w64-mingw32", "x86_64-w64-mingw32", "prefer-x64"),
20+
list(
21+
"aarch64-unknown-linux-gnu-manylinux-2.28",
22+
c("aarch64-unknown-linux-gnu-ubuntu-24.04", "source"),
23+
NULL
24+
),
25+
list(
26+
"x86_64-pc-linux-musl-manylinux-2.28",
27+
c("x86_64-pc-linux-musl-alpine-3.21.0", "source"),
28+
NULL
29+
)
2030
)
2131
for (c in ok) {
2232
expect_true(platform_is_ok(c[[1]], c[[2]], c[[3]]), info = c)
@@ -28,7 +38,17 @@ test_that("platform_is_ok", {
2838
list("i386-w64-mingw32", "source", "prefer-x64"),
2939
list("x86_64-apple-darwin17.0", "source", NULL),
3040
list("x86_64-w64-mingw32", "x86_64-w64-mingw32", "both"),
31-
list("i386-w64-mingw32", "i386-w64-mingw32", "both")
41+
list("i386-w64-mingw32", "i386-w64-mingw32", "both"),
42+
list(
43+
"x86_64-pc-linux-gnu-manylinux-2.28",
44+
c("aarch64-unknown-linux-gnu-ubuntu-24.04", "source"),
45+
NULL
46+
),
47+
list(
48+
"aarch64-unknown-linux-gnu-manylinux-2.28",
49+
"aarch64-apple-darwin20",
50+
NULL
51+
)
3252
)
3353
for (c in bad) {
3454
expect_false(platform_is_ok(c[[1]], c[[2]], c[[3]]), info = c)

0 commit comments

Comments
 (0)