#19 Sanitize the base directory name.
Closed 5 years ago by dshea. Opened 5 years ago by dshea.
dshea/rpmfluff base_dir-macros  into  master

file modified
+7 -1
@@ -657,7 +657,8 @@ 

          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 @@ 

          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):

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.

Closing, this doesn't completely work. rpmbuild succeeds but then get_built_rpm is wrong.

Pull-Request has been closed by dshea

5 years ago
Metadata