Skip to content

download_version doesn't look up duplicated package #495

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

Open
kos59125 opened this issue Apr 26, 2020 · 3 comments
Open

download_version doesn't look up duplicated package #495

kos59125 opened this issue Apr 26, 2020 · 3 comments
Labels
feature a feature request or enhancement

Comments

@kos59125
Copy link

Local CRAN repositories may have duplicated packages (same name with different versions). For example, if a repository owner uploads package PKG v1.0 and PKG 2.0 to their CRAN repository, PACKAGE in contriburl is like:

Package: PKG
Version: 1.0
Depends: anotherpkg
MD5sum: hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh
NeedsCompilation: no

Package: PKG
Version: 2.0
Depends: anotherpkg
MD5sum: hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh
NeedsCompilation: no

This is not abnormal as tools::write_PACKAGES(latestOnly = FALSE) can generate so.

The current version of download_version_url uses available.packages with default filters which means c("R_version", "OS_type", "subarch", "duplicates"). "duplicates" means it returns the latest version if duplicated packages are found (see help(available.packages)).

There are two problems. The first problem is, if users call download_version("PKG", "1.0", "https://my_local_repo") with default filters, it raises an error (if there's no Archive directory like official CRAN) because the latest version of PKG is not 1.0 but 2.0. The second problem is, if users set the available_packages_filters option like c("R_version", "OS_type", "subarch"), the user cannot download the latest version with download_version("PKG", "2.0", "https://my_local_repo").

My suggestion to resolve the problems is that download_version_url should consider the available_packages_filters option and remove "duplicates" filter. If users do not set the available_packages_filters option, the function use c("R_version", "OS_type", "subarch"). If users do set the available_packages_filters option, the function uses setdiff(user_filters, "duplicates").

@jimhester
Copy link
Member

Could you see if #305 fixes your issue, I think it may.

@kos59125
Copy link
Author

kos59125 commented Apr 28, 2020

It partially works: download_version("PKG", "1.0", repos = ...) downloads v1.0 and download_version("PKG", "2.0", repos = ...) downloads v2.0, but download_version("PKG", repos = ...) (version is NULL) doesn't download the latest version.

@kos59125
Copy link
Author

I thought version = NULL will download the latest version (as documented in the current version of remotes::download_version), but I found the HEAD version doesn't specify the behavior of version = NULL.

@jimhester jimhester added the feature a feature request or enhancement label Jun 5, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature a feature request or enhancement
Projects
None yet
Development

No branches or pull requests

2 participants