-
Notifications
You must be signed in to change notification settings - Fork 155
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
support binary + source packages in Nexus repositories #1074
Comments
@arnauddeblic: do you know if there's a way for me to determine whether a repository URL is associated with a Nexus repository? E.g. is there some file or header I can query at the repository URL to determine that? |
I've tried making some changes to support this in a582231; if you want to test you can try something like:
and see if If there's a way for me to query whether a repository is a Nexus repository, then I could eliminate the need to set an R option to opt-in to this behavior. |
Dear @kevinushey, Many thanks for addressing this issue so quickly! To answer both your questions:
The fallback function is called and an URL is requested - this is a good start. Same behavior for source packages:
Since Nexus is a proxy (and cache) system, I'm afraid there is no special file that could help. Please note:
Since we are not sure Nexus will always send this header (companies sometimes change their name or their products name, you know it better than me ;) ), maybe you could secure this header request with your Other question Would you have any question, please contact me. |
Thanks! I've made the changes required (I think) to support the Nexus URLs properly. It might take a bit more iteration to refine but I think we're getting there. Re: your question on
and From what I can see in the R sources: R uses the |
Many thanks @kevinushey for your support. I tried your new implementation: Diagnostics:
I spent some time debugging and found the problem:
When removing HEAD parameter from
I don't know if there is another option than HEAD to limit the amount of data to be served when requesting an URL. If there is no option, maybe we could store the result of the Additional question concerning download method:In your implemention, you seem to prefer Kind regards Arnaud |
Thanks! I think it should be okay to just perform a regular web request at that endpoint; it's unlikely the returned data would be large from any typical CRAN mirror. It would also allow us to use arbitrary downloaders as well (so no need to force the use of Loose ends should be tied up on the main branch now. Thanks for the feedback; fingers crossed that this gets us over the finish line! |
I will give you feedback as soon as I test. |
Dear @kevinushey, Thanks for your reply and for new improved implementation. I tested
on several Windows environments:
using 2 different methods:
DiagnosticsResults are OK everywhere, with all 4 configurations, apart from a strange behavior, see below:
Strange behavior observed on Windows ServerWhen restoring a renv project on Windows Server (using R.exe run from command line):
To make sure, I tested with Would you have any question, please contact me. P.S. :
|
Great news -- thanks for taking the time to test.
I'm hoping to prepare a new release in the coming weeks.
Yes, we can consider the option here stable.
Thanks for the heads up here -- I'll see if I can figure out where this is coming from. |
Regarding the
(please also make sure That might give a hint as to where that directory is coming from. |
My only other guess is that this could be related to us setting Lines 10 to 13 in 630d5ef
Maybe something is auto-creating those directories? |
Dear @kevinushey,
I added this code since otherwise, from what I understand, R does not take into account To be sure this auto-creation is responsible for the NULL directory, I've just added the same kind of parameter in my VDI environment:
This configuration now leads to the same strange behavior on my VDI: a NULL directory is created. This configuration was not already set on VDI when I performed the tests this morning. I planned to do it, since otherwise, from what I understand, R does not take into account Do you know if there is another way to auto-create those directories ? Kind regards |
The R documentation suggests that And those In this case, I believe |
Dear @kevinushey, On server:
On VDI:
|
Great, I'm glad to hear it! Thanks for taking the time to report back. |
Many thanks @kevinushey for your very quick and positive answer !
To make it simple, Nexus (aka Nexus Repository Manager, by Sonatype) is deployed by my IT teams on our company's servers.
Nexus aims at achieving two main goals:
In the Rprofile.site we deploy on our machines, the repository is set using the Nexus root URL for R repository (miror of CRAN). Thanks to this configuration:
The architecture of Nexus storage is the same as the original CRAN repository. For example :
The main difference with CRAN is that older versions are kept, and still available thanks to Nexus internal storage functionality.
Binary packages
Here is an example for binary package
rlang
in my Nexus architecture:As said above, older versions are still available for download, even if they are not explicitly listed in PACKAGES.gz (which only includes latest version since it is the proxyfied version of CRAN’s PACKAGES.gz file):
The idea would be to determine the theoretical URL and try such URL when restoring the project, if the requested package is not explicitly listed in PACKAGES.gz.
In our example, if the renv.lock file contains the record
[email protected]
, we should try URL bin/windows/contrib/4.1/rlang_1.0.4.zip.Source packages
The same idea could also be used for source packages, in order to take advantage of Nexus storage functionnality.
Here is an example for source package
rlang
in my Nexus architecture:Again, older versions are still available for download, even if they are not explicitly listed in PACKAGES.gz (which only includes latest version since it is the proxyfied version of CRAN’s PACKAGES.gz file):
I saw the code you wrote retrieve.R file, for
renv_retrieve_repos_archive_path()
function.I understand (but not 100% sure) that when requested package is neither in binary PACKAGES.gz file nor in source PACKAGES.gz, this function:
(If voluntary ignore the step related to issue #602, to keep this post as simple as possible !)
If the package has been moved to Archive subfolder in CRAN, Nexus will download it and store it with the same architecture, in folder "src/contrib/Archive/<PACKAGE_NAME>/".
At the end of the day, the same source package will be duplicated in Nexus storage : both in "src/contrib/" (initial download) and in "src/contrib/Archive/<PACKAGE_NAME>/" (second download, when package is moved to Archive in CRAN) :
If we could avoid this, this would prevent from unnecessarily increase the storage volumetry.
For Nexus’like configurations, I would suggest to try first in "src/contrib/", and then in "src/contrib/Archive/<PACKAGE_NAME>/".
Conclusion
To put in a nutshell, my suggested sequence would be :
I don't know if repository managers like Nexus are largely used by R users. If you don't want to systematically try oldest versions, a user-level configuration to trigger steps 2 and 5 could make sense:
For instance, using a new option
renv.config.retrieve.try.older
(orRENV_CONFIG_RETRIEVE_TRY_OLDER
as environment variable), with default toFALSE
.Would you have any question, please contact me.
And if you prefer that I create an new issue on Github, please tell me.
Kind regards
Arnaud
Originally posted by @arnauddeblic in #595 (comment)
The text was updated successfully, but these errors were encountered: