#725 Fix regular expression for parsing Source lines
Merged by onosek. Opened by onosek.
onosek/rpkg source_regexp  into  master

Download 725.patch

When pushing changes to the dist-git repo, the pre-push-check
didn't identify hidden files (.file) among 'SourceX|PatchX'
definitions. The regular expression was taken from another part
of the code and improved.

Fixes: #721
JIRA: RHELCMP-13881

Signed-off-by: Ondřej Nosek onosek@redhat.com

The new regex does not match this valid unnumbered source and patch syntax:

Source: something.tar.gz
Patch: another.patch

Please replace \d+ with ḑ* to fix that.

@oturpe I tried (yesterday) to find the authoritative answer for the regular expression in manuals and rpm sources. I didn't see the version without the number at Source/Patch. Do you have some material that supports the opposite?

Additionally, Source/Path were always with capital. I kept the original re.IGNORECASE
Even the \s* right before the colon might be possibly omitted.

Unfortunately, I am not aware of an authoritative source either. I learned about this syntax from this Fedora packaging thread. And indeed, all examples in Fedora Packaging Guidelines actually use this form. For example, see Patch Guidelines.

Testing with RPM 4.20 (and with no reason to believe this has changed recently, or ever), all tags are read in case insensitive manner. So re.IGNORECASE is appropriate here.

This would probably be worth a documentation issue for rpm.org. Spec File format page does not do a good job explaining the options.

@oturpe, you are right. I verified the parsing with rpmbuild. Unnumbered keywords (as well as case-insensitive variants) are accepted. I will consider rpmbuild as authoritative enough. Thanks.

rebased onto 4a1ed7633aad84c8e3bd9e856b5d8d95136a739d

rebased onto 53a12c6fea813598851af65390695a69c8f29b76

Pull-Request has been merged by onosek

Rpm.org documentation issue: rpm#3384

Metadata