-
Notifications
You must be signed in to change notification settings - Fork 17
Multiple versions of package - archive #21
Comments
I also opened this topic at https://community.rstudio.com/t/discovering-archived-packages/3449 , and got a helpful reply that a |
Thanks for filing this! Been a bit busy with the holidays, etc... I'll pop back in after the NY and give it a better look. You are correct there is no route for On that note, send us a PR :) |
Also on the RDS note (saw in your post), yeah, I had thought that would be a PAIN in Java too. There are a few options though:
You might be able to use one of the three of those to either call R at some level, or to embed it and use it in Nexus. This has been kinda problematic in the past (we tend to write just plain ole Java code that emulates things as often as we can), but I figured I'd put these out here for you to gander at, and for me to look at later as well. |
Looking deeply on how things work to install package with R, it seems there is no there is no need of I wanted to share my findings about this topic: How R works ?Base R assumes you want to install a package from CRAN. Thus, it implements all the rule for this specific repo, but leave some customization possible for other repo. To install a package in R with
About old version support, Simply, you can provide package name and version directly, build the url and try to download it. If you know the organization of the package in the repo, and the filename convention, it is easy to provide a wrapper. (see below) In every case, the challenge is the dependency chain. Basically when installing from specific version, it is better to install manually all the dependencies because I think they are not resolved correctly otherwise. It is what How nexus currently works and what are the impact ?Currently, NEXUS advices to store each version in the same repository, at the root of With this organization, you can install an old package using install_packages_old <- function(pkgs, version = NULL, repos, ...) {
# Build the package name
pkg_name <- paste0(pkgs, "_", version, ".tar.gz")
# build the url knowing it should be in root /src/contrib
url <- paste(repos, "src/contrib", pkg_name, sep = "/")
# try to download
try <- tryCatch({
path <- file.path(tempdir(), pkg_name)
suppressWarnings(download.file(url, path, mode = "wb"))},
# catch the error
error = function(e) 1L
)
# if error, it means specific version is not available
if (try == 1L) stop("\nError: ", pkgs, " not available in version ", version, call. = FALSE)
on.exit(unlink(path))
# if no error, install the package using tar.gz so repos = NULL. (no dependency resolution)
install.packages(path, repos = NULL, ...)
} If you try this function, it will work as expected for installing an old package without any need of PACKAGE files or archive.rds. (this function is inspired by If we don't want to As complement, for hosted repository, the About
|
I revisited this thread the other day, and decided I'd try making an RDS serializer capable of writing the data formats present in the |
I pushed my code to a new project on GitHub: https://github.com/focusenergy/JavaRDS/tree/master . I don't know what the best way would be to package it for inclusion into this repository plugin - to me it would make sense to bundle it up into a Maven artifact and add that as a dependency, but I don't have much experience doing that. |
Hi @DarthHater & @fjmilens3 , any thoughts on incorporating this? |
Hi @DarthHater , I'm following up on this - after publishing to Maven (see nexteraanalytics/JavaRDS#1), has anyone had a chance to see how incorporating it might work? |
I have not yet, but I'll set some time aside to do that next week! |
Hi @DarthHater , did you find time for this? I don't think I mentioned, there are some unit tests that correspond closely with the data structures that would need to be created for an |
Hi, @kenahoo would you please clarify. Are you talking about R hosted or proxy repository? |
@aornatovskyy This is for R hosted. |
@kenahoo I will try to check your RDS implementation this year. Thanks for your implementation BTW! Please find me if I will not answer in 2019. =) |
Hi, we are moving R source code to nexus public. This github page will be archived. Your issue https://issues.sonatype.org/browse/NEXUS-25130 |
When I upload a new version of an R package to Nexus, it properly puts it in the (dynamically generated)
PACKAGES.gz
index. However, it's not clear what happens to the previously uploaded versions. They still show as assets, of course, and one can download them directly from their URL. But I'm not sure how an R client can "discover" those old versions.In a "regular" CRAN repository, there's an
archive.rds
file in the src/contrib/Meta/ folder that clients (e.g. the install_version function in theremotes
package from the RStudio folks) can use to discover what previous versions are available. It looks like Nexus doesn't supply a route for that, though.Has this been considered before? Is there a different mechanism a client can use to discover all versions of packages? Either way, is the
archive.rds
file standard enough that Nexus should generate it? I might be able to help make that happen if development tuits are short.Thanks.
The text was updated successfully, but these errors were encountered: