This directory contains files required to build a build system.
Only linux-x86_64 is supported for bootstrapping. Note that the build process consumes some 100Gb of disk space and takes over 1 hour to complete depending on the machine used.
mkdir $HOME/tr_ya_bootstrap
# or docker
sudo podman build --network=host -f tr.Dockerfile --tag tr_ya_bootstrap
sudo podman run --name tr_ya_bootstrap_container --network=host --mount type=bind,source=$HOME/tr_ya_bootstrap,target=/result tr_ya_bootstrapAfter the process is successfully complete you will see ya-bin, ymake and other tools in ~/tr_ya_bootstrap.
Note that they will be owned by root if you run podman in rootful mode.
You can then do a clean up
sudo podman container rm tr_ya_bootstrap_container
sudo podman image rm tr_ya_bootstrapFor successful build it is required to have docker or podman and python3.9+ installed in system.
Bootstrap is launched with run_bootstrap.py script
It has several flags, as follows:
--source-root-- Path to the repository root. Required--result-root-- Path to the directory, where results should be put. Required--all-platforms-build-- This flag will also launch the second stage of bootstrap.--cleanup-- Remove all containers and images created by this image.
Before running the script checkout to the commit when the graph was last updated. Blame a line with URL variable in run_bootstrap.py to find out.
Bootstrap can be described in two stages
This stage's execution results in ya and ymake for linux.
This stage can be launched separately with stage1.sh
Call syntax is as follows
./stage1.sh <source_root> <build_root> <results_root>
Here:
source_root- Path to repository root withyasources;build_root- Path to the directory, where all build results will be stored;results_root- Path to the directory, where final results will be stored.
This script uses system libraries, thus tools built, for example, with Ubuntu 24.04, will not work on earlier Ubuntu's
This script invokes graph_executor.py, which downloads build graph from S3 and executes it, then moves ya, ymake and libiconv.so from build_root to $results_root/stage1.
It is called by:
python3 graph_executor.py <source_root> <build_root> <threads> [<path/to/local/graph>]
The last argument is optional and sohuld be used only in debug purposes.
Important! Python 3.9 or newer is required for this script.
This stage is optional and uses tooling built in the stage one to build all targets, namely:
devtools/ya/bindevtools/local_cache/toolscache/serverdevtools/ymake/bindevtools/yexport/bin
This stage is orchestrated by stage2.sh.
It has similar to stage1.sh invocation syntax, but it builds all targets from this repositories for platforms from platform_list
Build results will be stored in $result_root/stage2/<arch> for main tools and in $result_root/stage2/additional/<arch> for additional ones (now it is yexport only)
To ensure platform independency we use docker images built from two Dockerfiles.
These images each execute their own stage of bootstrap described earlier
stage1.Dockerfileis aUbuntu 24.04-based image with everything needed for successful graph execution.stage2.Dockerfileis the basicUbuntu 24.04image. Its launch allows you to get all the tools distributed in this repository.
An image is built by default as follows:
docker build -f <path/to/dockerfile> . -t ya-bootstrap-stage<StageNo>:latest
These images are run as follows:
docker run \
--name test \
--mount type=bind,source=<path/to/repo>,target=/source_root,readonly \
--mount type=bind,source=<path/to/result>,target=/result \
ya-bootstrap-stage<StageNo>:latest
Graph is obtained with gen_graph/gg2 script and uploaded to S3.
This allows to avoid large diffs compared to committing graph straight into a repo.
The path to repository root is required in source_root variable.
The invocation is as follows:
source_root=path/to/repo ./gen_graph/gg2 > fname