summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJoshua Lock <josh@linux.intel.com>2008-10-30 17:42:01 +0000
committerJoshua Lock <josh@linux.intel.com>2008-10-30 17:52:32 +0000
commitd514eeeaec77c8ba3a4993ad7705e7a857c52dec (patch)
tree901ce1d59fdb5cbaf26b08b4e373d8d4ef2cc212
parent4b93bb317546131f63afb2fb971a572708110c5a (diff)
downloadpoky-d514eeeaec77c8ba3a4993ad7705e7a857c52dec.tar.gz
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
-rw-r--r--build/conf/site.conf.sample5
-rw-r--r--meta/classes/base.bbclass25
2 files changed, 30 insertions, 0 deletions
diff --git a/build/conf/site.conf.sample b/build/conf/site.conf.sample
index f14b3d985a..0ed70c6d79 100644
--- a/build/conf/site.conf.sample
+++ b/build/conf/site.conf.sample
@@ -19,6 +19,11 @@
19#GIT_PROXY_PORT = "81" 19#GIT_PROXY_PORT = "81"
20#export GIT_PROXY_COMMAND = "${OEROOT}/scripts/poky-git-proxy-command" 20#export GIT_PROXY_COMMAND = "${OEROOT}/scripts/poky-git-proxy-command"
21 21
22# GIT_PROXY_IGNORE_* lines define hosts which do not require a proxy to access
23#GIT_CORE_CONFIG = "Yes"
24#GIT_PROXY_IGNORE_1 = "host.server.com"
25#GIT_PROXY_IGNORE_2 = "another.server.com"
26
22# If SOCKS is available run the following command to comple a simple transport 27# If SOCKS is available run the following command to comple a simple transport
23# gcc scripts/poky-git-proxy-socks.c -o poky-git-proxy-socks 28# gcc scripts/poky-git-proxy-socks.c -o poky-git-proxy-socks
24# and then share that binary somewhere in PATH, then use the following settings 29# and then share that binary somewhere in PATH, then use the following settings
diff --git a/meta/classes/base.bbclass b/meta/classes/base.bbclass
index c6e19c1501..623bd79666 100644
--- a/meta/classes/base.bbclass
+++ b/meta/classes/base.bbclass
@@ -725,6 +725,28 @@ def base_get_metadata_svn_revision(d):
725 pass 725 pass
726 return revision 726 return revision
727 727
728def generate_git_config(e):
729 from bb import data
730
731 if data.getVar('GIT_CORE_CONFIG', e.data, True):
732 gitconfig_path = "${STAGING_DIR_HOST}/usr/etc/gitconfig"
733 proxy_command = "gitproxy = %s" % data.getVar('GIT_PROXY_COMMAND', e.data, True)
734
735 bb.mkdirhier("${STAGING_DIR_HOST}/usr/etc/")
736 if (os.path.exists(gitconfig_path)):
737 os.remove(gitconfig_path)
738
739 f = open(gitconfig_path, 'w')
740 f.write("[core]\n")
741 f.write(proxy_command)
742
743 ignore_count = 1
744 ignore_host = data.getVar('GIT_PROXY_IGNORE_1', e.data, True)
745 while (ignore_host):
746 f.write(ignore_host)
747 ignore_count += 1
748 ignore_host = data.getVar('GIT_PROXY_IGNORE_%s' % ignore_count)
749
728METADATA_REVISION ?= "${@base_get_metadata_monotone_revision(d)}" 750METADATA_REVISION ?= "${@base_get_metadata_monotone_revision(d)}"
729 751
730addhandler base_eventhandler 752addhandler base_eventhandler
@@ -787,6 +809,9 @@ python base_eventhandler() {
787 os.system('rm -f '+ dir) 809 os.system('rm -f '+ dir)
788 os.system('touch ' + e.stampPrefix[fn] + '.needclean') 810 os.system('touch ' + e.stampPrefix[fn] + '.needclean')
789 811
812 if name == "ConfigParsed":
813 generate_git_config(e)
814
790 if not data in e.__dict__: 815 if not data in e.__dict__:
791 return NotHandled 816 return NotHandled
792 817