diff --git a/rpmlint/checks/TagsCheck.py b/rpmlint/checks/TagsCheck.py index ad9a35f22..923538ba4 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([^)]+)') 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-in-grouping-1.0-1.src.rpm b/test/source/valid-exception-in-grouping-1.0-1.src.rpm new file mode 100644 index 000000000..c74b2f048 Binary files /dev/null and b/test/source/valid-exception-in-grouping-1.0-1.src.rpm differ diff --git a/test/test_tags.py b/test/test_tags.py index 210fb2dbf..42a831549 100644 --- a/test/test_tags.py +++ b/test/test_tags.py @@ -77,6 +77,18 @@ def test_valid_license_exception(tmpdir, package, tagscheck): assert 'W: invalid-license-exception' not in out +@pytest.mark.parametrize('package', ['source/valid-exception-in-grouping']) +def test_valid_license_exception_in_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