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

Some repositories 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 | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/sbin/makepkg b/sbin/makepkg index fde82212..6f8b95af 100755 --- a/sbin/makepkg +++ b/sbin/makepkg @@ -623,6 +623,11 @@ extract_git() { cd_safe "${dir##*/}" + # modify submodules address to local server address. + if [[ -f ".gitmodules" ]] && [[ -n ${LKP_SERVER} ]]; then + echo -e "[url \"git://${LKP_SERVER}/\"]\n\tinsteadOf = https://" >> /etc/gitconfig + fi + local ref=origin/HEAD if [[ -n $fragment ]]; then case ${fragment%%=*} in -- 2.23.0

On Mon, Nov 16, 2020 at 10:52:09AM +0800, Liu Shaofei wrote:
Some repositories 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 | 5 +++++ 1 file changed, 5 insertions(+)
diff --git a/sbin/makepkg b/sbin/makepkg index fde82212..6f8b95af 100755 --- a/sbin/makepkg +++ b/sbin/makepkg @@ -623,6 +623,11 @@ extract_git() {
cd_safe "${dir##*/}"
+ # modify submodules address to local server address. + if [[ -f ".gitmodules" ]] && [[ -n ${LKP_SERVER} ]]; then + echo -e "[url \"git://${LKP_SERVER}/\"]\n\tinsteadOf = https://" >> /etc/gitconfig + fi
We can simplify like this: [ -f ".gitmodules" -a -n ${LKP_SERVER} ] && { echo -e "[url \"git://${LKP_SERVER}/\"]\n\tinsteadOf = https://" >> /etc/gitconfig } Thanks, Xijian

On Mon, Nov 16, 2020 at 03:05:19PM +0800, Xu Xijian wrote:
On Mon, Nov 16, 2020 at 10:52:09AM +0800, Liu Shaofei wrote:
Some repositories 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 | 5 +++++ 1 file changed, 5 insertions(+)
diff --git a/sbin/makepkg b/sbin/makepkg index fde82212..6f8b95af 100755 --- a/sbin/makepkg +++ b/sbin/makepkg @@ -623,6 +623,11 @@ extract_git() {
cd_safe "${dir##*/}"
+ # modify submodules address to local server address. + if [[ -f ".gitmodules" ]] && [[ -n ${LKP_SERVER} ]]; then + echo -e "[url \"git://${LKP_SERVER}/\"]\n\tinsteadOf = https://" >> /etc/gitconfig + fi
We can simplify like this: [ -f ".gitmodules" -a -n ${LKP_SERVER} ] && { echo -e "[url \"git://${LKP_SERVER}/\"]\n\tinsteadOf = https://" >> /etc/gitconfig }
But i think, perhaps look like more clear as below: "if [[ -f ".gitmodules" ]] && [[ -n ${LKP_SERVER} ]]; " Thanks, Liushaofei
Thanks, Xijian
participants (2)
-
Liu Shaofei
-
Xu Xijian