On Tue, Feb 09, 2021 at 05:21:32PM +0800, Liu Shaofei wrote:
[why] When building software package by cci-makepkg, the source codes repository contains submodules. By default, these submodules are downloaded from the local server, but the local server does not have submodules download address. So the submodules repository fails to be downloaded to test machine during the build.
Signed-off-by: Liu Shaofei 370072077@qq.com
sbin/makepkg | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-)
diff --git a/sbin/makepkg b/sbin/makepkg index 7a92ea71b..b592a2ccb 100755 --- a/sbin/makepkg +++ b/sbin/makepkg @@ -587,6 +587,17 @@ download_git() { fi }
+# modify submodules address to local server address. +# [ "$DISABLE_DOMAIN_CHANGE" == "false" ] => replace submodules domain, and download it from local server +# [ "$DISABLE_DOMAIN_CHANGE" == "true" ] => not replace submodules domain, and download it from remote end. +modify_gitmodules() {
- [ "$DISABLE_DOMAIN_CHANGE" == "false" ] || return
否定的否定,有点绕
变量命名不准确 乍看它好像是域名相关的开关,其实是在做git url rewrite
- if [[ -f ".gitmodules" ]] && [[ -n ${LKP_SERVER} ]]; then
第二个判断加""好些
echo -e "[url \"git://${LKP_SERVER}/\"]\n\tinsteadOf = https://" >> /etc/gitconfig
LKP_SERVER 不一定就是 GIT SERVER 有没有更直接的代表GIT SERVER地址的变量?
echo语句写成git config命令,看起来正规一点。
- fi
+}
extract_git() { local netfile=$1
@@ -623,10 +634,7 @@ 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
modify_gitmodules
local ref=origin/HEAD if [[ -n $fragment ]]; then
@@ -3668,6 +3676,7 @@ SRCEXT=${_SRCEXT:-$SRCEXT} GPGKEY=${_GPGKEY:-$GPGKEY} PACKAGER=${_PACKAGER:-$PACKAGER} CARCH=${_CARCH:-$CARCH} +DISABLE_DOMAIN_CHANGE=${DISABLE_DOMAIN_CHANGE:-false}
if (( INFAKEROOT )); then if [[ -z $FAKEROOTKEY ]]; then -- 2.23.0