pkgcache icon indicating copy to clipboard operation
pkgcache copied to clipboard

`repo_resolve()` for different snapshot date returns the same url

Open pawelru opened this issue 1 year ago • 4 comments

I would expect different urls will be returned for different dates

packageVersion("pkgcache")
#> [1] '2.2.2'
pkgcache::repo_resolve("PPM@2024-01-01")
#>                                     CRAN 
#> "https://packagemanager.posit.co/cran/0"
pkgcache::repo_resolve("PPM@2024-02-01")
#>                                     CRAN 
#> "https://packagemanager.posit.co/cran/0"
pkgcache::repo_resolve("PPM@2024-03-01")
#>                                     CRAN 
#> "https://packagemanager.posit.co/cran/0"
pkgcache::repo_resolve("PPM@2024-04-01")
#>                                     CRAN 
#> "https://packagemanager.posit.co/cran/0"
pkgcache::repo_resolve("PPM@2024-05-01")
#>                                     CRAN 
#> "https://packagemanager.posit.co/cran/0"
pkgcache::ppm_snapshots()
#> # A data frame: 1,000 × 2
#>    date                   id
#>    <dttm>              <int>
#>  1 2019-07-11 00:00:00     0
#>  2 2019-07-15 00:00:00     0
#>  3 2019-07-18 00:00:00     0
#>  4 2019-07-22 00:00:00     0
#>  5 2019-07-23 00:00:00     0
#>  6 2019-07-25 00:00:00     0
#>  7 2019-07-26 00:00:00     0
#>  8 2019-07-29 00:00:00     0
#>  9 2019-08-01 00:00:00     0
#> 10 2019-08-05 00:00:00     0
#> # ℹ 990 more rows
unique(pkgcache::ppm_snapshots()$id)
#> [1] 0

sessionInfo()
#> R version 4.4.0 (2024-04-24)
#> Platform: aarch64-apple-darwin20
#> Running under: macOS Sonoma 14.3
#> 
#> Matrix products: default
#> BLAS:   /Library/Frameworks/R.framework/Versions/4.4-arm64/Resources/lib/libRblas.0.dylib 
#> LAPACK: /Library/Frameworks/R.framework/Versions/4.4-arm64/Resources/lib/libRlapack.dylib;  LAPACK version 3.12.0
#> 
#> locale:
#> [1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8
#> 
#> time zone: Europe/Zurich
#> tzcode source: internal
#> 
#> attached base packages:
#> [1] stats     graphics  grDevices utils     datasets  methods   base     
#> 
#> loaded via a namespace (and not attached):
#>  [1] vctrs_0.6.5       cli_3.6.2         knitr_1.46        rlang_1.1.3      
#>  [5] xfun_0.43         processx_3.8.4    purrr_1.0.2       styler_1.10.3    
#>  [9] jsonlite_1.8.8    glue_1.7.0        htmltools_0.5.8.1 ps_1.7.6         
#> [13] fansi_1.0.6       rmarkdown_2.26    R.cache_0.16.0    evaluate_0.23    
#> [17] fastmap_1.1.1     yaml_2.3.8        lifecycle_1.0.4   compiler_4.4.0   
#> [21] pkgcache_2.2.2    fs_1.6.4          R.oo_1.26.0       R.utils_2.12.3   
#> [25] digest_0.6.35     R6_2.5.1          reprex_2.1.0      utf8_1.2.4       
#> [29] pillar_1.9.0      curl_5.2.1        magrittr_2.0.3    R.methodsS3_1.8.2
#> [33] tools_4.4.0       withr_3.0.0

Created on 2024-05-14 with reprex v2.1.0

pawelru avatar May 14 '24 14:05 pawelru

I think this is caused by a recent PPM update, and maybe it is an intentional change, maybe it is not. I reported it to PPM.

gaborcsardi avatar May 14 '24 15:05 gaborcsardi

Yeah, unfortunately they changed the format of this, so this breaks pkgcache.

Now you can use the dates directly, e.g. https://packagemanager.posit.co/cran/2019-07-12 and it should resolve to the previous snapshot if there was no snapshot on that date.

gaborcsardi avatar May 14 '24 15:05 gaborcsardi

OK thanks for confirmation. I think I can handle this by parsing url string on my own.

pawelru avatar May 14 '24 15:05 pawelru

Will fix soon, but it'll probably take a couple of days.

gaborcsardi avatar May 14 '24 15:05 gaborcsardi