#1 Allow specifying owner and group for installed files
Merged 6 years ago by jhutar. Opened 6 years ago by dcallagh.
dcallagh/rpmfluff owner-group  into  master

file modified
+16 -1
@@ -1015,7 +1015,9 @@ 

                             subpackageSuffix=None,

                             isConfig=False,

                             isDoc=False,

-                            isGhost=False):

+                            isGhost=False,

+                            owner=None,

+                            group=None):

          """Add a simple source file to the sources, and set it up to be copied up directly at %install, potentially with certain permissions"""

          sourceId = self.add_source(sourceFile)

  
@@ -1027,6 +1029,8 @@ 

  

          sub = self.get_subpackage(subpackageSuffix)

          tag=""

+         if owner or group:

+             tag += '%%attr(-,%s,%s) ' % (owner or '-', group or '-')

          if isConfig:

              tag+="%config "

          if isDoc:
@@ -1729,6 +1733,17 @@ 

                               isGhost=True)

          self.rpmbuild.make()

  

+     def test_add_file_with_owner_and_group(self):

+         self.rpmbuild.add_installed_file('/var/www/html/index.html',

+                 SourceFile('index.html', '<p>Hello</p>'),

+                 owner='apache', group='apache')

+         self.rpmbuild.make()

+         hdr = self.rpmbuild.get_built_rpm_header(expectedArch)

+         files = rpm.files(hdr)

+         self.assertEqual('/var/www/html/index.html', files[0].name)

+         self.assertEqual('apache', files[0].user)

+         self.assertEqual('apache', files[0].group)

+ 

      def test_specfile_encoding_utf8(self):

          self.rpmbuild.section_changelog = u"* Fri Mar 30 2001 Trond Eivind Glomsr\u00F8d <teg@redhat.com>\nDo something"

          self.rpmbuild.make()

no initial comment

Pull-Request has been merged by jhutar

6 years ago

Looks like you have solved 7 years old ticket: https://fedorahosted.org/rpmfluff/ticket/1 :)

Metadata