Skip to content

Commit

Permalink
- added support for a per apiurl "build-root" option
Browse files Browse the repository at this point in the history
Resolution order:
OSC_BUILD_ROOT env var > apiurl build-root option > general build-root option
  • Loading branch information
marcus-h committed Jun 4, 2014
1 parent e2abfe9 commit 7efd6db
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
9 changes: 7 additions & 2 deletions osc/build.py
Expand Up @@ -487,6 +487,7 @@ def main(apiurl, opts, argv):
if opts.shell:
buildargs.append("--shell")

orig_build_root = config['build-root']
# make it possible to override configuration of the rc file
for var in ['OSC_PACKAGECACHEDIR', 'OSC_SU_WRAPPER', 'OSC_BUILD_ROOT']:
val = os.getenv(var)
Expand All @@ -508,11 +509,15 @@ def main(apiurl, opts, argv):
pacname = os.path.splitext(build_descr)[0]
apihost = urlsplit(apiurl)[1]
if not build_root:
build_root = config['build-root']
if build_root == orig_build_root:
# ENV var was not set
build_root = config['api_host_options'][apiurl].get('build-root', build_root)
try:
build_root = config['build-root'] % {'repo': repo, 'arch': arch,
build_root = build_root % {'repo': repo, 'arch': arch,
'project': prj, 'package': pacname, 'apihost': apihost}
except:
build_root = config['build-root']
pass

cache_dir = config['packagecachedir'] % {'apihost': apihost}

Expand Down
2 changes: 2 additions & 0 deletions osc/conf.py
Expand Up @@ -923,6 +923,8 @@ def get_config(override_conffile=None,
api_host_options[apiurl][key] = cp.getboolean(url, key)
else:
api_host_options[apiurl][key] = cp.get(url, key)
if cp.has_option(url, 'build-root', proper=True):
api_host_options[apiurl]['build-root'] = cp.get(url, 'build-root', raw=True)

if not 'sslcertck' in api_host_options[apiurl]:
api_host_options[apiurl]['sslcertck'] = True
Expand Down

0 comments on commit 7efd6db

Please sign in to comment.