base.bbclass: Additional git proxy support.
Add to the git proxy support so that the proxy configuration can be propogated to the git config (etc/gitconfig in staging). Add support for ignored hosts in the git proxy. Examples in site.conf.sample
This commit is contained in:
parent
4b93bb3175
commit
d514eeeaec
|
@ -19,6 +19,11 @@
|
||||||
#GIT_PROXY_PORT = "81"
|
#GIT_PROXY_PORT = "81"
|
||||||
#export GIT_PROXY_COMMAND = "${OEROOT}/scripts/poky-git-proxy-command"
|
#export GIT_PROXY_COMMAND = "${OEROOT}/scripts/poky-git-proxy-command"
|
||||||
|
|
||||||
|
# GIT_PROXY_IGNORE_* lines define hosts which do not require a proxy to access
|
||||||
|
#GIT_CORE_CONFIG = "Yes"
|
||||||
|
#GIT_PROXY_IGNORE_1 = "host.server.com"
|
||||||
|
#GIT_PROXY_IGNORE_2 = "another.server.com"
|
||||||
|
|
||||||
# If SOCKS is available run the following command to comple a simple transport
|
# If SOCKS is available run the following command to comple a simple transport
|
||||||
# gcc scripts/poky-git-proxy-socks.c -o poky-git-proxy-socks
|
# gcc scripts/poky-git-proxy-socks.c -o poky-git-proxy-socks
|
||||||
# and then share that binary somewhere in PATH, then use the following settings
|
# and then share that binary somewhere in PATH, then use the following settings
|
||||||
|
|
|
@ -725,6 +725,28 @@ def base_get_metadata_svn_revision(d):
|
||||||
pass
|
pass
|
||||||
return revision
|
return revision
|
||||||
|
|
||||||
|
def generate_git_config(e):
|
||||||
|
from bb import data
|
||||||
|
|
||||||
|
if data.getVar('GIT_CORE_CONFIG', e.data, True):
|
||||||
|
gitconfig_path = "${STAGING_DIR_HOST}/usr/etc/gitconfig"
|
||||||
|
proxy_command = "gitproxy = %s" % data.getVar('GIT_PROXY_COMMAND', e.data, True)
|
||||||
|
|
||||||
|
bb.mkdirhier("${STAGING_DIR_HOST}/usr/etc/")
|
||||||
|
if (os.path.exists(gitconfig_path)):
|
||||||
|
os.remove(gitconfig_path)
|
||||||
|
|
||||||
|
f = open(gitconfig_path, 'w')
|
||||||
|
f.write("[core]\n")
|
||||||
|
f.write(proxy_command)
|
||||||
|
|
||||||
|
ignore_count = 1
|
||||||
|
ignore_host = data.getVar('GIT_PROXY_IGNORE_1', e.data, True)
|
||||||
|
while (ignore_host):
|
||||||
|
f.write(ignore_host)
|
||||||
|
ignore_count += 1
|
||||||
|
ignore_host = data.getVar('GIT_PROXY_IGNORE_%s' % ignore_count)
|
||||||
|
|
||||||
METADATA_REVISION ?= "${@base_get_metadata_monotone_revision(d)}"
|
METADATA_REVISION ?= "${@base_get_metadata_monotone_revision(d)}"
|
||||||
|
|
||||||
addhandler base_eventhandler
|
addhandler base_eventhandler
|
||||||
|
@ -787,6 +809,9 @@ python base_eventhandler() {
|
||||||
os.system('rm -f '+ dir)
|
os.system('rm -f '+ dir)
|
||||||
os.system('touch ' + e.stampPrefix[fn] + '.needclean')
|
os.system('touch ' + e.stampPrefix[fn] + '.needclean')
|
||||||
|
|
||||||
|
if name == "ConfigParsed":
|
||||||
|
generate_git_config(e)
|
||||||
|
|
||||||
if not data in e.__dict__:
|
if not data in e.__dict__:
|
||||||
return NotHandled
|
return NotHandled
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue