#276 Ignore %autorelease beneath %changelog
Merged a year ago by nphilipp. Opened a year ago by nphilipp.
fedora-infra/ nphilipp/rpmautospec main--autorelease-check-ignore-beneath-changelog  into  main

file modified
+5 -4
@@ -37,11 +37,12 @@ 

          for lineno, line in enumerate(iter(specfile), start=1):

              line = line.rstrip("\n")

  

-             if not has_autorelease and autorelease_re.search(line):

-                 has_autorelease = True

+             if changelog_lineno is None:

+                 if not has_autorelease and autorelease_re.search(line):

+                     has_autorelease = True

  

-             if changelog_lineno is None and changelog_re.match(line):

-                 changelog_lineno = lineno

+                 if changelog_re.match(line):

+                     changelog_lineno = lineno

  

              if autochangelog_lineno is None and autochangelog_re.match(line):

                  autochangelog_lineno = lineno

@@ -54,7 +54,15 @@ 

          if with_autochangelog:

              contents.append("%autochangelog")

          else:

-             contents.extend(["* Thu Jan 01 1970 Some Name <email@example.com>", "- some entry"])

+             contents.extend(

+                 [

+                     "* Fri Jan 02 1970 Some Name <email@example.com>",

+                     "- This %autorelease should be ignored.",

+                     "",

+                     "* Thu Jan 01 1970 Some Name <email@example.com>",

+                     "- some entry",

+                 ]

+             )

  

          print("\n".join(contents), file=specfile)

          specfile.flush()
@@ -73,7 +81,7 @@ 

              pytest.param(

                  True, True, "-b 200", True, True, id="with non standard base release number, braces"

              ),

-             pytest.param(False, False, "", False, False, id="nothing"),

+             pytest.param(False, False, "", True, False, id="nothing"),

          ),

      )

      @pytest.mark.parametrize("specpath_type", (str, Path))
@@ -96,9 +104,6 @@ 

                  with_autochangelog=with_autochangelog,

              )

  

-             specfile.seek(0)

-             contents = specfile.read()  # noqa

- 

              features = misc.check_specfile_features(specpath_type(specfile.name))

  

              assert features.has_autorelease == bool(with_autorelease)

In the course, remove some stray debugging statements in a test.

Fixes: #270

Signed-off-by: Nils Philippsen nils@redhat.com

Build succeeded.

Pull-Request has been merged by nphilipp

a year ago