r-lib / pak

A fresh approach to package installation
https://pak.r-lib.org
671 stars 60 forks source link

Add support for Alpine Linux #685

Closed pat-s closed 2 weeks ago

pat-s commented 3 weeks ago

I've been using this for several weeks now without issues.

Happy to port this to the {pkgdepends} repo if it gets approved.

POC

docker run --rm -it alpine sh

apk add -q R R-dev linux-headers g++
R -q -e 'install.packages("remotes", repos = "cloud.r-project.org")'
R -q -e 'remotes::install_github("pat-s/pak@alpine")'

R -q -e 'pak::pak("xml2")'

✔ Updated metadata database: 2.96 MB in 8 files.
✔ Updating metadata database ... done

→ Will install 3 packages.
→ Will download 3 CRAN packages (1.63 MB).
+ cli     3.6.3 [bld][cmp][dl] (569.77 kB)
+ rlang   1.1.4 [bld][cmp][dl] (763.76 kB)
+ xml2    1.3.6 [bld][cmp][dl] (294.71 kB) + ✖ libxml2-dev
→ Will install 1 system package:
+ libxml2-dev  - xml2
ℹ Getting 3 pkgs (1.63 MB)
✔ Got xml2 1.3.6 (source) (294.71 kB)
✔ Got cli 3.6.3 (source) (568.16 kB)
✔ Got rlang 1.1.4 (source) (767.04 kB)
ℹ Installing system requirements
ℹ Executing `sh -c apk add --no-cache libxml2-dev`
ℹ Building cli 3.6.3
ℹ Building rlang 1.1.4
✔ Built cli 3.6.3 (4.3s)
✔ Installed cli 3.6.3  (32ms)
✔ Built rlang 1.1.4 (5.8s)
✔ Installed rlang 1.1.4  (38ms)
ℹ Building xml2 1.3.6
✔ Built xml2 1.3.6 (3.1s)
✔ Installed xml2 1.3.6  (22ms)
✔ 1 pkg + 2 deps: added 3, dld 3 (1.63 MB) [13.6s]
gaborcsardi commented 3 weeks ago

Thanks! However, this belongs to pkgdepends, and needs a PR there. The embedded pkgdepends in pak can then be updated. Do you want to move it to pkgdepends? No problem if not, I can move it as well.

pat-s commented 2 weeks ago

Just saw you ported the JSON updates in pkgdepends recently, thanks.

I'll close this then, all that's left is to make the small change in R/system-requirements.R in {pak}?

pat-s commented 2 weeks ago

Ah, a bit more. Will do a PR.

gaborcsardi commented 2 weeks ago

Just saw you ported the JSON updates in pkgdepends recently, thanks.

https://github.com/rstudio/r-system-requirements has had Alpine support for a while. It is just not used by pak/pkgdepends. I just updated the the sysreqs db that embedded into pkgdepends, essentially the rules directory of that repo.

gaborcsardi commented 2 weeks ago

R/system-requirements.R is the old sysreqs implementation, it is not going to change any more. Only the table in sysreqs2.R needs to be updated, I think.