Skip to content

Commit

Permalink
fix(tar): expose package_dir argument in mtree_mutate (#873)
Browse files Browse the repository at this point in the history
This was likely forgotten in #829 when making the parameters explicit
during review.
  • Loading branch information
gzm0 authored Jul 2, 2024
1 parent 90d1878 commit 086624a
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 5 deletions.
3 changes: 2 additions & 1 deletion docs/tar.md

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

4 changes: 4 additions & 0 deletions lib/tar.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,7 @@ def mtree_mutate(
name,
mtree,
strip_prefix = None,
package_dir = None,
mtime = None,
owner = None,
ownername = None,
Expand All @@ -141,6 +142,7 @@ def mtree_mutate(
name: name of the target, output will be `[name].mtree`.
mtree: input mtree file, typically created by `mtree_spec`.
strip_prefix: prefix to remove from all paths in the tar. Files and directories not under this prefix are dropped.
package_dir: directory prefix to add to all paths in the tar.
mtime: new modification time for all entries.
owner: new uid for all entries.
ownername: new uname for all entries.
Expand All @@ -150,6 +152,8 @@ def mtree_mutate(
vars = []
if strip_prefix:
vars.append("-v strip_prefix='{}'".format(strip_prefix))
if package_dir:
vars.append("-v package_dir='{}'".format(package_dir))
if mtime:
vars.append("-v mtime='{}'".format(mtime))
if owner:
Expand Down
1 change: 1 addition & 0 deletions lib/tests/tar/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -337,6 +337,7 @@ mtree_mutate(
name = "modified1",
mtree = "source-casync.mtree",
strip_prefix = "xattr",
package_dir = "test",
)

diff_test(
Expand Down
8 changes: 4 additions & 4 deletions lib/tests/tar/expected1.mtree
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
xattr.go type=file mode=0664 size=984 uid=1000 gid=1000 uname=vbatts gname=vbatts time=1512774394.470900767 sha512256digest=a2700b603df30c3b0a91bdcf9045e64aea42f62647b0128ea154f51a0c48991e
xattr_test.go type=file mode=0664 size=859 uid=1000 gid=1000 uname=vbatts gname=vbatts time=1512774394.470900767 sha512256digest=91294ea554801b75f6a9e33c268807c9620b531eb813ea24512dd4eeaf0592e4
xattr_unsupported.go type=file mode=0664 size=509 uid=1000 gid=1000 uname=vbatts gname=vbatts time=1512774394.470900767 sha512256digest=81ced06a1cdf88c4936d10bbf8d46edc2d42dc26efeed3691ddbeeb469865f8a
xattr_unsupported_test.go type=file mode=0664 size=877 uid=1000 gid=1000 uname=vbatts gname=vbatts time=1512774394.470900767 sha512256digest=46605a03a985c7a3a4ab1a488f81382db4865f77b90b6a2b32693af39a8e1fba
test/xattr.go type=file mode=0664 size=984 uid=1000 gid=1000 uname=vbatts gname=vbatts time=1512774394.470900767 sha512256digest=a2700b603df30c3b0a91bdcf9045e64aea42f62647b0128ea154f51a0c48991e
test/xattr_test.go type=file mode=0664 size=859 uid=1000 gid=1000 uname=vbatts gname=vbatts time=1512774394.470900767 sha512256digest=91294ea554801b75f6a9e33c268807c9620b531eb813ea24512dd4eeaf0592e4
test/xattr_unsupported.go type=file mode=0664 size=509 uid=1000 gid=1000 uname=vbatts gname=vbatts time=1512774394.470900767 sha512256digest=81ced06a1cdf88c4936d10bbf8d46edc2d42dc26efeed3691ddbeeb469865f8a
test/xattr_unsupported_test.go type=file mode=0664 size=877 uid=1000 gid=1000 uname=vbatts gname=vbatts time=1512774394.470900767 sha512256digest=46605a03a985c7a3a4ab1a488f81382db4865f77b90b6a2b32693af39a8e1fba

0 comments on commit 086624a

Please sign in to comment.