Fix remote_download url to use GitLab API#359
Fix remote_download url to use GitLab API#359jimhester merged 6 commits intor-lib:masterfrom aornugent:fix/install-gitlab-api
Conversation
|
Nice! And such an easy fix. install_gitlab("user/repo@non-default-branch")will download and install from the default branch (usually According to the Repository API docs, the branch (or tag or SHA) has to be specified with the Long story short, line 74 src <- paste0(src_root, "/repository/archive.tar.gz?ref=", utils::URLencode(x$ref, reserved = TRUE))probably ought to be src <- paste0(src_root, "/repository/archive.tar.gz?sha=", utils::URLencode(x$ref, reserved = TRUE))Installing from a subdir like e.g. install_gitlab("dpprdan/rpostgresql/RPostgreSQL")works BTW, even though it apparently downloads the whole repo and not only the subdir (Update: yes, that's what |
|
Thanks for the feedback. If the API is after a commit ID is there any reason to give it |
|
Sorry, I don't follow.
Again, not sure if you meant this, but FWIW, I find Gitlab's API parameters in this particular context a bit confusing. For the For the
Well, if you want to install a branch other than the default (usually |
|
Maybe I over complicated things sorry. I understood what you were suggesting, but thought that using the commit SHA made for a better looking API call than: But that's not an important metric to maximise. I've reverted the commit and adopted your suggestions. |
|
Thanks for working on this! @dpprdan Do the current changes look good to you? @aornugent |
|
@jimhester Looking good so far. However, the installation is not skipped, when The consequence of this is that there is no See this commit for the necessary changes. I can open a PR but you can also just copy it from there if you like, @aornugent. Other than that, everything looks fine to me, including installing from private repos with |
|
@jimhester Two OT suggestions:
|
Let's get it done in one. |
|
Ok one last thing, can you run |
|
Thank you to @aornugent for the PR and for @dpprdan for improvements and reviewing the changes! Great work, this package is now better thanks to you! |
|
Oh no, we missed a bug here: #355 (comment) This line Line 122 in 92f3064 doesn't need the access token at the end as it is added in the What the best way to remedy this? A second PR or revert the merge? |
|
Actually, I'm not sure that the double token is the cause of the bug, but I don't have a failing example to test on. |
|
In my case the double token is not the problem. I also get the "Not Found" error if I remove the second part. I dont know why, but our gitlab is not able to translate user/repo to project ID, with which it would work. |
|
Sorry, the double token is my bad. But it does not cause the error, I've tested it successfully with a private repo. I would fix it myself, but cannot get |
|
Yes, please open a new PR with the fix |
I ended up installing WSL + Ubuntu + R to get it running. See: https://itsfoss.com/install-bash-on-windows/ |
|
@aornugent Thanks! I do have Details# First, what versions do I have?
$ make --version
GNU Make 4.2.1
Built for i686-pc-msys
Copyright (C) 1988-2016 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
Daniel@Notebook-DP ~/Documents/R/github/remotes (master)
$ R --version
R version 3.5.3 (2019-03-11) -- "Great Truth"
Copyright (C) 2019 The R Foundation for Statistical Computing
Platform: x86_64-w64-mingw32/x64 (64-bit)
R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under the terms of the
GNU General Public License versions 2 or 3.
For more information about these matters see
http://www.gnu.org/licenses/.
# make cannot find the brew package
Daniel@Notebook-DP ~/Documents/R/github/remotes (master)
$ make
Rscript -e 'brew::brew("inst/install-github.Rin", "inst/install-github.R")'
Error: object 'brew' not found
# But brew is installed?!
Daniel@Notebook-DP ~/Documents/R/github/remotes (master)
$ Rscript -e 'library(brew);brew(system.file("example1.brew",package="brew"),envir=new.env())'
Title: brew test
current time: 2019-05-09 12:39:38
value of foo: bar
i is 1
from example2.brew, foo is: bar1
i is 2
from example2.brew, foo is: bar12
i is 3
from example2.brew, foo is: bar123
i is 4
from example2.brew, foo is: bar1234
i is 5
from example2.brew, foo is: bar12345
i is 6
from example2.brew, foo is: bar123456
i is 7
from example2.brew, foo is: bar1234567
i is 8
from example2.brew, foo is: bar12345678
i is 9
from example2.brew, foo is: bar123456789
i is 10
from example2.brew, foo is: bar12345678910
|

install_gitlabuses the GitLab API to get commit IDs but not for downloading the repository. This causes it to fail on private repositories, see this issue on the Rstudio Discourse.