SHA256
1
0
forked from pool/rpmlint
rpmlint/accept-licenses-with-plus.patch

39 lines
1.6 KiB
Diff
Raw Normal View History

Index: rpmlint-rpmlint-1.11/TagsCheck.py
===================================================================
--- rpmlint-rpmlint-1.11.orig/TagsCheck.py
+++ rpmlint-rpmlint-1.11/TagsCheck.py
@@ -845,12 +845,19 @@ class TagsCheck(AbstractCheck.AbstractCh
return (x.strip() for x in
(l for l in license_regex.split(license) if l))
+ def is_valid_license(license):
+ if license in VALID_LICENSES:
+ return True
+ if license.endswith('+'):
+ return license[:-1] in VALID_LICENSES
+ return False
+
rpm_license = pkg[rpm.RPMTAG_LICENSE]
if not rpm_license:
printError(pkg, 'no-license')
else:
valid_license = True
- if rpm_license not in VALID_LICENSES:
+ if not is_valid_license(rpm_license):
license_string = rpm_license
l1, lexception = split_license_exception(rpm_license)
@@ -862,10 +869,10 @@ class TagsCheck(AbstractCheck.AbstractCh
valid_license = False
for l1 in split_license(license_string):
- if l1 in VALID_LICENSES:
+ if is_valid_license(l1):
continue
for l2 in split_license(l1):
- if l2 not in VALID_LICENSES:
+ if not is_valid_license(l2):
printWarning(pkg, 'invalid-license', l2)
valid_license = False
if not valid_license: