From 8f1024eca19e48d8fb7b53865ac0102d8d6a63b8 Mon Sep 17 00:00:00 2001 From: Ludwig Nussel Date: Wed, 11 Nov 2009 12:28:05 +0100 Subject: [PATCH] try parent project if key is not available --- osc/fetch.py | 24 ++++++++++++++++++++---- 1 file changed, 20 insertions(+), 4 deletions(-) diff --git a/osc/fetch.py b/osc/fetch.py index 6f7a3827..20d788f4 100644 --- a/osc/fetch.py +++ b/osc/fetch.py @@ -201,14 +201,19 @@ class Fetcher: os.unlink(tmpfile) self.nopac = True - for i in buildinfo.projects: - dest = "%s/%s/_pubkey" % (self.cachedir, i) + prjs = buildinfo.projects.keys() + for i in prjs: + dest = "%s/%s" % (self.cachedir, i) + if not os.path.exists(dest): + os.makedirs(dest, mode=0755) + dest += '/_pubkey' + if os.path.exists(dest): buildinfo.keys.append(dest) else: url = "%s/source/%s/_pubkey" % (buildinfo.apiurl, i) try: - self.gr.urlgrab(url, dest, text="key for %s" % i) + self.gr.urlgrab(url, dest, text="fetching key for %s" % i) buildinfo.keys.append(dest) except KeyboardInterrupt: print 'Cancelled by user (ctrl-c)' @@ -217,7 +222,17 @@ class Fetcher: os.unlink(dest) sys.exit(0) except URLGrabError, e: - print "can't fetch key for %s: %s" %(i, e.strerror) + if self.http_debug: + print "can't fetch key for %s: %s" %(i, e.strerror) + print "url: %s" % url + else: + print "%s doesn't have a gpg key" % i + + l = i.rsplit(':', 1) + # try key from parent project + if len(l) > 1 and l[1] and not l[0] in buildinfo.projects: + prjs.append(l[0]) + self.nopac = False def verify_pacs_old(pac_list): @@ -319,6 +334,7 @@ def verify_pacs(pac_list, key_list): failed = True print pkg, ':', e except Exception, e: + print str(e) checker.cleanup() sys.exit(1)