handle license exception in grouping, better (rhbz#2175241)
Apply upstream commits 48aa148b (TagsCheck: restore space exclusion to license_exception_regex, 2023-03-20)¹ and 65abdbd3 (TagsCheck: handle license exception in first item of a grouping, 2023-03-20)² to improve the handling of license exceptions within groupings. ¹ https://github.com/rpm-software-management/rpmlint/commit/48aa148b ² https://github.com/rpm-software-management/rpmlint/commit/65abdbd3
This commit is contained in:
parent
3203e77b1d
commit
3b8cdae343
@ -0,0 +1,28 @@
|
||||
From 48aa148bd633aa4e27b28239d98cd809e0e45f22 Mon Sep 17 00:00:00 2001
|
||||
From: Todd Zullinger <tmz@pobox.com>
|
||||
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 <daniel.garcia@suse.com>
|
||||
---
|
||||
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)
|
@ -0,0 +1,97 @@
|
||||
From 65abdbd383166ce727ece30f79b0808f46c2da29 Mon Sep 17 00:00:00 2001
|
||||
From: Todd Zullinger <tmz@pobox.com>
|
||||
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(%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cmV?d00001
|
||||
|
||||
diff --git a/test/test_tags.py b/test/test_tags.py
|
||||
index 42a83154..6c5d5280 100644
|
||||
--- a/test/test_tags.py
|
||||
+++ b/test/test_tags.py
|
||||
@@ -89,6 +89,18 @@ def test_valid_license_exception_in_grouping(tmpdir, package, tagscheck):
|
||||
assert 'W: invalid-license-exception' not in out
|
||||
|
||||
|
||||
+@pytest.mark.parametrize('package', ['source/valid-exception-begin-grouping'])
|
||||
+def test_valid_license_exception_begin_grouping(tmpdir, package, tagscheck):
|
||||
+ CONFIG.info = True
|
||||
+ CONFIG.configuration['ValidLicenses'] = ['BSD-3-Clause', 'GPL-2.0-only']
|
||||
+ CONFIG.configuration['ValidLicenseExceptions'] = ['Qt-GPL-exception-1.0']
|
||||
+ output = Filter(CONFIG)
|
||||
+ test = TagsCheck(CONFIG, output)
|
||||
+ test.check(get_tested_package(package, tmpdir))
|
||||
+ out = output.print_results(output.results)
|
||||
+ assert 'W: invalid-license-exception' not in out
|
||||
+
|
||||
+
|
||||
@pytest.mark.parametrize('package', ['binary/xtables-addons-kmp-default'])
|
||||
def test_forbidden_controlchar_found_requires(tmpdir, package, tagscheck):
|
||||
output, test = tagscheck
|
@ -3,7 +3,7 @@
|
||||
|
||||
Name: rpmlint
|
||||
Version: 2.4.0
|
||||
Release: 5%{?dist}
|
||||
Release: 6%{?dist}
|
||||
Summary: Tool for checking common errors in RPM packages
|
||||
License: GPL-2.0-or-later
|
||||
URL: https://github.com/rpm-software-management/rpmlint
|
||||
@ -20,6 +20,8 @@ Patch0: https://github.com/rpm-software-management/rpmlint/commit/393cde
|
||||
|
||||
# https://bugzilla.redhat.com/2175241
|
||||
Patch1: https://github.com/rpm-software-management/rpmlint/commit/7d707f7f.patch#/0001-TagsCheck-handle-license-exception-in-grouping.patch
|
||||
Patch2: https://github.com/rpm-software-management/rpmlint/commit/48aa148b.patch#/0001-TagsCheck-restore-space-exclusion-to-license_excepti.patch
|
||||
Patch3: https://github.com/rpm-software-management/rpmlint/commit/65abdbd3.patch#/0002-TagsCheck-handle-license-exception-in-first-item-of-.patch
|
||||
|
||||
BuildArch: noarch
|
||||
|
||||
@ -86,6 +88,9 @@ cp -a %{SOURCE1} %{SOURCE3} %{SOURCE4} %{SOURCE5} %{buildroot}%{_sysconfdir}/xdg
|
||||
%{_bindir}/rpmlint
|
||||
|
||||
%changelog
|
||||
* Mon Mar 20 2023 Todd Zullinger <tmz@pobox.com> - 2.4.0-6
|
||||
- handle license exception in grouping, better (rhbz#2175241)
|
||||
|
||||
* Mon Mar 06 2023 Todd Zullinger <tmz@pobox.com> - 2.4.0-5
|
||||
- handle license exception in grouping (rhbz#2175241)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user