Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

makesystem: speedup pkg cloning if no git-cache is available #16316

Merged
merged 1 commit into from
Apr 13, 2022

Conversation

kfessel
Copy link
Contributor

@kfessel kfessel commented Apr 12, 2021

Contribution description

This clones repositories used by pkgs without downloading all the history. Due to git clone not being able to load a specific commit: this initializes the packages directory (PKG_SOURCE_DIR) adds the remote configures it and fetches the least amount of data to checkout the PKG_VERSION (commit-id or branch or tag)

for example: this reduces the download of wolfssl from 159.42 MiB to 9.70 MiB + 6.65 MiB ~=16.35MiB

this method or the previous git cache method is selected by the availability of the PATH named by $(GIT_CACHE_DIR) (default: $HOME/.gitcache)

Testing procedure

make a test/example that uses a pkg that uses a git repo

Issues/PRs references

non to my knowledge

@kfessel kfessel added Area: build system Area: Build system Area: pkg Area: External package ports labels Apr 12, 2021
@kfessel kfessel requested review from aabadie and maribu April 12, 2021 11:25
@maribu
Copy link
Member

maribu commented Apr 12, 2021

Maybe it makes more sense to clone with --depth=1 instead, as we are not really interested in the history of external source for the build process.

E.g. I would expect developers contributing to e.g. NanoCBOR to have the corresponding Repo cloned elsewhere with full history anyway.

Maybe @bergzand and @benpicco have an opinion, as they contribute to other stuff packed in RIOT as well.

@kfessel
Copy link
Contributor Author

kfessel commented Apr 12, 2021

i think you can't clone non braches -> --depth=1 will give you a branch that you do not want since RIOT pkgs want arbitrary commits
even though we do not need the history it isn't the biggest part of a repo

@kfessel
Copy link
Contributor Author

kfessel commented Apr 13, 2021

If I take the wolfssl example the complete history is 9 MiB while the blobs are 150 MiB (wee need 7 of them) -> this this saves us ~89% but have all history at hand.

@MrKevinWeiss MrKevinWeiss added this to the Release 2021.07 milestone Jun 21, 2021
@MrKevinWeiss MrKevinWeiss removed this from the Release 2021.07 milestone Jul 15, 2021
@stale
Copy link

stale bot commented Mar 2, 2022

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. If you want me to ignore this issue, please mark it with the "State: don't stale" label. Thank you for your contributions.

@stale stale bot added the State: stale State: The issue / PR has no activity for >185 days label Mar 2, 2022
@kfessel kfessel added the CI: ready for build If set, CI server will compile all applications for all available boards for the labeled PR label Mar 2, 2022
@stale stale bot removed the State: stale State: The issue / PR has no activity for >185 days label Mar 2, 2022
@fjmolinas
Copy link
Contributor

Does gitcache need the blobs? If not can't we do the same thing in all cases and not include blobs?

@kfessel
Copy link
Contributor Author

kfessel commented Mar 3, 2022

Does gitcache need the blobs? If not can't we do the same thing in all cases and not include blobs?

I think the profit wouldn't be worth it with git cache (if you are not short on diskspace on the build system (looking at murdock we are talking about the compile result cache which will be much bigger than what we would safe with this)) -the download size is also less of an issue with a git cache (--- I do not use git cache -> i can not speak much for its usage patters)

  • If you still think it would be also be a nice addition to the git cache using systems i can add that or do a second PR

@kfessel
Copy link
Contributor Author

kfessel commented Apr 11, 2022

@maribu : you might want to have a look at this i changed it to clone without history (depth=1)

@maribu
Copy link
Member

maribu commented Apr 11, 2022

Code looks good to me. Please squash :)

@kfessel kfessel added CI: ready for build If set, CI server will compile all applications for all available boards for the labeled PR and removed CI: ready for build If set, CI server will compile all applications for all available boards for the labeled PR labels Apr 11, 2022
there is no git clone left since git clone does not support getting
specific commits ->:
- init empty repo,
- setup remote origin
- configure
- fetch
- checkout
@kfessel
Copy link
Contributor Author

kfessel commented Apr 11, 2022

rebased an squashed

tried to avoid getting all tags - sadly some git segfaults in that case (so get all tags without blobs)

