diff --git a/0001-TagsCheck-restore-space-exclusion-to-license_excepti.patch b/0001-TagsCheck-restore-space-exclusion-to-license_excepti.patch new file mode 100644 index 0000000..e52e93b --- /dev/null +++ b/0001-TagsCheck-restore-space-exclusion-to-license_excepti.patch @@ -0,0 +1,28 @@ +From 48aa148bd633aa4e27b28239d98cd809e0e45f22 Mon Sep 17 00:00:00 2001 +From: Todd Zullinger +Date: Mon, 20 Mar 2023 03:14:14 -0400 +Subject: [PATCH] TagsCheck: restore space exclusion to license_exception_regex + +In 7d707f7f (TagsCheck: handle license exception in grouping, +2023-03-03), the regex lost the exclusion of space characters. This +isn't immediately noticeable because we strip the strings generated by +the regex before use, but it's better to keep the regex more precise. + +Suggested-by: Daniel Garcia Moreno +--- + rpmlint/checks/TagsCheck.py | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/rpmlint/checks/TagsCheck.py b/rpmlint/checks/TagsCheck.py +index 923538ba..65c75c92 100644 +--- a/rpmlint/checks/TagsCheck.py ++++ b/rpmlint/checks/TagsCheck.py +@@ -21,7 +21,7 @@ + leading_space_regex = re.compile(r'^\s+') + pkg_config_regex = re.compile(r'^/usr/(?:lib\d*|share)/pkgconfig/') + license_regex = re.compile(r'\(([^)]+)\)|\s(?:and|or|AND|OR)\s') +-license_exception_regex = re.compile(r'(\S+)\s(?:WITH|with)\s([^)]+)') ++license_exception_regex = re.compile(r'(\S+)\s(?:WITH|with)\s([^)\s]+)') + invalid_version_regex = re.compile(r'([0-9](?:rc|alpha|beta|pre).*)', re.IGNORECASE) + # () are here for grouping purpose in the regexp + tag_regex = re.compile(r'^((?:Auto(?:Req|Prov|ReqProv)|Build(?:Arch(?:itectures)?|Root)|(?:Build)?Conflicts|(?:Build)?(?:Pre)?Requires|Copyright|(?:CVS|SVN)Id|Dist(?:ribution|Tag|URL)|DocDir|(?:Build)?Enhances|Epoch|Exclu(?:de|sive)(?:Arch|OS)|Group|Icon|License|Name|No(?:Patch|Source)|Obsoletes|Packager|Patch\d*|Prefix(?:es)?|Provides|(?:Build)?Recommends|Release|RHNPlatform|Serial|Source\d*|(?:Build)?Suggests|Summary|(?:Build)?Supplements|(?:Bug)?URL|Vendor|Version)(?:\([^)]+\))?:)\s*\S', re.IGNORECASE) diff --git a/0002-TagsCheck-handle-license-exception-in-first-item-of-.patch b/0002-TagsCheck-handle-license-exception-in-first-item-of-.patch new file mode 100644 index 0000000..b23d36f --- /dev/null +++ b/0002-TagsCheck-handle-license-exception-in-first-item-of-.patch @@ -0,0 +1,97 @@ +From 65abdbd383166ce727ece30f79b0808f46c2da29 Mon Sep 17 00:00:00 2001 +From: Todd Zullinger +Date: Mon, 20 Mar 2023 03:20:44 -0400 +Subject: [PATCH] TagsCheck: handle license exception in first item of a + grouping + +The change in 7d707f7f (TagsCheck: handle license exception in grouping, +2023-03-03) is insufficient when the exception is on the first item in a +grouping, e.g.: + + License: (Apache-2.0 WITH LLVM-exception OR NCSA) AND BSD-3-Clause + +Adjust `license_exception_regex` to exclude a leading '(' as well as a +trailing ')'. +--- + rpmlint/checks/TagsCheck.py | 2 +- + .../valid-exception-begin-grouping-1.0-1.src.rpm | Bin 0 -> 6644 bytes + test/test_tags.py | 12 ++++++++++++ + 3 files changed, 13 insertions(+), 1 deletion(-) + create mode 100644 test/source/valid-exception-begin-grouping-1.0-1.src.rpm + +diff --git a/rpmlint/checks/TagsCheck.py b/rpmlint/checks/TagsCheck.py +index 65c75c92..64088f55 100644 +--- a/rpmlint/checks/TagsCheck.py ++++ b/rpmlint/checks/TagsCheck.py +@@ -21,7 +21,7 @@ + leading_space_regex = re.compile(r'^\s+') + pkg_config_regex = re.compile(r'^/usr/(?:lib\d*|share)/pkgconfig/') + license_regex = re.compile(r'\(([^)]+)\)|\s(?:and|or|AND|OR)\s') +-license_exception_regex = re.compile(r'(\S+)\s(?:WITH|with)\s([^)\s]+)') ++license_exception_regex = re.compile(r'([^(\s]+)\s(?:WITH|with)\s([^)\s]+)') + invalid_version_regex = re.compile(r'([0-9](?:rc|alpha|beta|pre).*)', re.IGNORECASE) + # () are here for grouping purpose in the regexp + tag_regex = re.compile(r'^((?:Auto(?:Req|Prov|ReqProv)|Build(?:Arch(?:itectures)?|Root)|(?:Build)?Conflicts|(?:Build)?(?:Pre)?Requires|Copyright|(?:CVS|SVN)Id|Dist(?:ribution|Tag|URL)|DocDir|(?:Build)?Enhances|Epoch|Exclu(?:de|sive)(?:Arch|OS)|Group|Icon|License|Name|No(?:Patch|Source)|Obsoletes|Packager|Patch\d*|Prefix(?:es)?|Provides|(?:Build)?Recommends|Release|RHNPlatform|Serial|Source\d*|(?:Build)?Suggests|Summary|(?:Build)?Supplements|(?:Bug)?URL|Vendor|Version)(?:\([^)]+\))?:)\s*\S', re.IGNORECASE) +diff --git a/test/source/valid-exception-begin-grouping-1.0-1.src.rpm b/test/source/valid-exception-begin-grouping-1.0-1.src.rpm +new file mode 100644 +index 0000000000000000000000000000000000000000..d0aba4903debd79db253b7655f3a001f2edfe0b2 +GIT binary patch +literal 6644 +zcmeI0X>3$g6vyv$3f3aFEV78;Lm+IK;q6OBs1%_PECOW_i}IHHrlYf^^Qr?V`=X#k +z!y+0!ARz{1u?UI;(1I2aF%Y7H0*L|z1leR&YwJ1f1&N9H#c$3_PXF)s&Rx&DeUtpp +ztv-L)Pl%8Bo;M?5CqPp+O?csWEMU=4I2H(%#mf`nSSTO_`G7#~eECSDzc-k__Oy>Z +zyNi(Ajd0%w0`FIV=EBrXK^sHh1#NxJK#{vQu>Uk@CPaks&!EtsBp{%_{{krHr$Rt~ +z|3y&D&xAB5Qd^>uVJNn!nX)7cifh{%6?jm^po&99jmk151~pBWw+&s;ZR%*YVGD}o +z2vl=aNpMBpRe8(SWSiGy)#6Rc^NOG;)U-^^q@ruXgoI?3R0xNCyC+vK%R3uLG!s62 +zlaP$9^{MoqbOq8CNLL_Tfpi7Z6-ZYgU4e83(iKQoAYFlU1=1DxzgM8%6RE4KdmRb^ +zo(3Ve`6dc@8jIjjUkLCu{Ifu@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6 +- handle license exception in grouping, better (rhbz#2175241) + * Mon Mar 06 2023 Todd Zullinger - 2.4.0-5 - handle license exception in grouping (rhbz#2175241)