1616# A copy of the GNU General Public License is available at
1717# https://www.R-project.org/Licenses/
1818
19+ # # from R 4.6.0 on are 4 possible types:
20+ # # "source" - .tar.gz, source
21+ # # "mac.binary" - .tgz, macOS binary
22+ # # "win.binary" - .zip, Windows binary
23+ # # "other.binary" - .tar.(bz2|xz|zstd) custom binary
24+ # # In the long run the plan is to replace all with custom binaries
25+ # # since they cover all OSes and will allow us to remove special cases.
26+ .pkg.type <- function (type ) {
27+ if (grepl(" .binary" , type , fixed = TRUE )) {
28+ # # strip build name
29+ type <- gsub(" ^([[:lower:]]+[.]binary)[.].*" , " \\ 1" , type )
30+ # # at this point we only care about win, mac or other
31+ if (! type %in% c(" win.binary" , " mac.binary" ))
32+ type <- " other.binary"
33+ } else " source"
34+ }
35+
1936write_PACKAGES <-
2037function (dir = " ." , fields = NULL , type ,
2138 verbose = FALSE , unpacked = FALSE , subdirs = FALSE ,
@@ -32,11 +49,7 @@ function(dir = ".", fields = NULL, type,
3249 type <- .Platform $ pkgType
3350 }
3451 if (grepl(" .binary" , type , fixed = TRUE )) {
35- # # strip build name
36- type <- gsub(" ^([[:lower:]]+[.]binary)[.].*" , " \\ 1" , type )
37- # # at this point we only care about win, mac or other
38- if (! type %in% c(" win.binary" , " mac.binary" ))
39- type <- " other.binary"
52+ type <- .pkg.type(type )
4053 } else {
4154 # # for compatibility with R < 4.6.0 we handle partial matching
4255 # # of c("source", "win.binary", "mac.binary") as it was using match.arg
0 commit comments