[PATCH lkp-tests] sbin/makepkg: download submodules code from LKP server

[why] Some repository have submodules. So when build packages, we need download submodules from LKP server, avoid the waste of time in downloading files from the remote end. Signed-off-by: Liu Shaofei <liushaofei5@huawei.com> --- sbin/makepkg | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/sbin/makepkg b/sbin/makepkg index 25773621..afa665aa 100755 --- a/sbin/makepkg +++ b/sbin/makepkg @@ -623,6 +623,16 @@ extract_git() { cd_safe "${dir##*/}" + # modify submodules address to local server address + # url = https://github.com/nico/demumble.git + # => + # url = git://172.168.131.113/submodules/b/bloaty/demumble.git + if [[ -f ".gitmodules" ]]; then + local project=${upstream_repo%/*} + local url="git://${LKP_SERVER}/submodules/${project}/" + sed -i "s|url = .*\/|${url}|g" ".gitmodules" + fi + local ref=origin/HEAD if [[ -n $fragment ]]; then case ${fragment%%=*} in -- 2.23.0

+ # modify submodules address to local server address + # url = https://github.com/nico/demumble.git + # => + # url = git://172.168.131.113/submodules/b/bloaty/demumble.git
Maybe last 3 lines are useless. It's clear enough.
+ if [[ -f ".gitmodules" ]]; then
May use [, [[ is already conditional construct.
+ local project=${upstream_repo%/*}
What's the value of upstream_repo? May need an example in changelog to make review more easier. Thanks, RenWen
+ local url="git://${LKP_SERVER}/submodules/${project}/" + sed -i "s|url = .*\/|${url}|g" ".gitmodules" + fi + local ref=origin/HEAD if [[ -n $fragment ]]; then case ${fragment%%=*} in -- 2.23.0

On Tue, Nov 10, 2020 at 06:41:03PM +0800, Ren Wen wrote:
+ # modify submodules address to local server address + # url = https://github.com/nico/demumble.git + # => + # url = git://172.168.131.113/submodules/b/bloaty/demumble.git
Maybe last 3 lines are useless. It's clear enough.
+ if [[ -f ".gitmodules" ]]; then
May use [, [[ is already conditional construct.
+ local project=${upstream_repo%/*}
What's the value of upstream_repo? May need an example in changelog to make review more easier.
ok, Thanks, Liushaofei
Thanks, RenWen
+ local url="git://${LKP_SERVER}/submodules/${project}/" + sed -i "s|url = .*\/|${url}|g" ".gitmodules" + fi + local ref=origin/HEAD if [[ -n $fragment ]]; then case ${fragment%%=*} in -- 2.23.0
participants (2)
-
Liu Shaofei
-
Ren Wen