build-setup: Use global config to set git proxy

The git-proxy was set as local config, so it only applies for the
openbmc tree.
To make use of the proxy for all the git downloads, make it as global
config, and use the full path instead of adding the directory to the
PATH, because the PATH is not propagated to all stages of the Yocto
build process.

Also set http.proxy as well.

In case there are multiple jobs started simultaneously (e.g. a matrix
configuration project), use flock to protect the race of writing to the
configure files.

Be noted that it sets the .gitconfig in ${HOME}. So if ${HOME} is
shared between different projects it will affect other projects.
But the script already sets ~/.subversion/servers, so this change just
follows the solution.

It's suggested to use a separated ${HOME} for projects that require
proxy.

Tested: Without this change, qemu-native failed to build during fetching
        the git submodules in places, that it got below error

            error: RPC failed; curl 56 GnuTLS recv error (-54): Error in the
            pull function.

        With this change, it builds fine.

Signed-off-by: Lei YU <yulei.sh@bytedance.com>
Change-Id: Ic12e403d5babd8954748db533ce568fcd7c31f0d
1 file changed