Skip to content

Commit

Permalink
Added x86_64 with working test. (#139)
Browse files Browse the repository at this point in the history
* Added x86_64 with working test.

* Added x86_64 with working test.
  • Loading branch information
arnejohannesholmin authored May 12, 2023
1 parent 7db7900 commit 8c1194c
Show file tree
Hide file tree
Showing 9 changed files with 71 additions and 23 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,4 @@ testpackages/
#*.tar.gz
docs-src/docs
docs/mkdmt-src/docs
.DS_Store
16 changes: 10 additions & 6 deletions R/archivePackages.R
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@

DRAT_ARCHIVE_SUB_DIR <- "Archive"

DRAT_BINARY_TYPES <- c("mac.binary", "mac.binary.big-sur-arm64", "mac.binary.el-capitan",
"mac.binary.mavericks", "win.binary")
DRAT_BOTH_TYPES <- c("source", "mac.binary", "mac.binary.big-sur-arm64", "mac.binary.el-capitan",
DRAT_BINARY_TYPES <- c("mac.binary", "mac.binary.big-sur-x86_64", "mac.binary.big-sur-arm64",
"mac.binary.el-capitan", "mac.binary.mavericks", "win.binary")
DRAT_BOTH_TYPES <- c("source", "mac.binary", "mac.binary.big-sur-x86_64",
"mac.binary.big-sur-arm64", "mac.binary.el-capitan",
"mac.binary.mavericks", "win.binary")

DRAT_VERSION_REGEX <- "[0-9]\\.[0-9]$"
Expand All @@ -17,7 +18,7 @@ DRAT_CONTRIB_VERSION_REGEX <- paste0("contrib/",DRAT_VERSION_REGEX)
}

.norm_type <- function(type){
type <- match.arg(type,c("source", "binary", "mac.binary", "mac.binary.big-sur-arm64", "mac.binary.el-capitan",
type <- match.arg(type,c("source", "binary", "mac.binary", "mac.binary.big-sur-x86_64", "mac.binary.big-sur-arm64", "mac.binary.el-capitan",
"mac.binary.mavericks", "win.binary", "both"),
several.ok = TRUE)
if("both" %in% type){
Expand Down Expand Up @@ -58,6 +59,7 @@ DRAT_CONTRIB_VERSION_REGEX <- paste0("contrib/",DRAT_VERSION_REGEX)
##' \dQuote{"~/git/drat"} as fallback
##' @param type Character variable for the type of repository, so far
##' \dQuote{source}, \dQuote{binary}, \dQuote{win.binary}, \dQuote{mac.binary},
##' \dQuote{mac.binary.big-sur-x86_64},
##' \dQuote{mac.binary.big-sur-arm64},
##' \dQuote{mac.binary.mavericks}, \dQuote{mac.binary.el-capitan} or
##' \dQuote{both}
Expand All @@ -79,7 +81,8 @@ NULL

##' @rdname archivePackages
archivePackages <- function(repopath = getOption("dratRepo", "~/git/drat"),
type = c("source", "binary", "mac.binary", "mac.binary.big-sur-arm64", "mac.binary.el-capitan",
type = c("source", "binary", "mac.binary", "mac.binary.big-sur-x86_64",
"mac.binary.big-sur-arm64", "mac.binary.el-capitan",
"mac.binary.mavericks", "win.binary", "both"),
pkg,
version = getRversion()) {
Expand Down Expand Up @@ -140,7 +143,8 @@ archivePackages <- function(repopath = getOption("dratRepo", "~/git/drat"),

##' @rdname archivePackages
archivePackagesForAllRversions <- function(repopath = getOption("dratRepo", "~/git/drat"),
type = c("source", "binary", "mac.binary", "mac.binary.big-sur-arm64", "mac.binary.el-capitan",
type = c("source", "binary", "mac.binary", "mac.binary.big-sur-x86_64",
"mac.binary.big-sur-arm64", "mac.binary.el-capitan",
"mac.binary.mavericks", "win.binary", "both"),
pkg){
archivePackages(repopath = repopath, type = type, pkg = pkg, version = NA)
Expand Down
3 changes: 2 additions & 1 deletion R/insertPackage.R
Original file line number Diff line number Diff line change
Expand Up @@ -256,7 +256,7 @@ identifyPackageType <- function(file, pkginfo = getPackageInfo(file)) {
# ARM Mac for R >= 4.1
ret <- "binary"
}
} else if(pkginfo["osxFolder"] %in% c("mavericks","el-capitan","big-sur-arm64")) {
} else if(pkginfo["osxFolder"] %in% c("mavericks","el-capitan","big-sur-x86_64","big-sur-arm64")) {
ret <- paste0(ret,".",pkginfo["osxFolder"])
} else {
stop("mac.binary subtype couldn't be determined. This shouldn't ",
Expand Down Expand Up @@ -311,6 +311,7 @@ getPackageInfo <- function(file) {
osxFolder <- switch(fields["OSflavour"],
"x86_64-apple-darwin13.4.0" = "mavericks",
"x86_64-apple-darwin15.6.0" = "el-capitan",
"x86_64-apple-darwin20" = "big-sur-x86_64",
"aarch64-apple-darwin20" = "big-sur-arm64",
"")

Expand Down
13 changes: 9 additions & 4 deletions R/pruneRepo.R
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
##' @param type Character variable for the type of repository, so far
##' \dQuote{source}, \dQuote{binary}, \dQuote{win.binary}, \dQuote{mac.binary},
##' \dQuote{mac.binary.mavericks}, \dQuote{mac.binary.el-capitan},
##' \dQuote{mac.binary.big-sur-x86_64}, or \dQuote{both}
##' \dQuote{mac.binary.big-sur-arm64}, or \dQuote{both}
##' @param pkg Optional character variable specifying a package name,
##' whose older versions should be pruned. If missing (the
Expand Down Expand Up @@ -54,7 +55,8 @@
##' be removed.
##' @author Dirk Eddelbuettel
getRepoInfo <- function(repopath = getOption("dratRepo", "~/git/drat"),
type = c("source", "binary", "mac.binary", "mac.binary.big-sur-arm64", "mac.binary.el-capitan",
type = c("source", "binary", "mac.binary", "mac.binary.big-sur-x86_64",
"mac.binary.big-sur-arm64", "mac.binary.el-capitan",
"mac.binary.mavericks", "win.binary", "both"),
pkg,
version = getRversion(),
Expand Down Expand Up @@ -156,7 +158,8 @@ getRepoInfo <- function(repopath = getOption("dratRepo", "~/git/drat"),

##' @rdname pruneRepo
pruneRepo <- function(repopath = getOption("dratRepo", "~/git/drat"),
type = c("source", "binary", "mac.binary", "mac.binary.big-sur-arm64", "mac.binary.el-capitan",
type = c("source", "binary", "mac.binary", "mac.binary.big-sur-x86_64",
"mac.binary.big-sur-arm64", "mac.binary.el-capitan",
"mac.binary.mavericks", "win.binary", "both"),
pkg,
version = getRversion(),
Expand Down Expand Up @@ -201,7 +204,8 @@ pruneRepo <- function(repopath = getOption("dratRepo", "~/git/drat"),

##' @rdname pruneRepo
pruneRepoForAllRversions <- function(repopath = getOption("dratRepo", "~/git/drat"),
type = c("source", "mac.binary", "mac.binary.big-sur-arm64", "mac.binary.el-capitan",
type = c("source", "mac.binary", "mac.binary.big-sur-x86_64",
"mac.binary.big-sur-arm64", "mac.binary.el-capitan",
"mac.binary.mavericks", "win.binary", "both"),
pkg,
remove = FALSE){
Expand All @@ -211,7 +215,8 @@ pruneRepoForAllRversions <- function(repopath = getOption("dratRepo", "~/git/dra

##' @rdname pruneRepo
updateRepo <- function(repopath = getOption("dratRepo", "~/git/drat"),
type = c("source", "mac.binary", "mac.binary.big-sur-arm64", "mac.binary.el-capitan",
type = c("source", "mac.binary", "mac.binary.big-sur-x86_64",
"mac.binary.big-sur-arm64", "mac.binary.el-capitan",
"mac.binary.mavericks", "win.binary", "both"),
version = NA,
... ){
Expand Down
Binary file added inst/extdata/big-sur-x86_64/bin/4.3/bar_1.1.tgz
Binary file not shown.
Binary file added inst/extdata/src/bar_1.1.tar.gz
Binary file not shown.
11 changes: 7 additions & 4 deletions man/archivePackages.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

18 changes: 10 additions & 8 deletions man/pruneRepo.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

32 changes: 32 additions & 0 deletions tests/testBig-sur-x86_64Binary.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@

isIntelMac <- .Platform$pkgType == "mac.binary.big-sur-x86_64"
isRVersion4.3 <- getRversion() == "4.3.0"
options("dratBranch" = "docs")

repodir <- tempdir()
docsdir <- file.path(repodir, "docs")
if (!dir.exists(docsdir)) dir.create(docsdir)
cat("<!doctype html><title>empty</title>", file=file.path(docsdir, "index.html"))

isWindows <- Sys.info()[["sysname"]] == "Windows"

if (!isWindows) { # this is the default case of a source package
pkg <- system.file("extdata", "src", "bar_1.1.tar.gz", package="drat")
drat::insertPackage(file = pkg, repodir = repodir)

avpkg <- available.packages(repos=file.path("file:", docsdir))

good <- avpkg[1,1] == "bar" && avpkg[1,2] == "1.1"
if (!good) stop("Package round-turn failed for big-sur-x86_64 source package")
}



if (isIntelMac && isRVersion4.3) {
pkg <- system.file("extdata", "big-sur-x86_64", "bin", "4.3", "bar_1.1.tgz", package="drat")
drat::insertPackage(file = pkg, repodir = repodir, action = "prune")
avpkg <- available.packages(repos=file.path("file:", docsdir))

good <- avpkg[1,1] == "bar" && avpkg[1,2] == "1.1"
if (!good) stop("Package round-turn failed for big-sur-x86_64 binary package")
}

0 comments on commit 8c1194c

Please sign in to comment.