From 97bd601080969120ae2b57fc8455c4bc0b3129ce Mon Sep 17 00:00:00 2001 From: Ken Dreyer Date: May 22 2012 18:52:13 +0000 Subject: add "yum_proxy" option to builder Previously if you wanted to use an HTTP proxy server with a builder, you had to either specify the proxy in the pkgurl, or use iptables to intercept HTTP and route it through a transparent proxy. There is a better way: yum has proxy support built in. When a URL is specified in the "proxy" option in yum.conf, yum will use this URL as a proxy server. Add a "yum_proxy" option in kojid.conf. Kojid will pass it back to mock during genMockConfig(). Mock will write it into yum.conf in the chroot. --- diff --git a/builder/kojid b/builder/kojid index 676b45f..515b0f9 100755 --- a/builder/kojid +++ b/builder/kojid @@ -204,7 +204,7 @@ class BuildRoot(object): for k in ('repoid', 'tag_name'): if hasattr(self, k): opts[k] = getattr(self, k) - for k in ('mockdir', 'topdir', 'topurl', 'packager', 'vendor', 'distribution', 'mockhost'): + for k in ('mockdir', 'topdir', 'topurl', 'packager', 'vendor', 'distribution', 'mockhost', 'yum_proxy'): if hasattr(self.options, k): opts[k] = getattr(self.options, k) opts['buildroot_id'] = self.id @@ -2927,6 +2927,7 @@ def get_options(): 'createrepo_update': True, 'pkgurl': None, 'allowed_scms': '', + 'yum_proxy': None, 'maven_repo_ignore': '*.md5 *.sha1 maven-metadata*.xml _maven.repositories ' 'resolver-status.properties *.lastUpdated', 'failed_buildroot_lifetime' : 3600 * 4, diff --git a/koji/__init__.py b/koji/__init__.py index f0c975a..3f51bbc 100644 --- a/koji/__init__.py +++ b/koji/__init__.py @@ -1275,7 +1275,12 @@ def genMockConfig(name, arch, managed=False, repoid=None, tag_name=None, **opts) if mavenrc: files['etc/mavenrc'] = mavenrc - config_opts['yum.conf'] = """[main] + config_opts['yum.conf'] = "[main]\n" + # HTTP proxy for yum + if opts.get('yum_proxy'): + config_opts['yum.conf'] += "proxy=%s\n" % opts['yum_proxy'] + # Rest of the yum options + config_opts['yum.conf'] += """ cachedir=/var/cache/yum debuglevel=1 logfile=/var/log/yum.log