pkgr icon indicating copy to clipboard operation
pkgr copied to clipboard

Package customizations overwrite Repo customizations in an obscure way

Open Dreznel opened this issue 4 years ago • 2 comments

Found while creating a test for Tilde-expansion.

Both repos in this pkgr.yml contain source only:

Version: 1
# top level packages

Tarballs:
  - "~/go/src/github.com/metrumresearchgroup/pkgr/localrepos/tarballs/R6_2.4.0.tar.gz"

Packages:
  - pillar
  - crayon

# any repositories, order matters
Repos:
  - CRAN_No_R6: "~/go/src/github.com/metrumresearchgroup/pkgr/localrepos/simple-no-R6"
  - CRAN_Simple: "~/go/src/github.com/metrumresearchgroup/pkgr/localrepos/simple"

Cache: "~/go/src/github.com/metrumresearchgroup/pkgr/integration_tests/expand-tilda/localcache"

Library: "~/go/src/github.com/metrumresearchgroup/pkgr/integration_tests/expand-tilda/test-library"

Rollback: false

Customizations:
  Repos:
    - CRAN_No_R6:
        Type: source
    - CRAN_Simple:
        Type: source
  Packages:
    - crayon:
        Repo: CRAN_Simple

Output:

johncarlos: ~/go/src/github.com/metrumresearchgroup/pkgr/integration_tests/tilde-expansion$: pkgr plan
INFO[0000] Installation would launch 12 workers         
INFO[0000] R Version 3.6.0                              
INFO[0000] Package Library will be created               path="~/go/src/github.com/metrumresearchgroup/pkgr/integration_tests/expand-tilda/test-library"
INFO[0000] Default package installation type:  binary   
INFO[0000] 0:7 (binary:source) packages available in for CRAN_No_R6 from ~/go/src/github.com/metrumresearchgroup/pkgr/localrepos/simple-no-R6 
INFO[0000] 0:8 (binary:source) packages available in for CRAN_Simple from ~/go/src/github.com/metrumresearchgroup/pkgr/localrepos/simple 
ERRO[0000] missing packages:  [crayon]                  
WARN[0000] did you mean one of:  [crayon]               

If I modify the customizations to include a "Type" specification for crayon:

Customizations:
  Repos:
    - CRAN_No_R6:
        Type: source
    - CRAN_Simple:
        Type: source
  Packages:
    - crayon:
        Repo: CRAN_Simple
        Type: source

Then suddenly it works:

johncarlos: ~/go/src/github.com/metrumresearchgroup/pkgr/integration_tests/tilde-expansion$: pkgr plan
INFO[0000] Installation would launch 12 workers         
INFO[0000] R Version 3.6.0                              
INFO[0000] Package Library will be created               path="~/go/src/github.com/metrumresearchgroup/pkgr/integration_tests/expand-tilda/test-library"
INFO[0000] Default package installation type:  binary   
INFO[0000] 0:7 (binary:source) packages available in for CRAN_No_R6 from ~/go/src/github.com/metrumresearchgroup/pkgr/localrepos/simple-no-R6 
INFO[0000] 0:8 (binary:source) packages available in for CRAN_Simple from ~/go/src/github.com/metrumresearchgroup/pkgr/localrepos/simple 
INFO[0000] package installation status                   installed=0 not_from_pkgr=0 outdated=0 total_packages_required=7
INFO[0000] package installation sources                  CRAN_No_R6=6 CRAN_Simple=1
INFO[0000] package installation plan                     to_install=7 to_update=0
INFO[0000] resolution time 858.756µs   

This indicates that, when a customization is set for a package, unspecified values are set to their overall pkgr defaults rather than deferring to the values set in other customizations. This is unintuitive.

Dreznel avatar Mar 17 '20 13:03 Dreznel

This isn't "unintuitive" per say - its a bug!

It should be pkg --> repo --> defaults for each setting

dpastoor avatar Mar 17 '20 14:03 dpastoor

we might just need to do a cascading apply for each that overwrites.

Eg first set for each package the defaults. Then apply the repo customizations, then package customizations. That way each would have the customization needed

dpastoor avatar Mar 17 '20 14:03 dpastoor