Skip to content

Commit f593391

Browse files
Merge pull request #539 from lorenzwalthert/dev-hook-dependency-update-fix
Fix hook dependency updates [ci skip]
2 parents 3d3cdcf + 7fd4178 commit f593391

File tree

6 files changed

+11
-24
lines changed

6 files changed

+11
-24
lines changed

.github/workflows/hook-dependencies-update.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,8 @@ jobs:
3333
Rscript -e "install.packages('remotes'); remotes::install_github('r-hub/sysreqs')"
3434
sysreqs=$(Rscript -e "cat(sysreqs::sysreq_commands('DESCRIPTION'))")
3535
sudo -s eval "$sysreqs"
36-
- name: install renv
37-
run: Rscript -e "install.packages('renv')"
36+
- name: install runtime dependencies
37+
run: Rscript -e "install.packages(c('renv', 'jsonlite'))"
3838
- name: update PPM URL
3939
run: Rscript inst/update-ppm-url.R
4040
- name: update dependency graph among packages

.pre-commit-config.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ repos:
8383
(?x)^(
8484
inst/hooks/exported/pkgdown.R|
8585
tests/testthat/in/.*|
86-
inst/renv-update\.R|
86+
inst/update-renv-prepare.R|
8787
inst/update-ppm-url.R|
8888
inst/update-dependency-graph-existing-packages\.R|
8989
inst/update-existing-hook-dependencies\.R|
Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
source("renv/activate.R")
2-
31
hook_deps <- function(root) {
42
out <- renv::dependencies("inst/hooks/exported/")$Package
53
desc <- desc::desc()
@@ -14,14 +12,9 @@ hook_deps <- function(root) {
1412
out <- names(renv:::renv_package_dependencies(out))
1513
return(sort(out))
1614
}
17-
options(
18-
# repos = c(
19-
# RSPM = "https://packagemanager.rstudio.com/all/latest",
20-
# CRAN = "https://cran.rstudio.com"
21-
# ),
22-
install.packages.compile.from.source = "never"
23-
)
2415

16+
source("inst/update-renv-prepare.R")
17+
source("renv/activate.R")
2518
options(renv.snapshot.filter = hook_deps)
2619

2720
renv::snapshot(type = "custom", prompt = FALSE)

inst/update-existing-hook-dependencies.R

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,6 @@
1-
source("renv/activate.R")
2-
3-
options(
4-
repos = c(RSPM = renv::lockfile_read()$R$Repositories$RSPM), # CRAN is not an option, always use PPM
5-
install.packages.check.source = "no", # don't check if source packages are available
6-
install.packages.compile.from.source = "never" # probably redundant with the above 'no': If source package is available, only use source if no code needs to be compiled (needs compilation flag on CRAN).
7-
)
8-
renv::install("jsonlite")
1+
source("inst/update-renv-prepare.R")
92
renv_deps <- names(jsonlite::read_json("renv.lock")$Packages)
3+
source("renv/activate.R")
104
renv::load()
115
renv::restore(prompt = FALSE)
126
can_be_updated <- renv::update(setdiff(renv_deps, "renv"), prompt = FALSE, check = FALSE)

inst/update-renv-prepare.R

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
options(
2+
install.packages.check.source = "no", # don't check if source packages are available
3+
install.packages.compile.from.source = "never" # probably redundant with the above 'no': If source package is available, only use source if no code needs to be compiled (needs compilation flag on CRAN).
4+
)

renv.lock

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,6 @@
55
{
66
"Name": "RSPM",
77
"URL": "https://packagemanager.posit.co/cran/2023-11-17"
8-
},
9-
{
10-
"Name": "CRAN",
11-
"URL": "https://cran.rstudio.com"
128
}
139
]
1410
},

0 commit comments

Comments
 (0)