goldingn / versions

Query and Install Specific Versions of Packages on CRAN
Other
24 stars 7 forks source link

install.versions fails when latest version of package is several years old #28

Open mmastand opened 5 years ago

mmastand commented 5 years ago

We are having an issue using install.versions to install packages that were last updated many years ago. We are unable to compile a source version and thus require a binary version. Binary versions are specific to the version of R. See reprex below:

library(versions)

  sessionInfo()
#> R version 3.4.1 (2017-06-30)
#> Platform: x86_64-apple-darwin15.6.0 (64-bit)
#> Running under: macOS High Sierra 10.13.6
#> 
#> Matrix products: default
#> BLAS: /Library/Frameworks/R.framework/Versions/3.4/Resources/lib/libRblas.0.dylib
#> LAPACK: /Library/Frameworks/R.framework/Versions/3.4/Resources/lib/libRlapack.dylib
#> 
#> locale:
#> [1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8
#> 
#> attached base packages:
#> [1] stats     graphics  grDevices utils     datasets  methods   base     
#> 
#> other attached packages:
#> [1] versions_0.4
#> 
#> loaded via a namespace (and not attached):
#>  [1] compiler_3.4.1  backports_1.1.2 magrittr_1.5    rprojroot_1.3-2
#>  [5] tools_3.4.1     htmltools_0.3.6 yaml_2.1.18     Rcpp_0.12.17   
#>  [9] stringi_1.2.2   rmarkdown_1.9   knitr_1.20      stringr_1.3.1  
#> [13] digest_0.6.15   evaluate_0.10.1

  # The following requires compilation, which I cannot do.
  install.versions("bitops", "1.0-6", type = "mac.binary")
#> Warning: unable to access index for repository https://cran.microsoft.com/snapshot/2014-09-17/bin/macosx/contrib/3.4:
#>   cannot open URL 'https://cran.microsoft.com/snapshot/2014-09-17/bin/macosx/contrib/3.4/PACKAGES'
#> 
#>    package 'bitops' is available as a source package but not as a binary
#> Warning: package 'bitops' is not available (as a binary package for R
#> version 3.4.1)

  available.versions("bitops")
#> $bitops
#>   version       date available
#> 1   1.0-6 2013-08-17      TRUE
#> 2   1.0-5 2012-11-12     FALSE
#> 3 1.0-4.2 2012-11-03     FALSE
#> 4 1.0-4.1 2012-10-29     FALSE
#> 5   1.0-4 2005-01-31     FALSE
#> 6   1.0-3 2005-01-28     FALSE
  # The latest version of bitops was first published on 2013-08-17,  though version_to_date
  # returns 2014-09-17. At  that time, the latest version of R was 3.3
  versions:::version_to_date("bitops", "1.0-6")
#> [1] "2014-09-17"

The problem is only in the URL that is being generated by version_to_dateand install.dates. By default, version_to_date appears to use the earliest date that a package version existed to generate the URL. We'd like to propose that it uses the last date to generate a URL to give the highest chances of that URL existing.

Created on 2018-09-17 by the reprex package (v0.2.0).