Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Solver fails with Config/Needs/... indirect dependency configuration #351

Open
pawelru opened this issue Jan 4, 2024 · 2 comments
Open

Comments

@pawelru
Copy link
Contributor

pawelru commented Jan 4, 2024

library(pkgdepends)

deps_1 <- c("config/needs/foo", pkg_dep_types_hard())
deps_2 <- list(
    direct = c("config/needs/foo", pkg_dep_types_hard()),
    indirect = pkg_dep_types()
)
deps_3 <- list(
    direct = c("config/needs/foo", pkg_dep_types_hard()),
    indirect = c("config/needs/bar", pkg_dep_types()) # <- here!
)

foo <- function(deps) {
    ip <- new_pkg_installation_proposal("r-lib/rlang", config = list(dependencies = deps))
    ip$solve()
    ip$get_solution()
}

foo(deps_1) # OK
#> ℹ Loading metadata database
#> ✔ Loading metadata database ... done
#> 
#> <pkg_solution>
#> + result: OK
#> + refs:
#>   - r-lib/rlang
#> + constraints (2):
#>   - select rlang exactly once
#>   - `r-lib/rlang` is not satisfied by `installed::/Users/ruckip/Library/R/arm64/4.3/library/rlang`
#> + solution:
#>   - r-lib/rlang
foo(deps_2) # OK
#> <pkg_solution>
#> + result: OK
#> + refs:
#>   - r-lib/rlang
#> + constraints (27915):
#>   - `rnaturalearthhires` resolution failed
#>   - `starsdata` resolution failed
#>   - `cmdstanr` resolution failed
#>   - `glmmADMB` resolution failed
#>   - `ffbase` resolution failed
#>   - `spDataLarge` resolution failed
#>   - `mnlogit` resolution failed
#>   - `Zelig` resolution failed
#>   - `ergm.userterms` resolution failed
#>   - `corpus.useR.2008.abstracts` resolution failed
#>   ...
#> + solution:
#>   - r-lib/rlang
foo(deps_3) # FAIL
#> Error in value$ref %in% private$state$ref && !value$direct: 'length = 18' in coercion to 'logical(1)'

Created on 2024-01-04 with reprex v2.0.2

@gaborcsardi
Copy link
Member

config/needs/... is not allowed in the indirect dependencies, because we don't have that field in CRAN-like repos. config/needs/... is mainly for local packages, but it happens to work for git/github/url packages as well.

@pawelru
Copy link
Contributor Author

pawelru commented Jan 5, 2024

Thanks for giving some explanation. Even though custom fields are not supported for CRAN-like repos, my use case is GitHub so it would be great to have it working. If it's truly forbidden then I would expect that it will be caught earlier (possibly pkgdepends::as_pkg_dependencies()) as opposed to length coercion error.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants