From 27579ee44f0492e9d3d63d238640a3ba2fe77c96 Mon Sep 17 00:00:00 2001 From: Markus Lehtonen Date: Mon, 24 Feb 2014 08:58:18 +0200 Subject: rpm: correctly handle 'NoSource' and 'NoPatch' tags in spec NoSource and NoPatch should be lists, thus not currently fully supported by us. However, rpm-python used to return them as long values in case only one NoSource/NoPatch tag was defined (RH Bug: 991329). Change-Id: Id99205a68f2c8862a4d9fa141c4507a287a90a6b Signed-off-by: Markus Lehtonen --- gbp/rpm/__init__.py | 7 ++++--- tests/test_rpm.py | 2 +- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/gbp/rpm/__init__.py b/gbp/rpm/__init__.py index c79ddf6b..0b1e6df5 100644 --- a/gbp/rpm/__init__.py +++ b/gbp/rpm/__init__.py @@ -153,7 +153,8 @@ class SpecFile(object): 'provides', 'obsoletes', 'buildrequires', 'buildconflicts', 'buildrecommends', 'buildsuggests', 'buildsupplements', - 'buildenhances', 'collections') + 'buildenhances', 'collections', + 'nosource', 'nopatch') self._specinfo = self._parse_filtered_spec(self._filtertags) # Other initializations @@ -312,8 +313,8 @@ class SpecFile(object): tagvalue = None elif not tagvalue: # Rpm python doesn't give the following, for reason or another - if tagname not in ('buildroot', 'nopatch', 'nosource', 'autoprov', - 'autoreq', 'autoreqprov') + self._filtertags: + if tagname not in ('buildroot', 'autoprov', 'autoreq', + 'autoreqprov') + self._filtertags: gbp.log.warn("BUG: '%s:' tag not found by rpm" % tagname) tagvalue = matchobj.group('value') linerecord = {'line': lineobj, diff --git a/tests/test_rpm.py b/tests/test_rpm.py index 3e3a599e..13799266 100644 --- a/tests/test_rpm.py +++ b/tests/test_rpm.py @@ -293,7 +293,7 @@ class TestSpecFile(object): # Check all the tags for name, val in spec.protected('_tags').iteritems(): rval = None - if name in ('version', 'release', 'epoch', 'nosource', 'nopatch'): + if name in ('version', 'release', 'epoch'): rval = '0' elif name in ('autoreq', 'autoprov', 'autoreqprov'): rval = 'No' -- cgit v1.2.3