diff options
author | Jon Turney <jon.turney@dronecode.org.uk> | 2016-03-22 21:48:12 +0300 |
---|---|---|
committer | Jon Turney <jon.turney@dronecode.org.uk> | 2016-03-29 14:13:58 +0300 |
commit | b245856fe5e286431d75bab81e8ce68786b8b2d3 (patch) | |
tree | bd5a12737788d746d29dd27faa53e4e4c04414d8 | |
parent | 95ff7fea38070dbe9219172aecb043ddea659ead (diff) |
Improve checking sdesc for package name
- match case-insensitively
- try harder to manufacture a 'package basename'
- ignore whitespace before ':'
- look for 'packagename -' as well
-rwxr-xr-x | package.py | 17 |
1 files changed, 11 insertions, 6 deletions
@@ -203,13 +203,18 @@ def read_package(packages, basedir, dirpath, files, strict=False): if p in past_mistakes.self_source: packages[p].hints['self-source'] = '' - # don't allow a redundant 'package-initial-substring:' at start of sdesc + # don't allow a redundant 'package:' or 'package - ' at start of sdesc + # + # match case-insensitively, and use a base package name (trim off any + # leading 'lib' from package name, remove any soversion or 'devel' + # suffix) + # if 'sdesc' in hints: - sdesc = re.sub(r'^"|"$', '', hints['sdesc']) - colon = sdesc.find(':') - if colon > -1: - if sdesc[:colon] == p[:colon]: - logging.warning("package '%s' sdesc starts with '%s:'; this is redundant as the UI will show both the package name and sdesc" % (p, sdesc[:colon])) + colon = re.match(r'^"(.*?)(\s*:|\s+-)', hints['sdesc']) + if colon: + package_basename = re.sub(r'^lib(.*?)(|-devel|\d*)$', r'\1', p) + if package_basename.upper().startswith(colon.group(1).upper()): + logging.warning("package '%s' sdesc starts with '%s'; this is redundant as the UI will show both the package name and sdesc" % (p, ''.join(colon.group(1, 2)))) warnings = True elif (len(files) > 0) and (relpath.count(os.path.sep) > 0): |