Open mrustl opened 4 years ago
Didn`t remember but more or less solved in R package "pkgmeta": https://github.com/KWB-R/pkgmeta/blob/master/vignettes/analyse-rpackages.Rmd
(slightly modified)
remotes::install_github("kwb-r/pkgmeta")
pkgs <- pkgmeta::get_github_packages()
session_metadata <- sessionInfo()
session_metadata
paths_list <- list(
linux_lib_dir = "/usr/lib/R/site-library",
win_lib_dir = "<root_dir>/kwbran/<r_version>",
)
paths <- kwb.utils::resolve(paths_list, root_dir = "//servername", r_version = "4.0"))
## Install Packages
fs::dir_create(paths$win_dir, recursive = TRUE)
withr::with_libpaths(new = paths$win_lib_dir, {
install.packages("remotes", repos = "https://cran.rstudio.org") }
)
for(pkg in pkgs$name) {
withr::with_libpaths(new = paths$pkglib, {
code = remotes::install_github(repo = sprintf("kwb-r/%s", pkg),
dependencies = TRUE,
upgrade = "always",
auth_token = Sys.getenv("GITHUB_PAT"))})
}
@ItAtKwb I now implemented a new function in kwb.package whith you could try out:
### install package dependencies
remotes::install_github("kwb-r/kwb.utils")
remotes::install_github("kwb-r/kwb.package@dev",
dependencies = TRUE,
upgrade = "always")
### define paths
paths_list <- list(
r_version = kwb.packages::get_r_version_majorminor(),
lib_linux = "/usr/lib/R/site-library",
lib_win = "<win_root_dir>/kwbran/<r_version>"
)
paths <- kwb.utils::resolve(paths_list,
win_root_dir = fs::path(tempdir()))
### get KWB-R package infos
pkgs <- pkgmeta::get_github_packages()
# install in windows lib
install_kwb_github_packages(lib = paths$lib_win, pkgs$full_name)
# install in linux lib
install_kwb_github_packages(lib = paths$lib_linux, pkgs$full_name)
The solution for our public
R packages may be our brand new CRAN like kwb-r
universe repo:
https://kwb-r.r-universe.dev
@ItAtKwb could you modify rstudio-prefs.json
for all KWB computers by adding:
"secondary": "kwbr|https://kwb-r.r-universe.dev"
to the cran_mirror
settings as shown below?
Below location C:\Users\<user>\AppData\Roaming\RStudio\rstudio-prefs.json
and structure of my config:
{
"default_project_location": "~/RProjects",
"windows_terminal_shell": "win-git-bash",
"jobs_tab_visibility": "shown",
"default_encoding": "UTF-8",
"save_workspace": "never",
"load_workspace": false,
"document_author": "Michael Rustler",
"initial_working_directory": "~",
"cran_mirror": {
"name": "Global (CDN)",
"host": "RStudio",
"url": "https://cran.rstudio.com/",
"repos": "",
"country": "us",
"secondary": "kwbr|https://kwb-r.r-universe.dev"
}
}
After phone call with @ItAtKwb today morning we defined to modify Rprofile.site
(because of problems to modify rstudio-prefs.json
and because this solution is independent of Rstudio
) on:
/opt/R/<r-version>/lib/R/etc/Rprofile.site
(done by @ItAtKwb on 2021-07-09 11:45)C:/Program Files/R/<r-version>/etc/Rprofile.site
(test case on @mrustl computer planned for 2021-07-12, if successful rollout via R 4.1.0 updates by @ItAtKwb)Content of Rprofile.site
is set as follows:
## We set the cloud mirror, which is 'network-close' to everybody, as default
local({
options(repos = c(kwbr = "https://kwb-r.r-universe.dev", CRAN = "https://cloud.r-project.org"))
})
Afterwards we can simply install and update our public R packages (available on https://kwb-r.r-universe.dev):
Takeaways after discussing with @ItAtKwb for 2 hours what can be improved after the flusshygiene cron-job crash after updating KWB`s linux server to R 4.0.1 and realizing the messy R library installation workflow (2 cron job, one by @ItAtKwb and @wseis use different R libraries !!!) we ended up with some centralisation approach, which will not rule out all further issues but may be harmonize the "general" deployment at KWB of R packages.
The idea is that we provide an R script that can be used by @ItAtKwb to run a daily cron job on Linux/Windows servers so that:
always contain the latest version of R packages (always) on the "master" branch precompiled for both "linux" and "windows" and the latest KWB R release (currently: 4.01). For Windows @ItAtKwb proposed to adapt the .libPaths() variable .Renvironment file (could be "rolled" out by Marcus.
@hsonne what do you think????
Below a first incomplete and buggy first version how this could look like:
For linux the known system dependencies for package installation are described here: https://github.com/KWB-R/pkgmeta/blob/master/.travis.yml#L9