Skip to content
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

explain the algorithm #5

Merged
merged 1 commit into from
Oct 7, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions script.R
Original file line number Diff line number Diff line change
@@ -1,3 +1,18 @@
# Introduction:
# The `revdepcheck` package uses the `crancache::install_packages()` function for package installation. This function, in turn, utilizes `utils::install.packages()` and incorporates an additional caching mechanism for efficiency.

Check warning on line 2 in script.R

View workflow job for this annotation

GitHub Actions / Lint Code Base

file=/github/workspace/script.R,line=2,col=121,[line_length_linter] Lines should not be more than 120 characters. This line is 229 characters.
#
# Current Limitations:
# Modifying this behavior would require changes to the source code, which is currently not feasible. There is an existing issue on this topic (https://github.com/r-lib/revdepcheck/issues/187), but it's unlikely to be addressed in the near future.

Check warning on line 5 in script.R

View workflow job for this annotation

GitHub Actions / Lint Code Base

file=/github/workspace/script.R,line=5,col=121,[line_length_linter] Lines should not be more than 120 characters. This line is 246 characters.
#
# Proposed Solution:
# The proposed solution is to integrate with the existing workflow by creating a CRAN-like repository. This repository will contain packages from `pak`'s cache, making them accessible via the default `install.packages()` function.

Check warning on line 8 in script.R

View workflow job for this annotation

GitHub Actions / Lint Code Base

file=/github/workspace/script.R,line=8,col=121,[line_length_linter] Lines should not be more than 120 characters. This line is 230 characters.
#
# Design Overview:
# 1. Create a CRAN-like repository using the `miniCRAN` package.
# 2. Install the target package and its reverse dependencies using the `pak` package.
# 3. If a package is not available on the default CRAN (e.g., it's hosted on GitHub), retrieve the cached binaries and add them to the miniCRAN repository.

Check warning on line 13 in script.R

View workflow job for this annotation

GitHub Actions / Lint Code Base

file=/github/workspace/script.R,line=13,col=121,[line_length_linter] Lines should not be more than 120 characters. This line is 155 characters.
# 4. Run `revdepcheck::revdep_check()` as usual to check reverse dependencies.

catnl <- function(x = "") cat(sprintf("%s\n", x))
if_error <- function(x, y = NULL) {
res <- try(x, silent = TRUE)
Expand Down Expand Up @@ -30,7 +45,7 @@
temp_dir <- tempfile()
on.exit(unlink(temp_dir))
dir.create(temp_dir)
# for GH packages we have `pkg_1.2.3.9000_hash.tar.gz` so we need to remove the hash and keep only `pkg_1.2.3.9000.tar.gz`

Check warning on line 48 in script.R

View workflow job for this annotation

GitHub Actions / Lint Code Base

file=/github/workspace/script.R,line=48,col=121,[line_length_linter] Lines should not be more than 120 characters. This line is 124 characters.
new_file_name <- gsub("(.*?_.*)_.*?(\\..*)", "\\1\\2", basename(x))
file.copy(x, file.path(temp_dir, new_file_name))
miniCRAN::addLocalPackage(gsub("_.*", "", basename(new_file_name)), temp_dir, minicran_path)
Expand Down
Loading