From 68b59f29a1b861696b516e37fa921f5227ed3137 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Adrian=20Schr=C3=B6ter?= Date: Fri, 29 Jun 2012 10:57:29 +0200 Subject: [PATCH] - do not forward submit requests which do link to original request target anyway --- NEWS | 3 +++ osc/commandline.py | 19 +++++++++++++++++++ 2 files changed, 22 insertions(+) diff --git a/NEWS b/NEWS index b4941ef5..1399e12e 100644 --- a/NEWS +++ b/NEWS @@ -1,3 +1,6 @@ +0.135.1 + - do not forward requests to packages which do link anyway to original request target + 0.135 - request accept is offering now to forward submit request if it is a devel area like webui does - support archlinux builds (requires OBS 2.4) diff --git a/osc/commandline.py b/osc/commandline.py index e251d6cf..eda4b5ff 100644 --- a/osc/commandline.py +++ b/osc/commandline.py @@ -2170,6 +2170,25 @@ Please submit there instead, or use --nodevelproject to force direct submission. for node in root.findall('package'): project = node.get('project') package = node.get('name') + # skip it when this is anyway a link to me + link_url = makeurl(apiurl, ['source', project, package]) + links_to_project = links_to_package = None + try: + file = http_GET(link_url) + root = ET.parse(file).getroot() + link_node = root.find('linkinfo') + if link_node != None: + links_to_project = link_node.get('project') or project + links_to_package = link_node.get('package') or package + except urllib2.HTTPError, e: + if e.code != 404: + print >>sys.stderr, 'Cannot get list of files for %s/%s: %s' % (project, package, e) + except SyntaxError, e: + print >>sys.stderr, 'Cannot parse list of files for %s/%s: %s' % (project, package, e) + if links_to_project==action.tgt_project and links_to_package==action.tgt_package: + # links to my request target anyway, no need to forward submit + continue + print project, if package != action.tgt_package: print "/", package,