From cbdc1389db843adce865f5386858e8364bdc2d41 Mon Sep 17 00:00:00 2001 From: Marcus Huewe Date: Mon, 29 Jun 2015 23:59:59 +0200 Subject: [PATCH] - do_repourls: do not hardcode the download_url Instead ask the api for the download_url configuration element. --- osc/commandline.py | 8 ++++++-- osc/core.py | 5 +++++ 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/osc/commandline.py b/osc/commandline.py index 26b9f8a5..281d0ebf 100644 --- a/osc/commandline.py +++ b/osc/commandline.py @@ -3981,8 +3981,12 @@ Please submit there instead, or use --nodevelproject to force direct submission. else: raise oscerr.WrongArgs('Wrong number of arguments') - # XXX: API should somehow tell that - url_tmpl = 'http://download.opensuse.org/repositories/%s/%s/%s.repo' + root = ET.fromstring(''.join(show_configuration(apiurl))) + elm = root.find('download_url') + if elm is None or not elm.text: + raise oscerr.APIError('download_url configuration element expected') + + url_tmpl = elm.text + '/%s/%s/%s.repo' repos = get_repositories_of_project(apiurl, project) for repo in repos: print(url_tmpl % (project.replace(':', ':/'), repo, project)) diff --git a/osc/core.py b/osc/core.py index 711203e5..29de646d 100644 --- a/osc/core.py +++ b/osc/core.py @@ -3447,6 +3447,11 @@ def show_pattern_meta(apiurl, prj, pattern): e.osc_msg = 'show_pattern_meta: Error getting pattern \'%s\' for project \'%s\'' % (pattern, prj) raise +def show_configuration(apiurl): + u = makeurl(apiurl, ['public', 'configuration']) + f = http_GET(u) + return f.readlines() + class metafile: """metafile that can be manipulated and is stored back after manipulation."""