Skip to content

Commit f2bda35

Browse files
authored
Merge pull request #80 from wlandau/main
Standard license checks
2 parents af1cbfc + 7f7a58e commit f2bda35

File tree

7 files changed

+44
-59
lines changed

7 files changed

+44
-59
lines changed

DESCRIPTION

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ Package: multiverse.internals
22
Title: Internal Infrastructure for R-multiverse
33
Description: R-multiverse requires this internal infrastructure package to
44
automate contribution reviews and populate universes.
5-
Version: 1.0.8
5+
Version: 1.0.9
66
License: MIT + file LICENSE
77
URL:
88
https://r-multiverse.org/multiverse.internals/,
@@ -28,7 +28,7 @@ Authors@R: c(
2828
role = "cph"
2929
))
3030
Depends:
31-
R (>= 4.4.0)
31+
R (>= 4.5.0)
3232
Imports:
3333
base64enc,
3434
desc,
@@ -40,6 +40,7 @@ Imports:
4040
R.utils,
4141
rversions,
4242
stats,
43+
tools,
4344
utils,
4445
vctrs,
4546
yaml

NAMESPACE

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ importFrom(pkgsearch,cran_package)
4747
importFrom(rversions,r_versions)
4848
importFrom(stats,aggregate)
4949
importFrom(stats,setNames)
50+
importFrom(tools,analyze_license)
5051
importFrom(utils,available.packages)
5152
importFrom(utils,compareVersion)
5253
importFrom(utils,contrib.url)

NEWS.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
# multiverse.internals 1.0.9
2+
3+
* Use `tools::analyze_license()` to determine if a package in a registration request has an open-source license. This is much more consistent and reliable than checking a manual list of license specification strings.
4+
* Fix `meta_snapshot()` tests (check against the correct versions of R for the year 2025).
5+
* Fix `rclone_includes()` tests: use the upcoming snapshot R version.
6+
17
# multiverse.internals 1.0.8
28

39
* Subsume `meta_checks()` into `meta_packages()`.

R/assert_package_description.R

Lines changed: 5 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ assert_parsed_description <- function(name, description) {
9191
)
9292
}
9393
authors_r <- try(
94-
eval(parse(text = description$get("Authors@R"))),
94+
suppressWarnings(eval(parse(text = description$get("Authors@R")))),
9595
silent = TRUE
9696
)
9797
if (inherits(authors_r, "try-error")) {
@@ -107,7 +107,10 @@ assert_parsed_description <- function(name, description) {
107107
)
108108
}
109109
license <- description$get("License")
110-
if (!(license %in% trusted_licenses)) {
110+
license_data <- tools::analyze_license(license)
111+
license_okay <- isTRUE(license_data$is_canonical) &&
112+
(isTRUE(license_data$is_FOSS) || isTRUE(license_data$is_verified))
113+
if (!license_okay) {
111114
return(
112115
paste(
113116
"Detected license",
@@ -150,36 +153,3 @@ assert_license_local <- function(name, path, text) {
150153
)
151154
}
152155
}
153-
154-
trusted_licenses <- c(
155-
"Apache License (== 2.0)",
156-
"Apache License (>= 2.0)",
157-
"Artistic-2.0",
158-
"Artistic License 2.0",
159-
"BSD_2_clause + file LICENCE",
160-
"BSD_3_clause + file LICENCE",
161-
"BSD_2_clause + file LICENSE",
162-
"BSD_3_clause + file LICENSE",
163-
"GPL-2",
164-
"GPL-3",
165-
"GPL (== 2)",
166-
"GPL (== 2)",
167-
"GPL (== 2.0)",
168-
"GPL (== 3)",
169-
"GPL (== 3.0)",
170-
"GPL (>= 2)",
171-
"GPL (>= 2)",
172-
"GPL (>= 2.0)",
173-
"GPL (>= 3)",
174-
"GPL (>= 3.0)",
175-
"LGPL-2",
176-
"LGPL-3",
177-
"LGPL (== 2)",
178-
"LGPL (== 2.1)",
179-
"LGPL (== 3)",
180-
"LGPL (>= 2)",
181-
"LGPL (>= 2.1)",
182-
"LGPL (>= 3)",
183-
"MIT + file LICENCE",
184-
"MIT + file LICENSE"
185-
)

R/package.R

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
#' @importFrom R.utils gzip
99
#' @importFrom rversions r_versions
1010
#' @importFrom stats aggregate setNames
11+
#' @importFrom tools analyze_license
1112
#' @importFrom utils available.packages compareVersion contrib.url tail unzip
1213
#' @importFrom vctrs vec_rbind vec_slice
1314
#' @importFrom yaml read_yaml

tests/testthat/test-meta_snapshot.R

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ test_that("meta_snapshot() is correct", {
7373
dependency_freeze = "2025-04-15",
7474
candidate_freeze = "2025-05-15",
7575
snapshot = "2025-06-15",
76-
r = "4.4"
76+
r = "4.5"
7777
)
7878
}
7979
for (month in c("05", "06")) {
@@ -83,7 +83,7 @@ test_that("meta_snapshot() is correct", {
8383
dependency_freeze = "2025-04-15",
8484
candidate_freeze = "2025-05-15",
8585
snapshot = "2025-06-15",
86-
r = "4.4"
86+
r = "4.5"
8787
)
8888
}
8989
}
@@ -93,7 +93,7 @@ test_that("meta_snapshot() is correct", {
9393
dependency_freeze = "2025-04-15",
9494
candidate_freeze = "2025-05-15",
9595
snapshot = "2025-06-15",
96-
r = "4.4"
96+
r = "4.5"
9797
)
9898
}
9999
for (day in c(middle, last)) {
@@ -102,7 +102,7 @@ test_that("meta_snapshot() is correct", {
102102
dependency_freeze = "2025-07-15",
103103
candidate_freeze = "2025-08-15",
104104
snapshot = "2025-09-15",
105-
r = "4.4"
105+
r = "4.5"
106106
)
107107
}
108108
for (month in c("08", "09")) {
@@ -112,7 +112,7 @@ test_that("meta_snapshot() is correct", {
112112
dependency_freeze = "2025-07-15",
113113
candidate_freeze = "2025-08-15",
114114
snapshot = "2025-09-15",
115-
r = "4.4"
115+
r = "4.5"
116116
)
117117
}
118118
}
@@ -122,7 +122,7 @@ test_that("meta_snapshot() is correct", {
122122
dependency_freeze = "2025-07-15",
123123
candidate_freeze = "2025-08-15",
124124
snapshot = "2025-09-15",
125-
r = "4.4"
125+
r = "4.5"
126126
)
127127
}
128128
for (day in c(middle, last)) {
@@ -131,7 +131,7 @@ test_that("meta_snapshot() is correct", {
131131
dependency_freeze = "2025-10-15",
132132
candidate_freeze = "2025-11-15",
133133
snapshot = "2025-12-15",
134-
r = "4.4"
134+
r = "4.5"
135135
)
136136
}
137137
for (month in c("11", "12")) {
@@ -141,7 +141,7 @@ test_that("meta_snapshot() is correct", {
141141
dependency_freeze = "2025-10-15",
142142
candidate_freeze = "2025-11-15",
143143
snapshot = "2025-12-15",
144-
r = "4.4"
144+
r = "4.5"
145145
)
146146
}
147147
}

tests/testthat/test-rclone_includes.R

Lines changed: 20 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -33,27 +33,33 @@ test_that("rclone_includes()", {
3333
expect_equal(
3434
sort(include_packages),
3535
sort(
36-
c(
37-
"src/contrib/staged_2.0.5.tar.gz",
38-
"src/contrib/removed-no-issue_2.0.6.tar.gz",
39-
"bin/macosx/*/contrib/4.4/staged_2.0.5.tgz",
40-
"bin/macosx/*/contrib/4.4/removed-no-issue_2.0.6.tgz",
41-
"bin/windows/contrib/4.4/staged_2.0.5.zip",
42-
"bin/windows/contrib/4.4/removed-no-issue_2.0.6.zip"
36+
sprintf(
37+
c(
38+
"src/contrib/staged_2.0.5.tar.gz",
39+
"src/contrib/removed-no-issue_2.0.6.tar.gz",
40+
"bin/macosx/*/contrib/%s/staged_2.0.5.tgz",
41+
"bin/macosx/*/contrib/%s/removed-no-issue_2.0.6.tgz",
42+
"bin/windows/contrib/%s/staged_2.0.5.zip",
43+
"bin/windows/contrib/%s/removed-no-issue_2.0.6.zip"
44+
),
45+
meta_snapshot()$r
4346
)
4447
)
4548
)
4649
include_meta <- readLines(file_meta)
4750
expect_equal(
4851
sort(include_meta),
4952
sort(
50-
c(
51-
"src/contrib/PACKAGES",
52-
"src/contrib/PACKAGES.gz",
53-
"bin/macosx/*/contrib/4.4/PACKAGES",
54-
"bin/macosx/*/contrib/4.4/PACKAGES.gz",
55-
"bin/windows/contrib/4.4/PACKAGES",
56-
"bin/windows/contrib/4.4/PACKAGES.gz"
53+
sprintf(
54+
c(
55+
"src/contrib/PACKAGES",
56+
"src/contrib/PACKAGES.gz",
57+
"bin/macosx/*/contrib/%s/PACKAGES",
58+
"bin/macosx/*/contrib/%s/PACKAGES.gz",
59+
"bin/windows/contrib/%s/PACKAGES",
60+
"bin/windows/contrib/%s/PACKAGES.gz"
61+
),
62+
meta_snapshot()$r
5763
)
5864
)
5965
)

0 commit comments

Comments
 (0)