mirror of
https://github.com/bazel-contrib/bazel-lib
synced 2024-12-01 07:15:24 +00:00
a283a8216d
* feat: add a BSD tar toolchain @thesayyn discovered that it has a feature which should make it a drop-in replacement for pkg_tar including fine-grained file permissions and symlinks: https://man.freebsd.org/cgi/man.cgi?mtree(8) * show example of mtree usage * feat: introduce tar rule * cleanup and get test passing * more cleanup * chore: add support for compress flags * chore: add docs * chore: add docs * feat: implement linux bsdtar toolchain (#566) * chore: improve target naming * WIP: args * feat: generate mtree spec Also allow arbitrary args * refactor: mtree is required * refactor: style nits * fix: support mix of source and generated artifacts * feat: demonstrate strip_prefix * chore: regen docs * fix: make host toolchain a fallback toolchain * fix: include libarchive13.so when installing BSD tar * chore: buildifier * fix: aarch64 cpu constraint * fix(ci): include libarchive13.so when running tar * chore: add libnettle * refactor: inputs mutated less * refactor: remove unneeded substitution arg * refactor: don't advertise unsupported modes * fix: hack enough to make it run on my machine * chore: dynamic libraries included in sh_binary under toolchain * make sh_binary work * refactor: drop arm64 for now * fix toolchain * fix test * chore: improve test naming scheme --------- Co-authored-by: Sahin Yort <thesayyn@gmail.com>
30 lines
838 B
Python
30 lines
838 B
Python
"Make shorter assertions"
|
|
|
|
load("@bazel_skylib//rules:diff_test.bzl", "diff_test")
|
|
load("@bazel_skylib//rules:write_file.bzl", "write_file")
|
|
|
|
# buildifier: disable=function-docstring
|
|
def assert_tar_listing(name, actual, expected):
|
|
actual_listing = "_{}_listing".format(name)
|
|
expected_listing = "_{}_expected".format(name)
|
|
|
|
native.genrule(
|
|
name = actual_listing,
|
|
srcs = [actual],
|
|
outs = ["_{}.listing".format(name)],
|
|
cmd = "$(BSDTAR_BIN) -tvf $(execpath {}) >$@".format(actual),
|
|
toolchains = ["@bsd_tar_toolchains//:resolved_toolchain"],
|
|
)
|
|
|
|
write_file(
|
|
name = expected_listing,
|
|
out = "_{}.expected".format(name),
|
|
content = expected + [""],
|
|
)
|
|
|
|
diff_test(
|
|
name = name,
|
|
file1 = actual_listing,
|
|
file2 = expected_listing,
|
|
)
|