$(Q)$(GIT_IN_PKG) fetch --depth=1 origin tag $(PKG_VERSION)|| $(GIT_IN_PKG) fetch --depth=1 origin tag $(PKG_VERSION)

Would just get one tag or(if that fails) branch/commit but the github tools-buildtest action does not like that -> back to filter blobs

@kfessel kfessel changed the title makesystem:clone pkgs filterd if no git-cache is availible makesystem: speedup pkg cloning if no git-cache is available Apr 11, 2022
@kfessel
Copy link
Contributor Author

kfessel commented Apr 12, 2022

The Murdock failure left is not related to this PR see #17894. I think we can skip compile.

@maribu
Copy link
Member

maribu commented Apr 12, 2022

I did this for testing:

$ rm build -rf
$ make RIOT_CI_BUILD=1 BOARD=stm32f429i-disc1 -j -C tests/pkg_lvgl_touch/
make: Entering directory '/home/maribu/Repos/software/RIOT/tests/pkg_lvgl_touch'
Building application "tests_pkg_lvgl_touch" for "stm32f429i-disc1" with MCU "stm32".

[INFO] cloning stm32cmsis
[INFO] cloning lvgl
Cloning into '/home/maribu/Repos/software/RIOT/build/stm32/cmsis/f4'...
Cloning into '/home/maribu/Repos/software/RIOT/build/pkg/lvgl'...
remote: Enumerating objects: 62872, done.
remote: Counting objects: 100% (2101/2101), done.
remote: Compressing objects: 100% (1218/1218), done.
remote: Enumerating objects: 425, done.
remote: Counting objects: 100% (425/425), done.
remote: Compressing objects: 100% (83/83), done.
remote: Total 425 (delta 361), reused 400 (delta 336), pack-reused 0
Receiving objects: 100% (425/425), 890.66 KiB | 846.00 KiB/s, done.
Resolving deltas: 100% (361/361), done.
HEAD is now at 6fe2c1f Release v2.6.7 12.53 MiB | 6.15 MiB/s
[INFO] updating stm32cmsis /home/maribu/Repos/software/RIOT/build/stm32/cmsis/f4/.pkg-state.git-downloaded
echo 6fe2c1f498feda34ee422720ff8b3bd1b4656145   > /home/maribu/Repos/software/RIOT/build/stm32/cmsis/f4/.pkg-state.git-downloaded
[INFO] patch stm32cmsis
remote: Total 62872 (delta 1120), reused 1535 (delta 876), pack-reused 60771
Receiving objects: 100% (62872/62872), 88.11 MiB | 6.63 MiB/s, done.
Resolving deltas: 100% (48623/48623), done.
HEAD is now at 0b5a1d4b release v8.2
[INFO] updating lvgl /home/maribu/Repos/software/RIOT/build/pkg/lvgl/.pkg-state.git-downloaded
echo 0b5a1d4b23975b920ff841ea9cd038802f51711b   > /home/maribu/Repos/software/RIOT/build/pkg/lvgl/.pkg-state.git-downloaded
[INFO] patch lvgl
   text	   data	    bss	    dec	    hex	filename
 101228	    188	  15788	 117204	  1c9d4	/home/maribu/Repos/software/RIOT/tests/pkg_lvgl_touch/bin/stm32f429i-disc1/tests_pkg_lvgl_touch.elf
make: Leaving directory '/home/maribu/Repos/software/RIOT/tests/pkg_lvgl_touch'
$ du --max-depth 0 -h  build/
216M	build/
$ git checkout <PR>
$ rm build -rf
$ make RIOT_CI_BUILD=1 BOARD=stm32f429i-disc1 -j -C tests/pkg_lvgl_touch/
make: Entering directory '/home/maribu/Repos/software/RIOT/tests/pkg_lvgl_touch'
Building application "tests_pkg_lvgl_touch" for "stm32f429i-disc1" with MCU "stm32".

