@bazel_tools//tools/build_defs/repo:utils.bzl.
// Generated with Stardoc: http://skydoc.bazel.build
Utils for manipulating external repositories, once fetched.
Setup
These utilities are intended to be used by other repository rules. They can be loaded as follows.download_remote_files
remote_file_urls and
remote_file_integrity to be present in ctx.attr.
Existing files will be overwritten.
Parameters
ctx | required. The repository context of the repository rule calling this utility function. |
auth | optional.
default is NoneAn optional dict specifying authentication information for some of the URLs. |
Returns
dict mapping file paths to a download info.get_auth
Parameters
ctx | required. The repository context of the repository rule calling this utility function. |
urls | required. the list of urls to read |
Returns
the auth dict which can be passed to repository_ctx.downloadmaybe
Parameters
repo_rule | required. repository rule function. |
name | required. name of the repository to create. |
kwargs | optional. remaining arguments that are passed to the repo_rule function. |
Returns
Nothing, defines the repository when needed as a side-effect.parse_netrc
Parameters
contents | required. input for the parser. |
filename | optional.
default is “a .netrc file”filename to use in error messages, if any. |
Returns
dict mapping a machine names to a dict with the information provided about thempatch
patches, patch_tool,
patch_args, patch_cmds and patch_cmds_win are not specified
then they are taken from ctx.attr.
Parameters
ctx | required. The repository context of the repository rule calling this utility function. |
patches | optional.
default is NoneThe patch files to apply. List of strings, Labels, or paths. |
patch_cmds | optional.
default is NoneBash commands to run for patching, passed one at a time to bash -c. List of strings |
patch_cmds_win | optional.
default is NonePowershell commands to run for patching, passed one at a time to powershell /c. List of strings. If the boolean value of this parameter is false, patch_cmds will be used and this parameter will be ignored. |
patch_tool | optional.
default is NonePath of the patch tool to execute for applying patches. String. |
patch_args | optional.
default is NoneArguments to pass to the patch tool. List of strings. |
auth | optional.
default is NoneAn optional dict specifying authentication information for some of the URLs. |
Returns
dict mapping remote patch URLs to a download info.read_netrc
Parameters
ctx | required. The repository context of the repository rule calling this utility function. |
filename | required. the name of the .netrc file to read |
Returns
dict mapping a machine names to a dict with the information provided about themread_user_netrc
Parameters
ctx | required. The repository context of the repository rule calling this utility function. |
Returns
dict mapping a machine names to a dict with the information provided about them.symlink_files
files is present in ctx.attr.
Existing files will be overwritten.
Parameters
ctx | required. The repository context of the repository rule calling this utility function. |
update_attrs
Parameters
orig | required. dict of actually set attributes (either explicitly or implicitly) by a particular rule invocation |
keys | required. complete set of attributes defined on this rule |
override | required. dict of attributes to override or add to orig |
Returns
dict of attributes with the keys from override inserted/updateduse_netrc
Parameters
netrc | required. a netrc file already parsed to a dict, e.g., as obtained from read_netrc |
urls | required. a list of URLs. |
patterns | required. optional dict of url to authorization patterns |
Returns
dict suitable as auth argument for ctx.download; more precisely, the dict will map all URLs where the netrc file provides login and password to a dict containing the corresponding login, password and optional authorization pattern, as well as the mapping of “type” to “basic” or “pattern”.workspace_and_buildfile
name, build_file, and build_file_content to
be present in ctx.attr; the latter two possibly with value None.
Parameters
ctx | required. The repository context of the repository rule calling this utility function. |