diff --git a/repository.py b/repository.py index ba880a59..d0c344a2 100644 --- a/repository.py +++ b/repository.py @@ -844,10 +844,38 @@ def updateInstallProgress(m): total = 0 updateInstallProgress(m) rv = p.wait() + gpg_error_message = None + + if stderr.find(' in import_key_to_pubring') >= 0: + gpg_error_message = "Signature key import failed" + # add any other instance of uncaught GpgmeError before this like + elif stderr.find('gpgme.GpgmeError: ') >= 0: + gpg_error_message = "Cryptography-related yum crash" + + elif re.search("Couldn't open file [^ ]*/repodata/repomd.xml.asc", stderr): + # would otherwise be mistaken for "pubring import" !? + gpg_error_message = "No signature on repository metadata" + elif stderr.find('repomd.xml signature could not be verified') >= 0: + gpg_error_message = "Repository signature verification failure" + + else: + match = re.search("Public key for ([^ ]*.rpm) is not installed", stderr) + if match: + gpg_error_message = "Missing key for %s" % (match.group(1),) + match = re.search("Package ([^ ]*.rpm) is not signed", stderr) + if match: + gpg_error_message = "Package not signed: %s" % (match.group(1),) + match = re.search(r" ([^ ]*): \[Errno [0-9]*\] No more mirrors to try", stderr) + if match: + # rpm not found or corrupted/re-signed/etc + gpg_error_rpm_not_found = match.group(1) + gpg_error_message = "Cannot find valid rpm for %s" % (match.group(1),) if rv: logger.log("DNF exited with %d" % rv) - raise ErrorInstallingPackage("Error installing packages") + if gpg_error_message is None: + gpg_error_message = "Error installing packages" + raise ErrorInstallingPackage(gpg_error_message) shutil.rmtree(os.path.join(mounts['root'], cachedir), ignore_errors=True)