Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for .tbz file extension in repository_ctx.download_and_extract #17825

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -102,15 +102,15 @@ static Decompressor getDecompressor(Path archivePath) throws RepositoryFunctionE
return TarXzFunction.INSTANCE;
} else if (baseName.endsWith(".tar.zst") || baseName.endsWith(".tzst")) {
return TarZstFunction.INSTANCE;
} else if (baseName.endsWith(".tar.bz2")) {
} else if (baseName.endsWith(".tar.bz2") || baseName.endsWith(".tbz")) {
return TarBz2Function.INSTANCE;
} else if (baseName.endsWith(".ar") || baseName.endsWith(".deb")) {
return ArFunction.INSTANCE;
} else {
throw new RepositoryFunctionException(
Starlark.errorf(
"Expected a file with a .zip, .jar, .war, .aar, .tar, .tar.gz, .tgz, .tar.xz, .txz,"
+ " .tar.zst, .tzst, .tar.bz2, .ar or .deb suffix (got %s)",
+ " .tar.zst, .tzst, .tar.bz2, .tbz, .ar or .deb suffix (got %s)",
archivePath),
Transience.PERSISTENT);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -569,7 +569,7 @@ public StructImpl download(
+ " the URL."
+ " If the file has no extension, you can explicitly specify either \"zip\","
+ " \"jar\", \"war\", \"aar\", \"tar\", \"tar.gz\", \"tgz\", \"tar.xz\","
+ " \"txz\", \".tar.zst\", \".tzst\", \"tar.bz2\", \".ar\", or \".deb\""
+ " \"txz\", \".tar.zst\", \".tzst\", \"tar.bz2\", \".tbz\", \".ar\", or \".deb\""
+ " here."),
@Param(
name = "stripPrefix",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,8 @@ public void testKnownFileExtensionsDoNotThrow() throws Exception {
unused = DecompressorValue.getDecompressor(path);
path = fs.getPath("/foo/.external-repositories/some-repo/bar.baz.tar.bz2");
unused = DecompressorValue.getDecompressor(path);
path = fs.getPath("/foo/.external-repositories/some-repo/bar.baz.tbz");
unused = DecompressorValue.getDecompressor(path);
path = fs.getPath("/foo/.external-repositories/some-repo/bar.baz.ar");
unused = DecompressorValue.getDecompressor(path);
path = fs.getPath("/foo/.external-repositories/some-repo/bar.baz.deb");
Expand Down