-
Notifications
You must be signed in to change notification settings - Fork 86
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add zstd support to tar() and untar()
Other tar-related updates. git-svn-id: https://svn.r-project.org/R/trunk@87605 00db46b3-68df-0310-9c12-caf00c1e9a41
- Loading branch information
ripley
committed
Jan 20, 2025
1 parent
e539753
commit 18683f9
Showing
6 changed files
with
140 additions
and
54 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
### tests of compressiin on un(tar) | ||
|
||
options(warn = 1) | ||
old <- getwd() | ||
|
||
for(f in c("none", "gzip", "bzip2", "xz", "zstd")) | ||
{ | ||
setwd(R.home('library')) | ||
z <- if (f=="none") "utils.tar" else paste0("utils.tar.", f) | ||
zz <- file.path(old, z) | ||
message("making ", z) | ||
## zstd support is optional | ||
y <- try(tar(zz, "utils", f)) | ||
if(inherits(y, "try-error")) next | ||
print(file.size(zz)) | ||
setwd(old) | ||
print(head(untar(zz, list = TRUE, tar = "internal"))) | ||
untar(zz, tar = "internal") | ||
} | ||
|
||
## Now try external untar | ||
for(f in c("none", "gzip", "bzip2", "xz", "zstd")) | ||
{ | ||
z <- if (f=="none") "utils.tar" else paste0("utils.tar.", f) | ||
if (!file.exists(z)) next | ||
message("unpacking ", z) | ||
y <- untar(z) | ||
if(inherits(y, "try-error")) next | ||
print(head(dir("utils"), 5)) | ||
} | ||
|
||
## and external tar | ||
TAR <- Sys.getenv("TAR", "tar") | ||
for(f in c("none", "gzip", "bzip2", "xz", "zstd")) | ||
{ | ||
setwd(R.home('library')) | ||
z <- if (f=="none") "utils.tar" else paste0("utils.tar.", f) | ||
zz <- file.path(old, z) | ||
message("making ", z) | ||
y <- try(tar(zz, "utils", f, tar = TAR)) | ||
if(inherits(y, "try-error")) next | ||
print(file.size(zz)) | ||
setwd(old) | ||
} | ||
|
||
unlink("utils", recursive = TRUE) | ||
|