Skip to content

Commit 086624a

Browse files
authored
fix(tar): expose package_dir argument in mtree_mutate (#873)
This was likely forgotten in #829 when making the parameters explicit during review.
1 parent 90d1878 commit 086624a

File tree

4 files changed

+11
-5
lines changed

4 files changed

+11
-5
lines changed

docs/tar.md

+2-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

lib/tar.bzl

+4
Original file line numberDiff line numberDiff line change
@@ -130,6 +130,7 @@ def mtree_mutate(
130130
name,
131131
mtree,
132132
strip_prefix = None,
133+
package_dir = None,
133134
mtime = None,
134135
owner = None,
135136
ownername = None,
@@ -141,6 +142,7 @@ def mtree_mutate(
141142
name: name of the target, output will be `[name].mtree`.
142143
mtree: input mtree file, typically created by `mtree_spec`.
143144
strip_prefix: prefix to remove from all paths in the tar. Files and directories not under this prefix are dropped.
145+
package_dir: directory prefix to add to all paths in the tar.
144146
mtime: new modification time for all entries.
145147
owner: new uid for all entries.
146148
ownername: new uname for all entries.
@@ -150,6 +152,8 @@ def mtree_mutate(
150152
vars = []
151153
if strip_prefix:
152154
vars.append("-v strip_prefix='{}'".format(strip_prefix))
155+
if package_dir:
156+
vars.append("-v package_dir='{}'".format(package_dir))
153157
if mtime:
154158
vars.append("-v mtime='{}'".format(mtime))
155159
if owner:

lib/tests/tar/BUILD.bazel

+1
Original file line numberDiff line numberDiff line change
@@ -337,6 +337,7 @@ mtree_mutate(
337337
name = "modified1",
338338
mtree = "source-casync.mtree",
339339
strip_prefix = "xattr",
340+
package_dir = "test",
340341
)
341342

342343
diff_test(

lib/tests/tar/expected1.mtree

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
xattr.go type=file mode=0664 size=984 uid=1000 gid=1000 uname=vbatts gname=vbatts time=1512774394.470900767 sha512256digest=a2700b603df30c3b0a91bdcf9045e64aea42f62647b0128ea154f51a0c48991e
2-
xattr_test.go type=file mode=0664 size=859 uid=1000 gid=1000 uname=vbatts gname=vbatts time=1512774394.470900767 sha512256digest=91294ea554801b75f6a9e33c268807c9620b531eb813ea24512dd4eeaf0592e4
3-
xattr_unsupported.go type=file mode=0664 size=509 uid=1000 gid=1000 uname=vbatts gname=vbatts time=1512774394.470900767 sha512256digest=81ced06a1cdf88c4936d10bbf8d46edc2d42dc26efeed3691ddbeeb469865f8a
4-
xattr_unsupported_test.go type=file mode=0664 size=877 uid=1000 gid=1000 uname=vbatts gname=vbatts time=1512774394.470900767 sha512256digest=46605a03a985c7a3a4ab1a488f81382db4865f77b90b6a2b32693af39a8e1fba
1+
test/xattr.go type=file mode=0664 size=984 uid=1000 gid=1000 uname=vbatts gname=vbatts time=1512774394.470900767 sha512256digest=a2700b603df30c3b0a91bdcf9045e64aea42f62647b0128ea154f51a0c48991e
2+
test/xattr_test.go type=file mode=0664 size=859 uid=1000 gid=1000 uname=vbatts gname=vbatts time=1512774394.470900767 sha512256digest=91294ea554801b75f6a9e33c268807c9620b531eb813ea24512dd4eeaf0592e4
3+
test/xattr_unsupported.go type=file mode=0664 size=509 uid=1000 gid=1000 uname=vbatts gname=vbatts time=1512774394.470900767 sha512256digest=81ced06a1cdf88c4936d10bbf8d46edc2d42dc26efeed3691ddbeeb469865f8a
4+
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 commit comments

Comments
 (0)