#449 gpgverify check should handle missing %prep
Merged 2 years ago by ngompa. Opened 2 years ago by salimma.
salimma/FedoraReview ignore_missing_prep  into  master

gpgverify check should handle missing %prep
Michel Alexandre Salim • 2 years ago  
file modified
+1 -1
@@ -581,7 +581,7 @@ 

          other_before = False

          command_pattern = re.compile(r"/gpgverify ")

          comment_pattern = re.compile(r"^[ \t]*#")

-         for line in self.spec.get_section("prep"):

+         for line in self.spec.get_section("prep") or []:

              if comment_pattern.match(line) is None:

                  if command_pattern.search(line) is None:

                      other_seen = True

Having a %prep section is not mandatory (it generates an rpmlint warning, not error), but not having it causes the gpgverify SHOULD plugin to fail as it assumes the section exists.

Handle this by using or [] before iterating over the section's lines,
as get_section returns None on non-existent sections.

Fixes #448.

Signed-off-by: Michel Alexandre Salim salimma@fedoraproject.org

rebased onto bcfd556

2 years ago

Pull-Request has been merged by ngompa

2 years ago
Metadata