-
Notifications
You must be signed in to change notification settings - Fork 758
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
Enable install_version to install current version of package on Windows/macOS #1730
Conversation
Thanks! LGTM, please add a news entry and I can merge it. |
@jimhester Great. I added a news entry. Thanks! |
@jimhester Also, regarding my observation that
I wasn't able to find an easy fix like I did for here, and there has been recent development about how to handle binary packages (e.g. the most recent commit). Thus I wasn't sure how best to proceed. I think it could be solved by checking |
Not sure what the best solution is; the current plan is to eventually switch devtools to use pkgman, which uses a different API and method for package installation, so devtools will likely never use remotes as-is. However you are still welcome to open an issue there if you want to try and fix binary installation; in general you are somewhat limited in what binary versions are available, as CRAN only builds the most recent version of a package for a given version of R. |
@jdblischak I am not entirely sure in which situations it makes sense to install old binary packages. Most of the time these are not available for R-release, anyway. The old binary builds available are for older R versions. |
@jimhester Good to know! I didn't realize that was the plan.
@gaborcsardi Thanks for the advice! I agree this is an edge case. This PR to devtools solves the main problem I was having, so I am fine with remotes keeping its current behavior of always installing from source. Instead of changing the behavior of
If a user specifies
If a user specifies
If you're interested, I could send a PR that 1) notes in the documentation that |
@jimhester Is my NEWS entry ok? If yes, then this PR is ready to merge. |
Looks good, thanks! |
Motivation and summary
Because of the impending API change in the package git2r, I want to write documentation that advises users to install version 0.21.0 of git2r, which is still the current version of CRAN. This doesn't work with the current version of
devtools::install_version
on Windows or macOS. This PR fixes it.The Diaspora
I read about the diaspora. However, I still decided to send the PR here because unlike packages like pkgbuild and usethis, remotes is not yet a dependency for devtools. Also,
remotes::install_version
doesn't have this issue. Please feel free to close it.Edit: I investigated more. The implementation of
remotes::install_version
has substantially changed from the one in devtools, i.e. it doesn't useinstall.packages
to determine the download URL. Instead it constructs the URL itself, always specifying the extension .tar.gz. Thus this works when installing from source, but breaks if passedtype = "binary"
.Demonstration
On macOS (tested on 10.10.5 and 10.10.13) and Windows (tested on 10),
install_version
results in an error when trying to install the current version. Specifyingtype = "binary"
fixes it.Proposed solution
When installing the current version,
install_version
passes everything on toinstall.packages
. According to theinstall.packages
man page, you are not supposed to set bothcontriburl
andtype = "both"
:On the Windows and macOS machines I tested,
getOptions("pkgType")
was"both"
. I was able to fix the problem by removing the manual setting ofcontriburl
byinstall_version
. This was unnecessary anyways because it was using the same default asinstall.packages
does:contrib.url(repos, type)
.I confirmed that this solution works on macOS, Windows, and Linux.
Potentially related issues: #1724 (comment), r-hub/rhub#123
If this PR is useful, I can add a bullet point to
NEWS.md
.