rpm: circumvent an rpm-python macro expansion problem
authorMarkus Lehtonen <markus.lehtonen@linux.intel.com>
Mon, 19 Nov 2012 11:56:31 +0000 (13:56 +0200)
committerMarkus Lehtonen <markus.lehtonen@linux.intel.com>
Tue, 7 Jan 2014 14:21:29 +0000 (16:21 +0200)
Parse the spec file two times to circumvent a rpm-python problem which
causes macros not to be correctly expanded if used before their
definition.

Signed-off-by: Markus Lehtonen <markus.lehtonen@linux.intel.com>
gbp/rpm/__init__.py

index 64d04229c160445645ed77d69fc65bc6de1c9135..2c607824b31a6d47bb81c6450d5d6adb5476efd1 100644 (file)
@@ -139,6 +139,10 @@ class SpecFile(object):
                             if line.split(":")[0].strip() not in skip_tags)
                         filtered.flush()
                         try:
+                            # Parse two times to circumvent a rpm-python
+                            # problem where macros are not expanded if used
+                            # before their definition
+                            rpm.spec(temp.name)
                             self.specinfo = rpm.spec(temp.name)
                         except ValueError as err:
                             raise GbpError("RPM error while parsing spec: %s" % err)