riscv-collab / riscv-gnu-toolchain

GNU toolchain for RISC-V, including GCC
Other
3.56k stars 1.17k forks source link

Use Shallow Submodule Init to Reduce Clone Times #1603

Closed TShapinsky closed 3 weeks ago

TShapinsky commented 3 weeks ago

Added --depth 1 to the git submodule update command in Makefile.in.

To test I setup a docker image which built the repository with ./configure --prefix=/opt/riscv --with-arch=rv32gc --with-abi=ilp32d. The image with this change was 14.77 GB where as the version without this change was 16.93 GB. That is a savings of 2.16 GB. This won't be a big deal for people developing in a stable environment where they only init the submodules once, but for cases where the build is happening in a container this is a big gain.

A different approach would be to populate the shallow property in .gitmodules. However, this approach only saves about 100MB, perhaps because the shallow property is not applied recursively.

cmuellner commented 3 weeks ago

Thanks for the PR!

Another side-effect of this is that we download less and speed up the git clone steps.

cmuellner commented 3 weeks ago

Looks like we need to adjust the .gitmodules file as well:

fatal: Fetched in submodule path 'binutils', but it did not contain beb2cdbcda911764b2bed5e57921fe90493260bd. Direct fetching of that commit failed.
TShapinsky commented 3 weeks ago

CI/CD shows the following error:

fatal: Fetched in submodule path 'binutils', but it did not contain beb2cdbcda911764b2bed5e57921fe90493260bd. Direct fetching of that commit failed.

Thanks. I'll see if I can reproduce that locally

TShapinsky commented 3 weeks ago

Closing while I test so I don't generate too many actions issues