pak
pak copied to clipboard
pkg_deps gets wrong dependencies (for past versions)
Struggling with several issues in pak recently. This one seems like a simple bug to recreate. The code below requests specific versions of the package BalancedSampling. It shows Rcpp has a minimum version, which appears to be incorrect based on the DESCRIPTION file in the respective archives. The version 1.6.3 does not have Rcpp >= 1.0.12 but pkg_dep says it does.
library(dplyr)
# reprex
pkg <- "BalancedSampling"
ver1 <- "1.6.3"
ver2 <- "2.0.5"
# empty lists to fill
deps <- list()
pakVers <- list()
manual <- list()
deps[[ver1]] <- pak::pkg_deps(paste0(pkg, "@", ver1))
deps[[ver2]] <- pak::pkg_deps(paste0(pkg, "@", ver2))
# pkg_dep gives them the same minimum requirement for ver1 and ver2
pakVers[[ver1]] <- deps[[ver1]] |> filter(ref == "Rcpp") |> select(version) # 1.0.12
pakVers[[ver2]] <- deps[[ver2]] |> filter(ref == "Rcpp") |> select(version) # 1.0.12
# Check with manual downloads
# The two have different minimum requirements for Rcpp
# ver1
setwd(tempdir())
tf <- tempfile(".tar.gz")
fl <- file.path(pkg, "DESCRIPTION")
download.file(file.path(contrib.url(getOption("repos")),
"Archive", pkg, paste0(pkg, "_", ver1, ".tar.gz")), destfile = tf)
untar(tf, files = fl)
manual[[ver1]] <- utils::packageDescription(pkg, lib.loc = ".", field = c("Imports"))
# Check with manual download for ver2
setwd(tempdir())
tf <- tempfile(".tar.gz")
fl <- file.path(pkg, "DESCRIPTION")
download.file(file.path(contrib.url(getOption("repos")),
"Archive", pkg, paste0(pkg, "_", ver2, ".tar.gz")), destfile = tf)
untar(tf, files = fl)
manual[[ver2]] <- utils::packageDescription(pkg, lib.loc = ".", field = c("Imports"))
manual # ver1 has 0.11.1; ver2 has 1.0.12
pakVers # ver1 has 1.0.12; ver2 has 1.0.12
Seems correct to me:
❯ pak::pkg_deps("[email protected]")
# A data frame: 3 × 32
ref type direct directpkg status package version license needscompilation
<chr> <chr> <lgl> <lgl> <chr> <chr> <chr> <chr> <lgl>
1 Balanc… stan… TRUE TRUE OK Balanc… 1.6.3 GPL (>… TRUE
2 Rcpp stan… FALSE FALSE OK Rcpp 1.0.12 GPL (>… FALSE
3 Sampli… stan… FALSE FALSE OK Sampli… 1.0.0 GPL (>… FALSE
# ℹ 23 more variables: priority <chr>, md5sum <chr>, sha256 <chr>,
# filesize <int>, built <chr>, platform <chr>, rversion <chr>,
# repotype <chr>, repodir <chr>, target <chr>, deps <list>, mirror <chr>,
# sources <list>, remote <list>, error <list>, metadata <list>,
# dep_types <list>, params <list>, sysreqs <chr>, cache_status <chr>,
# lib_status <chr>, old_version <chr>, new_version <chr>
❯ pak::pkg_deps("[email protected]")$deps[[1]]
# A data frame: 3 × 5
ref type package op version
<chr> <chr> <chr> <chr> <chr>
1 Rcpp Imports Rcpp ">=" "0.11.1"
2 SamplingBigData Imports SamplingBigData "" ""
3 Rcpp LinkingTo Rcpp "" ""
# pkg_dep gives them the same minimum requirement for ver1 and ver2
That's not a minimum requirement, pkg_deps() simply resolves all dependencies and lists them in a data frame. It uses the latest versions of the dependencies as much as possible, by default.
So, the reported version in the column labelled "version" in the returned data.frame is not the required version, it is the "current" version?
The documentation is ambiguous about this:
A data frame with the dependency data
...
version: package version
Why would it return "dependency data" in the version column that is different than the deps column?
pkg_deps() looks up the dependencies of a package and returns data about them. It basically does the same as pkg_install(), but stops before the installation.
AFAICT there is nothing for me to do here, but please reopen if you feel otherwise. Thanks!