[INFO] cloning without cache stm32cmsis
[INFO] cloning without cache lvgl
remote: Enumerating objects: 43, done.
remote: Counting objects: 100% (43/43), done.
remote: Compressing objects: 100% (37/37), done.
remote: Total 43 (delta 2), reused 43 (delta 2), pack-reused 0
Receiving objects: 100% (43/43), 13.69 KiB | 560.00 KiB/s, done.
Resolving deltas: 100% (2/2), done.
From https://github.com/STMicroelectronics/cmsis_device_f4
 * branch            6fe2c1f498feda34ee422720ff8b3bd1b4656145 -> FETCH_HEAD
 * [new tag]         v2.6.3     -> v2.6.3
 * [new tag]         v2.6.4     -> v2.6.4
 * [new tag]         v2.6.6     -> v2.6.6
 * [new tag]         v2.6.7     -> v2.6.7
 * [new tag]         v2.6.8     -> v2.6.8
remote: Enumerating objects: 1079, done.
remote: Counting objects: 100% (1079/1079), done.
remote: Compressing objects: 100% (966/966), done.
remote: Total 1079 (delta 364), reused 544 (delta 91), pack-reused 0
Receiving objects: 100% (1079/1079), 248.78 KiB | 5.92 MiB/s, done.
Resolving deltas: 100% (364/364), done.
From https://github.com/littlevgl/lvgl
 * branch            0b5a1d4b23975b920ff841ea9cd038802f51711b -> FETCH_HEAD
 * [new tag]         2.1             -> 2.1
 * [new tag]         before-v7-style -> before-v7-style
 * [new tag]         v2.1            -> v2.1
 * [new tag]         v2.2.0          -> v2.2.0
 * [new tag]         v4.0.0          -> v4.0.0
 * [new tag]         v4.1.0          -> v4.1.0
 * [new tag]         v4.1.1          -> v4.1.1
 * [new tag]         v4.2.0          -> v4.2.0
 * [new tag]         v5.0.0          -> v5.0.0
 * [new tag]         v5.0.1          -> v5.0.1
 * [new tag]         v5.0.2          -> v5.0.2
 * [new tag]         v5.1            -> v5.1
 * [new tag]         v5.1.1          -> v5.1.1
 * [new tag]         v5.2            -> v5.2
 * [new tag]         v5.2-rc         -> v5.2-rc
 * [new tag]         v5.3            -> v5.3
 * [new tag]         v6.0            -> v6.0
 * [new tag]         v6.0.1          -> v6.0.1
 * [new tag]         v6.0.2          -> v6.0.2
 * [new tag]         v6.1            -> v6.1
 * [new tag]         v6.1.1          -> v6.1.1
 * [new tag]         v6.1.2          -> v6.1.2
 * [new tag]         v7.0-rc         -> v7.0-rc
 * [new tag]         v7.0.0          -> v7.0.0
 * [new tag]         v7.0.1          -> v7.0.1
 * [new tag]         v7.0.2          -> v7.0.2
 * [new tag]         v7.1.0          -> v7.1.0
 * [new tag]         v7.10.0         -> v7.10.0
 * [new tag]         v7.10.1         -> v7.10.1
 * [new tag]         v7.11.0         -> v7.11.0
 * [new tag]         v7.2.0          -> v7.2.0
 * [new tag]         v7.3.0          -> v7.3.0
 * [new tag]         v7.3.1          -> v7.3.1
 * [new tag]         v7.4.0          -> v7.4.0
 * [new tag]         v7.5.0          -> v7.5.0
 * [new tag]         v7.6.0          -> v7.6.0
 * [new tag]         v7.6.1          -> v7.6.1
 * [new tag]         v7.7.0          -> v7.7.0
 * [new tag]         v7.7.1          -> v7.7.1
 * [new tag]         v7.7.2          -> v7.7.2
 * [new tag]         v7.8.0          -> v7.8.0
 * [new tag]         v7.8.1          -> v7.8.1
 * [new tag]         v7.9.0          -> v7.9.0
 * [new tag]         v7.9.1          -> v7.9.1
 * [new tag]         v8.0.0          -> v8.0.0
 * [new tag]         v8.0.1          -> v8.0.1
 * [new tag]         v8.0.2          -> v8.0.2
 * [new tag]         v8.0.3-dev      -> v8.0.3-dev
 * [new tag]         v8.1.0          -> v8.1.0
 * [new tag]         v8.2.0          -> v8.2.0
