diff options
author | Jon Turney <jon.turney@dronecode.org.uk> | 2016-06-24 16:23:02 +0300 |
---|---|---|
committer | Jon Turney <jon.turney@dronecode.org.uk> | 2016-06-24 16:23:02 +0300 |
commit | 28e8934c71f5a7d0445fadf3840db28c63e525d3 (patch) | |
tree | ca6e88873e8a37a23281a76e92410565dd8ef1ff | |
parent | c6c1b815b02daaffc9ff85cc6d8dd0d498cfe174 (diff) |
Check packages which share the same source package are all at the same version
Report the offending packages if they aren't listed as past mistakes
-rwxr-xr-x | calm/package.py | 38 | ||||
-rw-r--r-- | calm/past_mistakes.py | 26 |
2 files changed, 64 insertions, 0 deletions
diff --git a/calm/package.py b/calm/package.py index 514f386..dbfe394 100755 --- a/calm/package.py +++ b/calm/package.py @@ -50,6 +50,7 @@ class Package(object): self.path = '' # path to package, relative to release area self.tars = {} self.hints = {} + self.is_used_by = set() def __repr__(self): return "Package('%s', %s, %s)" % (self.path, pprint.pformat(self.tars), @@ -440,6 +441,7 @@ def validate_packages(args, packages): # mark the source tarfile as being used by an install tarfile if 'source' in packages[p].vermap[v]: packages[p].tars[packages[p].vermap[v]['source']].is_used = True + packages[p].is_used_by.add(p) continue if 'external-source' in packages[p].hints: @@ -447,6 +449,7 @@ def validate_packages(args, packages): if es_p in packages: if 'source' in packages[es_p].vermap[v]: packages[es_p].tars[packages[es_p].vermap[v]['source']].is_used = True + packages[es_p].is_used_by.add(p) continue # unless this package is marked as 'self-source' @@ -470,6 +473,41 @@ def validate_packages(args, packages): logging.error("package '%s' version '%s' source has no non-empty install tarfiles" % (p, v)) error = True + # do all the packages which use this source package have the same + # current version? + for source_p in sorted(packages.keys()): + versions = defaultdict(list) + + for install_p in packages[source_p].is_used_by: + # ignore obsolete packages + if '_obsolete' in packages[install_p].hints['category']: + continue + # ignore runtime library packages, as we may keep old versions of + # those + if re.match(r'^lib.*\d', install_p): + continue + + versions[packages[install_p].stability['curr']].append(install_p) + + if len(versions) > 1: + out = [] + most_common = True + + for v in sorted(versions, key=lambda v: len(versions[v]), reverse=True): + # try to keep the output compact by not listing all the packages + # the most common current version has, unless it's only one. + if most_common and len(versions[v]) != 1: + out.append("%s (%s others)" % (v, len(versions[v]))) + else: + out.append("%s (%s)" % (v, ','.join(versions[v]))) + most_common = False + + lvl = logging.DEBUG + if source_p not in past_mistakes.nonunique_versions: + lvl = logging.ERROR + error = True + logging.log(lvl, "install packages from source package '%s' have non-unique current versions %s" % (source_p, ', '.join(reversed(out)))) + # validate that all packages are in the package maintainers list validate_package_maintainers(args, packages) diff --git a/calm/past_mistakes.py b/calm/past_mistakes.py index 5e1132f..e4acfcb 100644 --- a/calm/past_mistakes.py +++ b/calm/past_mistakes.py @@ -95,3 +95,29 @@ self_source = [ 'tesseract-training-spa', 'tesseract-training-vie', ] + +# these are source packages which currently have non-unique install versions +nonunique_versions = [ + 'bzr', # debuginfo from NMU needs to age out? + 'cgdb', # ditto + 'e2fsprogs', + 'fltk', + 'gnome-panel', + 'guile', + 'libical', + 'libjpeg-turbo', # libturbojpeg isn't detected as an old soversion + 'librsvg2', + 'mutter', + 'ocaml', # ocaml-camlp4 removed from ocaml distribution after 4.01.0 + 'openmpi', # libopenmpi isn't detected as an old soversion + 'python-openssl', # no debuginfo anymore due to pure python? + 'python3-openssl', # ditto? + 'qt5-webkit', + 'rsync', # debuginfo from NMU needs to age out? + 'ruby-gdk3', + 'sng', + 'socat', + 'sqlite3', # sqlite3-zlib removed in 3.8.10, use sqlite3-compress instead + 'w3m', + 'zlib', +] |