--- TagsCheck.py~ 2007-08-16 11:45:01.000000000 -0400 +++ TagsCheck.py 2007-08-30 01:48:27.000000000 -0400 @@ -403,6 +403,7 @@ invalid_url_regex=re.compile(Config.getOption('InvalidURL'), re.IGNORECASE) lib_regex=re.compile('^lib.*?(\.so.*)?$') leading_space_regex=re.compile('^\s+') +license_regex=re.compile('\(([^)]+)\)|\s(?:and|or)\s') invalid_version_regex=re.compile('([0-9](?:rc|alpha|beta|pre).*)', re.IGNORECASE) # () are here for grouping purpose in the regexp forbidden_words_regex=re.compile('(' + Config.getOption('ForbiddenWords') + ')', re.IGNORECASE) @@ -628,16 +629,20 @@ # printWarning(pkg, 'package-provides-itself') # break + def split_license(license): + return map(string.strip, [l for l in license_regex.split(license) if l]) + rpm_license = pkg[rpm.RPMTAG_LICENSE] if not rpm_license: printError(pkg, 'no-license') else: if rpm_license not in VALID_LICENSES: - licenses = re.split('\s(?:and|or)\s|[()]', rpm_license) - for l in licenses: - l = l.strip() - if l != '' and not l in VALID_LICENSES: - printWarning(pkg, 'invalid-license', l) + for l1 in split_license(rpm_license): + if l1 in VALID_LICENSES: + continue + for l2 in split_license(l1): + if l2 not in VALID_LICENSES: + printWarning(pkg, 'invalid-license', l2) url=pkg[rpm.RPMTAG_URL] if url and url != 'none':