Skip to content
Merged
Show file tree
Hide file tree
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
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ URL:
https://Require.predictiveecology.org,
https://github.com/PredictiveEcology/Require
Date: 2026-09-04
Version: 2.1.1.9052
Version: 2.1.1.9053
Authors@R: c(
person(given = "Eliot J B",
family = "McIntire",
Expand Down
2 changes: 2 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@

## Bug fixes

* Two GitHub refs for one package on different branches, each with a minimum version, now keep the higher minimum. Require kept whichever came first, so a module's `PredictiveEcology/mpbutils@development (>= 0.1.3.9003)` was dropped behind another module's `PredictiveEcology/mpbutils (>= 0.1.2)`, and the installed 0.1.3.9002 was never upgraded.

* When pak's batch install fails without naming the package at fault, the packages left are installed one at a time as before, but now in dependency order and with the same retry passes as a package pak does name. They were tried once each in the order given, so a package tried before its dependency (BioSIM before J4R, LandR before pemisc) was reported as not installed.

* An exact version together with a minimum and a maximum for the same package, e.g. `c("pkg (==2.0)", "pkg (>=1.0)", "pkg (<=3.0)")`, no longer stops `Require()` with "invalid argument type". The exact version is kept when it meets both; otherwise it is dropped as before.
Expand Down
9 changes: 7 additions & 2 deletions R/pak.R
Original file line number Diff line number Diff line change
Expand Up @@ -3119,7 +3119,8 @@ reportInstallFailures <- function(failures, missingPkgNames = character(0),
# listed before the @HEAD/bare form). If no GitHub ref exists for a
# duplicate, keep the first occurrence.
# Copies of the kept ref that add a version spec are kept too, so
# trimRedundancies() can apply the strictest spec.
# trimRedundancies() can apply the strictest spec; so is any other GitHub ref
# with a version spec (another branch), so trimRedundancies() can choose it.
#
# Why this exists: trimRedundancies()'s logic for collapsing duplicate
# package rows relies on `versionSpec` (e.g. `(>= 1.0)`) being set on at
Expand Down Expand Up @@ -3150,7 +3151,11 @@ reportInstallFailures <- function(failures, missingPkgNames = character(0),
## behind an unversioned "acct/LandR@dev", so LandR below X was never upgraded.
hasSpec <- grepl("\\([[:space:]]*[<>=]", refs[idx])
sameRef <- trimVersionNumber(refs[idx]) == trimVersionNumber(refs[keep])
toRemove <- c(toRemove, setdiff(idx, c(keep, idx[hasSpec & sameRef])))
## Likewise a GitHub ref on another branch with a version spec: keeping only
## the first lost a module's "acct/mpbutils@development (>= X)" behind
## another module's "acct/mpbutils (>= Y)", so mpbutils below X was never
## upgraded. trimRedundancies() picks between branches by version.
toRemove <- c(toRemove, setdiff(idx, c(keep, idx[hasSpec & (sameRef | isGH(refs[idx]))])))
}
if (length(toRemove)) refs[-toRemove] else refs
}
Expand Down
10 changes: 10 additions & 0 deletions tests/testthat/test-15bugfixes_testthat.R
Original file line number Diff line number Diff line change
Expand Up @@ -791,6 +791,16 @@ test_that(".preferGHrefDedup() collapses multi-form refs preferring GH > CRAN",
"acct/pkg@dev (>= 1.2.0.9046)", "acct/pkg")),
c("acct/pkg@dev", "acct/pkg@dev (>= 1.2.0.9046)"))

# Another branch's GitHub ref with a higher version floor is kept too, so
# trimRedundancies() can choose it (2026-12-04: four MPB modules asked for
# "PredictiveEcology/mpbutils (>= 0.1.2)" and one for
# "PredictiveEcology/mpbutils@development (>= 0.1.3.9003)"; the first was
# kept, and mpbutils 0.1.3.9002 was never upgraded).
refs3 <- c("acct/pkg (>= 0.1.2)", "acct/pkg@dev (>= 0.1.3.9003)")
expect_identical(Require:::.preferGHrefDedup(refs3), refs3)
expect_identical(Require:::trimRedundancies(Require:::.preferGHrefDedup(refs3))$packageFullName,
"acct/pkg@dev (>= 0.1.3.9003)")

# No-op when there are no duplicates.
refs2 <- c("data.table", "fpCompare", "digest")
expect_identical(Require:::.preferGHrefDedup(refs2), refs2)
Expand Down
Loading