From 94235b093e64a58524b834decc8c74635b2525ef Mon Sep 17 00:00:00 2001 From: Ralph Bean Date: Tue, 1 Apr 2014 15:48:59 -0400 Subject: [PATCH] Improve logging for missing srpms. --- src/pypungi/__init__.py | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/src/pypungi/__init__.py b/src/pypungi/__init__.py index 3b804f71..39657e56 100644 --- a/src/pypungi/__init__.py +++ b/src/pypungi/__init__.py @@ -22,6 +22,7 @@ import shutil import sys import gzip import pypungi.util +import pprint import logging import urlgrabber.progress import subprocess @@ -861,16 +862,29 @@ class Pungi(pypungi.PungiBase): self.bin_by_src = {} self.logger.info("Generating source <-> binary package mappings") #(dummy1, everything, dummy2) = yum.packages.parsePackages(self.all_pkgs, ['*'], pkgdict=self.pkg_refs.copy()) + failed = [] for po in self.all_pkgs: if is_source(po): continue - srpmpo = self.get_srpm_po(po) + try: + srpmpo = self.get_srpm_po(po) + except RuntimeError: + failed.append(po.sourcerpm) + continue + self.src_by_bin[po] = srpmpo if self.bin_by_src.has_key(srpmpo): self.bin_by_src[srpmpo].append(po) else: self.bin_by_src[srpmpo] = [po] + if failed: + self.logger.info("The following srpms could not be found: %s" % ( + pprint.pformat(list(sorted(failed))))) + self.logger.info("Couldn't find %i of %i srpms." % ( + len(failed), len(self.src_by_bin))) + raise RuntimeError("Could not find all srpms.") + def add_srpms(self, po_list=None): """Cycle through the list of package objects and find the sourcerpm for them. Requires yum still