Skip to content

Commit

Permalink
Merge pull request #612 from rstudio/bugfix/available-packages-no-row…
Browse files Browse the repository at this point in the history
…names

don't use rownames when looking for CRAN packages
  • Loading branch information
kevinushey authored Feb 19, 2021
2 parents 6a5fced + baaf56d commit 005730f
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
4 changes: 2 additions & 2 deletions R/pkg.R
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ getPackageRecordsExternalSource <- function(pkgNames,
result$source <- "CRAN"
}

} else if (fallback.ok && pkgName %in% rownames(available)) {
} else if (fallback.ok && pkgName %in% available[, "Package"]) {

# The package is not currently installed, but is available on CRAN.
# Snapshot the latest available version for this package from CRAN.
Expand Down Expand Up @@ -395,7 +395,7 @@ inferPackageRecord <- function(df, available = availablePackages()) {
source = 'Bioconductor',
version = ver
), class = c('packageRecord', 'Bioconductor')))
} else if (name %in% rownames(available)) {
} else if (name %in% available[, "Package"]) {
# It's available on CRAN, so get it from CRAN!
return(structure(list(
name = name,
Expand Down
4 changes: 2 additions & 2 deletions R/restore.R
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ getSourceForPkgRecord <- function(pkgRecord,

# Attempt to detect if this is the current version of a package
# on a CRAN-like repository
currentVersion <- if (pkgRecord$name %in% rownames(availablePkgs))
currentVersion <- if (pkgRecord$name %in% availablePkgs[, "Package"])
availablePkgs[pkgRecord$name, "Version"]
else
NA
Expand Down Expand Up @@ -685,7 +685,7 @@ installPkg <- function(pkgRecord,
if (!(copiedFromCache || copiedFromUntrustedCache) &&
hasBinaryRepositories() &&
isFromCranlikeRepo(pkgRecord, repos) &&
pkgRecord$name %in% rownames(availablePackagesBinary(repos = repos)) &&
pkgRecord$name %in% availablePackagesBinary(repos = repos)[, "Package"] &&
versionMatchesDb(pkgRecord, availablePackagesBinary(repos = repos)))
{
tempdir <- tempdir()
Expand Down
2 changes: 1 addition & 1 deletion inst/resources/init.R
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ local({
}

## Try downloading packrat from CRAN if available
else if ("packrat" %in% rownames(available.packages())) {
else if ("packrat" %in% available.packages()[, "Package"]) {
message("> Installing packrat from CRAN")
install.packages("packrat")
}
Expand Down

0 comments on commit 005730f

Please sign in to comment.