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

Consider a shallow clone of OpenWRT sources for builds #956

Closed
hickey opened this issue Oct 10, 2023 · 3 comments
Closed

Consider a shallow clone of OpenWRT sources for builds #956

hickey opened this issue Oct 10, 2023 · 3 comments

Comments

@hickey
Copy link
Contributor

hickey commented Oct 10, 2023

I am currently sitting in the Atlanta airport and trying to build a firmware image to test against. Early on in the build process a full clone of the OpenWRT sources is performed which takes quite some time on sluggish network connections.

Since 99% of the time only the latest revision of the sources is needed or wanted, I would like to suggest that the clone command in the Makefile be changed to include --depth=1 so that a shallow clone is performed. It is actually a little bit more than that. Here is the actual command to pull out a tag or branch:

git clone --depth=1 https://github.com/openwrt/openwrt.git --branch v22.03.5 --single-branch

That command works (significantly faster) for cloning the OpenWRT repo. On the current connection I was able to clone the repo in about 8 seconds vs. 54 seconds for the full clone. A few mins ago while building in the docker container the full clone seemed to take about 4 mins. Even at 54 secs a 7 times decrease in the cloning is significant.

The only time that this change would not work is if OPENWRT_COMMIT is set to SHA1 hash for the check out. I am not sure if that is a use case that needs to be supported.

@aanon4
Copy link
Contributor

aanon4 commented Oct 11, 2023

Could you let me know if this works for you?

#958

@hickey
Copy link
Contributor Author

hickey commented Oct 13, 2023

Sorry for the delayed response. I am now in the motorhome making my way back across the country.

This is effectively what I did in the local build directory to get the builds running faster. I did not care about the detached head warning, but that is a nice touch. I also left the cd in there as I figured that .stamp-openwrt-cleaned should be in the openwrt directory and that .stamp-unpatched would be found there.

$(OPENWRT_DIR): .stamp-openwrt-removed
        git clone --depth=1 $(OPENWRT_SRC) $(OPENWRT_DIR) --branch=$(OPENWRT_COMMIT) --single-branch
        cd $(OPENWRT_DIR)
        ln -sf $(TOP_DIR)/patches $(OPENWRT_DIR)/
        ln -sf $(TOP_DIR)/files   $(OPENWRT_DIR)/
        touch .stamp-openwrt-cleaned
        rm -f .stamp-unpatched

@aanon4
Copy link
Contributor

aanon4 commented Oct 13, 2023

Thanks. However I think the "cd .... " essentially does nothing as each line of a makefile is executed in a new shell, so that wont carry over to the next lines. In the old "git clone" it was used on the same line rather than specifying a target directory for the clone.

@aanon4 aanon4 closed this as completed Oct 25, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants