Skip to main content

Documentation Index

Fetch the complete documentation index at: https://docs.aspect.build/llms.txt

Use this file to discover all available pages before exploring further.

Documentation for @tar.bzl@v0.8.1 View source
Helpers for mtree(8), see https://man.freebsd.org/cgi/man.cgi?mtree(8)

Mutating the tar contents

The mtree_spec rule can be used to create an mtree manifest for the tar file. Then you can mutate that spec using mtree_mutate and feed the result as the mtree attribute of the tar rule. For example, to set the owner uid of files in the tar, you could:
_TAR_SRCS = ["//some:files"]

mtree_spec(
    name = "mtree",
    srcs = _TAR_SRCS,
)

mtree_mutate(
    name = "change_owner",
    mtree = ":mtree",
    owner = "1000",
)

tar(
    name = "tar",
    srcs = _TAR_SRCS,
    mtree = "change_owner",
)

Rule: mtree_spec

Create an mtree specification to map a directory hierarchy. See https://man.freebsd.org/cgi/man.cgi?mtree(8)

Attributes

name
name
required
A unique name for this target.
srcs
list of labels
default:"[]"
Files that are placed into the tar
out
label
default:"None"
Resulting specification file to write
include_runfiles
boolean
default:"True"
Include the runfiles tree in the resulting mtree for targets that are executable.The runfiles are in the paths that Bazel uses. For example, for the target //my_prog:foo, we would see files under paths like foo.runfiles/<repo name>/my_prog/<file>

Function: mtree_mutate

Modify metadata in an mtree file.

Parameters

name
name
required
name of the target, output will be [name].mtree.
mtree
name
required
input mtree file, typically created by mtree_spec.
srcs
name
default:"None"
list of files to resolve symlinks for.
EXPERIMENTAL! We may remove or change it at any point without further notice. Flag to determine whether to preserve symlinks in the tar.
strip_prefix
name
default:"None"
prefix to remove from all paths in the tar. Files and directories not under this prefix are dropped.
package_dir
name
default:"None"
directory prefix to add to all paths in the tar.
mtime
name
default:"None"
new modification time for all entries.
owner
name
default:"None"
new uid for all entries.
ownername
name
default:"None"
new uname for all entries.
awk_script
name
default:"Label(\"//tar/private:modify_mtree.awk\")"
may be overridden to change the script containing the modification logic.
kwargs
string_list
additional named parameters to genrule

Function: mutate

Factory function to make a partially-applied mtree_mutate rule.

Parameters

kwargs
string_list