-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Set locale environment variables in build environment
Cherry-pick of 2b87527 for 0.5 I selected C.UTF-8 as a somewhat neutral default that is likely to be available in many environments. The user can always override it in their target configuration. Also corrected the non-POSIX-compliant `TZ` value from `UTC` to `UTC0`. I added a small companion document to specify the build environment and what guarantees we provide going forward. [Fixes ch3824]
- Loading branch information
Showing
5 changed files
with
177 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
# Build Environment Reference | ||
|
||
**WIP specification. This information should eventually live in end-user | ||
reference documentation.** | ||
|
||
The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", "SHOULD", | ||
"SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this document are to be | ||
interpreted as described in [RFC 2119][]. | ||
|
||
[RFC 2119]: https://tools.ietf.org/html/rfc2119 | ||
|
||
## Environment Variables | ||
|
||
Each target **SHALL** run in a separate, isolated environment. For example, | ||
a target may run in a Docker container or a chroot jail. A target _MAY_ run on | ||
a different host from the build runner. At a minimum, the following environment | ||
variables **MUST** be set for commands running in POSIX environments: | ||
|
||
- `HOME` **MUST** be set to the path of an readable and writable directory. | ||
This _SHOULD NOT_ be the same as the user's actual `HOME` directory to | ||
keep builds reproducible. | ||
- `LOGNAME` and `USER` **MUST** be set to the name of the POSIX user running | ||
the command (not the runner of `yb`). | ||
- `PATH` **MUST NOT** be empty. | ||
- `TZ` **MUST** be set to `UTC0`. | ||
- `LANG` _SHOULD_ be set to `C.UTF-8` if the environment supports it. | ||
Otherwise, `LANG` **MUST** be set to `C`. | ||
- One of `LC_ALL` or `LC_CTYPE` **MUST** be set to C-like locale category | ||
whose `charmap` is UTF-8. If `LC_CTYPE` is set, `LC_ALL` **MUST NOT** be set. | ||
|
||
### Examples of Locale Settings | ||
|
||
For Linux systems: | ||
|
||
``` | ||
LANG=C.UTF-8 | ||
LC_ALL=C.UTF-8 | ||
``` | ||
|
||
For macOS systems: | ||
|
||
``` | ||
LANG=C | ||
LC_CTYPE=UTF-8 | ||
``` | ||
|
||
### Further Reading | ||
|
||
- [POSIX.1-2017 Environment Variables](https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap08.html) | ||
describes the meaning of the standard environment variables. | ||
- [PEP 538](https://www.python.org/dev/peps/pep-0538/) documents Python's | ||
process for bootstrapping a UTF-8 locale with rationale and platform-specific | ||
caveats. | ||
|
||
## Expected Userspace | ||
|
||
The build environment that a target's commands run in **MUST** include the | ||
standard [POSIX utilities][]. yb also depends on the following utilities being | ||
available: | ||
|
||
- `python` on non-Linux to fill in `readlink --canonicalize-existing` behavior | ||
- `readlink` on Linux | ||
- `tar` | ||
- `unzip` | ||
|
||
[POSIX utilities]: https://pubs.opengroup.org/onlinepubs/9699919799/idx/utilities.html |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters