#26 Allow setting a different spec file basename than the package name.
Merged 4 years ago by jhutar. Opened 4 years ago by dcantrel.
dcantrel/rpmfluff master  into  master

file modified
+10 -1
@@ -715,6 +715,8 @@ 

  

          self.section_changelog = defaultChangelogFormat%(version, release)

  

+         self.specbasename = None

+ 

      def get_base_dir(self):

          return "test-rpmbuild-%s-%s-%s"%(self.name, self.version, expand_macros(self.release))

  
@@ -784,6 +786,10 @@ 

          "Set URL"

          self.url = urlName

  

+     def addSpecBasename(self, name):

+         "Set spec file basename to NAME for NAME.spec"

+         self.specbasename = name

+ 

      def add_pre(self, preLine):

          "Append a line to the %pre script section of this package"

          self.section_pre += preLine
@@ -802,7 +808,10 @@ 

  

      def gather_spec_file(self, tmpDir):

          import codecs

-         specFileName = os.path.join(tmpDir, "%s.spec"%self.name)

+         if self.specbasename and self.specbasename != '':

+             specFileName = os.path.join(tmpDir, "%s.spec" % self.specbasename)

+         else:

+             specFileName = os.path.join(tmpDir, "%s.spec"%self.name)

          specFile = codecs.open(specFileName, "wb", self.specfileEncoding)

          specFile.write(self.header)

          specFile.write("Summary: %s\n"%self.basePackage.summary)

This is to support a test case I want to have in rpminspect. Per
packaging policy in Fedora, we require the SRPM file spec file basename
to match the package name. For example, the gcc package must come with
a gcc.spec file, not gcc-is-a-compiler.spec file. With this patch you
can do:

addSpecBasename("sometext")

And override the default spec filename generated from using self.name
to the text you provide.

@jhutar @ignatenkobrain thoughts on this PR? It seems safe enough, and it's something we can use in the rpminspect project as well.

Oh sorry. I have missed it. "7 months ago" - sorry for that!

Pull-Request has been merged by jhutar

4 years ago
Metadata