remote: Enumerating objects: 122, done.
remote: Counting objects: 100% (122/122), done.
remote: Compressing objects: 100% (48/48), done.
remote: Total 122 (delta 99), reused 88 (delta 74), pack-reused 0
Receiving objects: 100% (122/122), 361.88 KiB | 926.00 KiB/s, done.
Resolving deltas: 100% (99/99), done.
Updating files: 100% (150/150), done.
HEAD is now at 6fe2c1f Release v2.6.7
[INFO] updating stm32cmsis /home/maribu/Repos/software/RIOT/build/stm32/cmsis/f4/.pkg-state.git-downloaded
echo 6fe2c1f498feda34ee422720ff8b3bd1b4656145   > /home/maribu/Repos/software/RIOT/build/stm32/cmsis/f4/.pkg-state.git-downloaded
[INFO] patch stm32cmsis
remote: Enumerating objects: 1076, done.
remote: Counting objects: 100% (1076/1076), done.
remote: Compressing objects: 100% (984/984), done.
remote: Total 1076 (delta 136), reused 404 (delta 87), pack-reused 0
Receiving objects: 100% (1076/1076), 24.05 MiB | 5.88 MiB/s, done.
Resolving deltas: 100% (136/136), done.
Updating files: 100% (1082/1082), done.
HEAD is now at 0b5a1d4 release v8.2
[INFO] updating lvgl /home/maribu/Repos/software/RIOT/build/pkg/lvgl/.pkg-state.git-downloaded
echo 0b5a1d4b23975b920ff841ea9cd038802f51711b   > /home/maribu/Repos/software/RIOT/build/pkg/lvgl/.pkg-state.git-downloaded
[INFO] patch lvgl
   text	   data	    bss	    dec	    hex	filename
 101228	    188	  15788	 117204	  1c9d4	/home/maribu/Repos/software/RIOT/tests/pkg_lvgl_touch/bin/stm32f429i-disc1/tests_pkg_lvgl_touch.elf
make: Leaving directory '/home/maribu/Repos/software/RIOT/tests/pkg_lvgl_touch'
$ du --max-depth 0 -h  build/
150M	build/

As seen, a chunk of storage is saved and the cloning subjectively felt faster with this PR. Hence, this works as advertised. And Murdock will do the regression testing :)

@maribu maribu added Reviewed: 1-fundamentals The fundamentals of the PR were reviewed according to the maintainer guidelines Reviewed: 2-code-design The code design of the PR was reviewed according to the maintainer guidelines Reviewed: 3-testing The PR was tested according to the maintainer guidelines Reviewed: 4-code-style The adherence to coding conventions by the PR were reviewed according to the maintainer guidelines Reviewed: 5-documentation The documentation details of the PR were reviewed according to the maintainer guidelines labels Apr 12, 2022
@kfessel kfessel added CI: ready for build If set, CI server will compile all applications for all available boards for the labeled PR and removed CI: ready for build If set, CI server will compile all applications for all available boards for the labeled PR labels Apr 12, 2022
@benpicco
Copy link
Contributor

The failure of tests/congure_reno/microbit:gnu should be unrelated.

@benpicco benpicco added CI: skip compile test If set, CI server will run only non-compile jobs, but no compile jobs or their dependent jobs CI: ready for build If set, CI server will compile all applications for all available boards for the labeled PR and removed CI: ready for build If set, CI server will compile all applications for all available boards for the labeled PR labels Apr 12, 2022
Copy link
Member

@maribu maribu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ACK. As above shown I could confirm that storage requirements are reduced as advertised. Builds with git cache still work (as tested by Murdock with good test coverage) and without (as tested by hand with limited test coverage).

@kfessel kfessel merged commit 88556a5 into RIOT-OS:master Apr 13, 2022
@chrysn chrysn added this to the Release 2022.07 milestone Aug 25, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area: build system Area: Build system Area: pkg Area: External package ports CI: ready for build If set, CI server will compile all applications for all available boards for the labeled PR CI: skip compile test If set, CI server will run only non-compile jobs, but no compile jobs or their dependent jobs Reviewed: 1-fundamentals The fundamentals of the PR were reviewed according to the maintainer guidelines Reviewed: 2-code-design The code design of the PR was reviewed according to the maintainer guidelines Reviewed: 3-testing The PR was tested according to the maintainer guidelines Reviewed: 4-code-style The adherence to coding conventions by the PR were reviewed according to the maintainer guidelines Reviewed: 5-documentation The documentation details of the PR were reviewed according to the maintainer guidelines
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants