summaryrefslogtreecommitdiff
path: root/gbp
diff options
context:
space:
mode:
authorMarkus Lehtonen <markus.lehtonen@linux.intel.com>2013-08-16 13:51:13 +0300
committerMarkus Lehtonen <markus.lehtonen@linux.intel.com>2014-06-05 14:20:07 +0300
commit0009c1362cc78886c96b4236cad9599a8b48bee2 (patch)
tree158eef972b59212e6feb8a7fe77b4f4bddabe5ec /gbp
parent825593b0469c57fbe194bb9a93a9b763dafe9bfc (diff)
downloadgit-buildpackage-0009c1362cc78886c96b4236cad9599a8b48bee2.tar.gz
git-buildpackage-0009c1362cc78886c96b4236cad9599a8b48bee2.tar.bz2
git-buildpackage-0009c1362cc78886c96b4236cad9599a8b48bee2.zip
rpm: Improve logging in case of rpmlib error
Signed-off-by: Markus Lehtonen <markus.lehtonen@linux.intel.com>
Diffstat (limited to 'gbp')
-rw-r--r--gbp/rpm/__init__.py9
-rw-r--r--gbp/rpm/lib_rpm.py2
2 files changed, 7 insertions, 4 deletions
diff --git a/gbp/rpm/__init__.py b/gbp/rpm/__init__.py
index 2290bc32..e62ae2d2 100644
--- a/gbp/rpm/__init__.py
+++ b/gbp/rpm/__init__.py
@@ -35,7 +35,7 @@ import gbp.log
from gbp.pkg import (UpstreamSource, compressor_opts, parse_archive_filename)
from gbp.rpm.policy import RpmPkgPolicy
from gbp.rpm.linkedlist import LinkedList
-from gbp.rpm.lib_rpm import librpm
+from gbp.rpm.lib_rpm import librpm, get_librpm_log
class NoSpecError(Exception):
@@ -181,8 +181,11 @@ class SpecFile(object):
librpm.spec(filtered.name)
return librpm.spec(filtered.name)
except ValueError as err:
- raise GbpError("RPM error while parsing %s: %s" %
- (self.specfile, err))
+ rpmlog = get_librpm_log()
+ gbp.log.debug("librpm log:\n %s" %
+ "\n ".join(rpmlog))
+ raise GbpError("RPM error while parsing %s: %s (%s)" %
+ (self.specfile, err, rpmlog[-1]))
@property
def version(self):
diff --git a/gbp/rpm/lib_rpm.py b/gbp/rpm/lib_rpm.py
index adf40d1b..4bad44e7 100644
--- a/gbp/rpm/lib_rpm.py
+++ b/gbp/rpm/lib_rpm.py
@@ -37,7 +37,7 @@ librpm.setVerbosity(librpm.RPMLOG_INFO)
librpm.setLogFile(_rpmlogfd)
-def get_log(truncate=True):
+def get_librpm_log(truncate=True):
"""Get rpmlib log output"""
_rpmlogfd.seek(0)
log = [line.strip() for line in _rpmlogfd.readlines()]