-
Notifications
You must be signed in to change notification settings - Fork 91
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
Add support for Artifactory archive types #583
Comments
This has come up with a customer using Posit Connect in support ticket 90580. |
We have a solution for this on the renv side; perhaps we could port the relevant code to Packrat? That code lives here: https://github.com/rstudio/renv/blob/029c4457c0c2846eafd9a1da8bf3f95daf49fe45/R/retrieve.R#L806-L860 |
The recent version of Connect which bundles a newer version of packrat exposed us to this issue as well. It would be great to either adapt the code from the linked PR or the linked renv solution to support this. In the short term I have patched the vendored version of packrat for our use, but it would be great to avoid this workaround and use the one bundled with Connect. |
@jimhester - the implementation of |
Related: recent versions of renv assume that Artifactory uses a CRAN-like repository layout, but that may not always be appropriate. rstudio/renv#1996 |
Sure, here's the diff, it is based off of https://github.com/rstudio/packrat/tree/a71a5feebb4f4a9fe95c6421f30b5e51424b1863 that fixes the issue for our use. I unfortunately don't recall why I based it off of that particular commit. --- packrat-a71a5feebb4f4a9fe95c6421f30b5e51424b1863/R/restore.R 2023-10-18 16:41:38
+++ packrat-nflx/R/restore.R 2023-11-17 10:33:09
@@ -199,10 +199,16 @@
# each named repository.
foundVersion <- FALSE
for (repo in repos) {
+ for (archiveUrl in c(
+ file.path(repo, "src/contrib/Archive",
+ pkgRecord$name,
+ pkgSrcFile),
+ file.path(repo, "src/contrib/Archive",
+ pkgRecord$name,
+ pkgRecord$version,
+ pkgSrcFile)
+ )) {
tryCatch({
- archiveUrl <- file.path(repo, "src/contrib/Archive",
- pkgRecord$name,
- pkgSrcFile)
downloadWithRetries(archiveUrl,
destfile = file.path(pkgSrcDir, pkgSrcFile),
mode = "wb", quiet = TRUE)
@@ -212,7 +218,7 @@
}, error = function(e) {
# Ignore error and try the next repository
})
- }
+ }}
if (!foundVersion) {
message("FAILED")
stopMsg <- sprintf("Failed to retrieve package sources for %s %s from CRAN (internet connectivity issue?)", |
Thanks, @jimhester. I'm surprised that you don't need an additional The commit you referenced is the one we pinned before switching to 7062580, which has some improvements when many restores happen concurrently. |
this is not the most efficient approach, but attempts multiple repository archive layouts before giving up. reduces the number of download attempts before giving up. generally, a single retry is enough. also reduces the cost of additional layout attempts. fixes #583
This will probably do it: #730 I want to add some tests before merging, too. |
this is not the most efficient approach, but attempts multiple repository archive layouts before giving up. reduces the number of download attempts before giving up. generally, a single retry is enough. also reduces the cost of additional layout attempts. fixes #583
In RTFACT-17392, Artifactory has a bug dealing with how CRAN archives. While that is indeed a bug, I have found in 3.5.1 install.packages, varying implementation of REMOTES, and/or versions of packrat, each package attempt to solve these varying implementations differently. Some need to reference a "archive.rds". Others must have a package.rds while others sufficiently use a PACKAGE file.
The ask and the associated PR is allowing the loosening of these restrictions to be backwards compatible. Remotes has a similar bug and PR
The text was updated successfully, but these errors were encountered: