Looks up License strings from DESCRIPTION files in a table precomputed
from R's own license analysis (tools::analyze_license() and R's license
database). An expression is returned only when every alternative maps to
SPDX, no alternative is file LICENSE alone, and every + file LICENSE
is attached to a license that R's license database marks extensible: MIT,
BSD, GPL-3, LGPL-3, AGPL-3 and the CC BY 4.0 family. So
GPL-3 + file LICENSE becomes GPL-3.0-only, while
GPL-2 + file LICENSE has no expression. R expands version ranges, so
GPL (>= 2) becomes GPL-2.0-only OR GPL-3.0-only.
Examples
license_spdx(c("MIT + file LICENSE", "GPL (>= 2)", "file LICENSE"))
#> [1] "MIT" "GPL-2.0-only OR GPL-3.0-only"
#> [3] NA