diff --git a/R/bundlePackageRenv.R b/R/bundlePackageRenv.R index 140049dd..caf76cd6 100644 --- a/R/bundlePackageRenv.R +++ b/R/bundlePackageRenv.R @@ -112,10 +112,11 @@ standardizeRenvPackage <- function(pkg, # Try packages defined from default bioC repos pkg$Repository <- findRepoUrl(pkg$Package, biocPackages) } - } else if (pkg$Source == "unknown") { - pkg$Source <- NA_character_ } else if (pkg$Source %in% c("Bitbucket", "GitHub", "GitLab")) { pkg$Source <- tolower(pkg$Source) + } else if (pkg$Source %in% c("Local", "unknown")) { + pkg$Source <- NA_character_ + pkg$Repository <- NA_character_ } # Remove Remote fields that pak adds for "standard" installs from CRAN diff --git a/tests/testthat/test-bundlePackageRenv.R b/tests/testthat/test-bundlePackageRenv.R index f2b7f642..aedf756e 100644 --- a/tests/testthat/test-bundlePackageRenv.R +++ b/tests/testthat/test-bundlePackageRenv.R @@ -173,10 +173,18 @@ test_that("packages installed from other repos get correctly named", { ) }) -test_that("source packages get NA source", { - source <- list(Package = "pkg", Source = "unknown") +test_that("source packages get NA source + repository", { + source <- list(Package = "pkg", Source = "unknown", Repository = "useless") expect_equal( standardizeRenvPackage(source), - list(Package = "pkg", Source = NA_character_) + list(Package = "pkg", Source = NA_character_, Repository = NA_character_) + ) +}) + +test_that("Local packages get NA source + repository", { + source <- list(Package = "pkg", Source = "Local", Repository = "useless") + expect_equal( + standardizeRenvPackage(source), + list(Package = "pkg", Source = NA_character_, Repository = NA_character_) ) })