#86 make rpmdev-bumpsec take rpmautospec into account
Merged 2 years ago by ngompa. Opened 2 years ago by scoady.
scoady/rpmdevtools issue-64  into  main

file modified
@@ -25,6 +25,10 @@ 

  import textwrap

  import time


+ try:

+     from rpmautospec import specfile_uses_rpmautospec

+ except ImportError:

+     pass


  __version__ = "1.0.13"

@@ -157,6 +161,15 @@ 

                  raise BumpSpecError('Bad datestamp: %s\n' % datestamp)

          return datestamp



+     def checkChangelogPresence(self):

+         detected = False

+         for i in range(len(self.lines)):

+             if SpecFile._changelog_pattern.match(self.lines[i]):

+                 detected = True

+                 break

+         return detected


      def addChangelogEntry(self, evr, entry, email):

          for i in range(len(self.lines)):

              if SpecFile._changelog_pattern.match(self.lines[i]):
@@ -355,6 +368,18 @@ 

          except Exception as e:

              # Not actually a parser error, but... meh.



+         try:

+             if specfile_uses_rpmautospec(

+                 specfile=s.filename,

+                 check_autorelease=True,

+                 check_autochangelog=False

+             ):

+                 print("RPMAutoSpec usage detected, not changing the spec file.")

+                 continue

+         except NameError:

+             pass


          if opts.new:

              changed = s.newVersion(opts.new)

@@ -367,6 +392,9 @@ 




+         if not s.checkChangelogPresence():

+             print("No %changelog detected, not generating one.")

+             continue


          # Get EVR for changelog entry.

          cmd = ("rpm", "-q", "--specfile", "--define", "dist %{nil}",

this PR is to address issue 64 from this repository. I used the two comments there as criteria for how the code should behave.


Signed-off-by: Stephen Coady scoady@redhat.com

Are we settled into %autorel? I thought this was going to change to %autorelease...

@ngompa we can change that for sure. I'll create a ticket to track that and make those changes here too.

1 new commit added

  • use macro exported from rpmautospec and rpm package
2 years ago

Note, we have an open PR in rpmautospec (fedora-infra/rpmautospec#155) to expose a function doing the checksto 3rd parties, and we'll rework this PR to use it. Don't merge yet, thanks!

rebased onto 949d4dc

2 years ago

this is ready for review now if you have some time :)

Can you please make this so it's not a hard dependency?

rebased onto 5b662f1

2 years ago

Is there anyone available to review this?

LGTM. Merging, thanks for the patch!

Pull-Request has been merged by ngompa

2 years ago