1
0
mirror of https://github.com/openSUSE/osc.git synced 2025-08-23 22:58:53 +02:00

try parent project if key is not available

This commit is contained in:
Ludwig Nussel
2009-11-11 12:28:05 +01:00
parent 8fb9669ae4
commit 8f1024eca1

View File

@@ -201,14 +201,19 @@ class Fetcher:
os.unlink(tmpfile) os.unlink(tmpfile)
self.nopac = True self.nopac = True
for i in buildinfo.projects: prjs = buildinfo.projects.keys()
dest = "%s/%s/_pubkey" % (self.cachedir, i) 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): if os.path.exists(dest):
buildinfo.keys.append(dest) buildinfo.keys.append(dest)
else: else:
url = "%s/source/%s/_pubkey" % (buildinfo.apiurl, i) url = "%s/source/%s/_pubkey" % (buildinfo.apiurl, i)
try: 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) buildinfo.keys.append(dest)
except KeyboardInterrupt: except KeyboardInterrupt:
print 'Cancelled by user (ctrl-c)' print 'Cancelled by user (ctrl-c)'
@@ -217,7 +222,17 @@ class Fetcher:
os.unlink(dest) os.unlink(dest)
sys.exit(0) sys.exit(0)
except URLGrabError, e: 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 self.nopac = False
def verify_pacs_old(pac_list): def verify_pacs_old(pac_list):
@@ -319,6 +334,7 @@ def verify_pacs(pac_list, key_list):
failed = True failed = True
print pkg, ':', e print pkg, ':', e
except Exception, e: except Exception, e:
print str(e)
checker.cleanup() checker.cleanup()
sys.exit(1) sys.exit(1)