-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #221 from b-rodrigues/local_hash
- Compute hash of git and CRAN archive packages locally if nix is installed
- Loading branch information
Showing
19 changed files
with
716 additions
and
286 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,37 +0,0 @@ | ||
#' get_sri_hash_deps Get the SRI hash of the NAR serialization of a Github repo | ||
#' @param repo_url A character. The URL to the package's Github repository or to the `.tar.gz` package hosted on CRAN. | ||
#' @param branch_name A character. The branch of interest, NULL for archived CRAN packages. | ||
#' @param commit A character. The commit hash of interest, for reproducibility's sake, NULL for archived CRAN packages. | ||
#' @return list with following elements: | ||
#' - `sri_hash`: string with SRI hash of the NAR serialization of a Github repo | ||
#' - `deps`: string with R package dependencies separarated by space. | ||
#' @noRd | ||
get_sri_hash_deps <- function(repo_url, branch_name, commit) { | ||
# handle to get error for status code 404 | ||
h <- curl::new_handle(failonerror = TRUE) | ||
|
||
url <- paste0( | ||
"http://git2nixsha.dev:1506/hash?repo_url=", | ||
repo_url, "&branchName=", branch_name, "&commit=", commit | ||
) | ||
|
||
# extra diagnostics | ||
extra_diagnostics <- | ||
c( | ||
"\nIf it's a Github repo, check the url, branch name and commit.\n", | ||
"Are these correct? If it's an archived CRAN package, check the name\n", | ||
"of the package and the version number." | ||
) | ||
|
||
req <- try_get_request( | ||
url = url, handle = h, | ||
extra_diagnostics = extra_diagnostics | ||
) | ||
|
||
# plumber endpoint delivers list with | ||
# - `sri_hash`: string with SRI hash of the NAR serialization of a Github repo | ||
# - `deps`: string with R package dependencies separated by `" "` | ||
sri_hash_deps_list <- jsonlite::fromJSON(rawToChar(req$content)) | ||
|
||
return(sri_hash_deps_list) | ||
} | ||
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.