From 6211aafcf5cad61655ab35e68f88f289432415d3 Mon Sep 17 00:00:00 2001 From: David Shea Date: Dec 19 2018 16:07:39 +0000 Subject: Sanitize the base directory name. Macros in the base directory name cause trouble, since rpmfluff does not expand macros when creating the base directory, but rpmbuild will expand macros provided in arguments. Remove any % characters to keep things consistent. --- diff --git a/rpmfluff.py b/rpmfluff.py index 96e54fa..4e218fc 100644 --- a/rpmfluff.py +++ b/rpmfluff.py @@ -657,7 +657,8 @@ class SimpleRpmBuild(RpmBuild): self.section_changelog = defaultChangelogFormat%(version, release) def get_base_dir(self): - return "test-rpmbuild-%s-%s-%s"%(self.name, self.version, self.release) + # replace %'s in the directory name, so that macros don't confuse rpmbuild + return ("test-rpmbuild-%s-%s-%s"%(self.name, self.version, self.release)).replace('%', '_') def get_subpackage_names(self): """ @@ -1839,6 +1840,11 @@ class TestSimpleRpmBuild(unittest.TestCase): srpmHdr = self.rpmbuild.get_built_srpm_header() self.assertEquals(3, srpmHdr[rpm.RPMTAG_EPOCH]) + def test_dist_tag(self): + """Ensuring that macros in the NVR work""" + self.rpmbuild.release = '1%{?dist}' + self.rpmbuild.make() + class YumRepoBuildTests(unittest.TestCase): def assert_is_dir(self, dirname):