Improve logging for missing srpms.

This commit is contained in:
Ralph Bean 2014-04-01 15:48:59 -04:00 committed by Dennis Gilmore
parent 6ceadebaa9
commit 94235b093e

View File

@ -22,6 +22,7 @@ import shutil
import sys import sys
import gzip import gzip
import pypungi.util import pypungi.util
import pprint
import logging import logging
import urlgrabber.progress import urlgrabber.progress
import subprocess import subprocess
@ -861,16 +862,29 @@ class Pungi(pypungi.PungiBase):
self.bin_by_src = {} self.bin_by_src = {}
self.logger.info("Generating source <-> binary package mappings") self.logger.info("Generating source <-> binary package mappings")
#(dummy1, everything, dummy2) = yum.packages.parsePackages(self.all_pkgs, ['*'], pkgdict=self.pkg_refs.copy()) #(dummy1, everything, dummy2) = yum.packages.parsePackages(self.all_pkgs, ['*'], pkgdict=self.pkg_refs.copy())
failed = []
for po in self.all_pkgs: for po in self.all_pkgs:
if is_source(po): if is_source(po):
continue 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 self.src_by_bin[po] = srpmpo
if self.bin_by_src.has_key(srpmpo): if self.bin_by_src.has_key(srpmpo):
self.bin_by_src[srpmpo].append(po) self.bin_by_src[srpmpo].append(po)
else: else:
self.bin_by_src[srpmpo] = [po] 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): def add_srpms(self, po_list=None):
"""Cycle through the list of package objects and """Cycle through the list of package objects and
find the sourcerpm for them. Requires yum still find the sourcerpm for them. Requires yum still