5.2 KiB
Executable File
Public API
patch
patch(ctx, patches, patch_cmds, patch_cmds_win, patch_tool, patch_args, auth, patch_directory)
Implementation of patching an already extracted repository.
This rule is intended to be used in the implementation function of
a repository rule. If the parameters patches
, patch_tool
,
patch_args
, patch_cmds
and patch_cmds_win
are not specified
then they are taken from ctx.attr
.
PARAMETERS
repo_utils.is_darwin
repo_utils.is_darwin(rctx)
Returns true if the host operating system is Darwin
PARAMETERS
Name | Description | Default Value |
---|---|---|
rctx | - |
none |
repo_utils.is_linux
repo_utils.is_linux(rctx)
Returns true if the host operating system is Linux
PARAMETERS
Name | Description | Default Value |
---|---|---|
rctx | - |
none |
repo_utils.is_windows
repo_utils.is_windows(rctx)
Returns true if the host operating system is Windows
PARAMETERS
Name | Description | Default Value |
---|---|---|
rctx | - |
none |
repo_utils.get_env_var
repo_utils.get_env_var(rctx, name, default)
Find an environment variable in system. Doesn't %-escape the value!
PARAMETERS
Name | Description | Default Value |
---|---|---|
rctx | rctx | none |
name | environment variable name | none |
default | default value to return if env var is not set in system | none |
RETURNS
The environment variable value or the default if it is not set
repo_utils.os
repo_utils.os(rctx)
Returns the name of the host operating system
PARAMETERS
Name | Description | Default Value |
---|---|---|
rctx | rctx | none |
RETURNS
The string "windows", "linux" or "darwin" that describes the host os
repo_utils.platform
repo_utils.platform(rctx)
Returns a normalized name of the host os and CPU architecture.
Alias archictures names are normalized:
x86_64 => amd64 aarch64 => arm64
The result can be used to generate repository names for host toolchain repositories for toolchains that use these normalized names.
Common os & architecture pairs that are returned are,
- darwin_amd64
- darwin_arm64
- linux_amd64
- linux_arm64
- linux_s390x
- linux_ppc64le
- windows_amd64
PARAMETERS
Name | Description | Default Value |
---|---|---|
rctx | rctx | none |
RETURNS
The normalized "_" string of the host os and CPU architecture.