From 834a5a54eb8aaf7231c7cb7a9bd12f3655f530db Mon Sep 17 00:00:00 2001 From: Lars Wirzenius Date: Mon, 1 Apr 2013 22:49:30 +0100 Subject: Initial --- check-code.liw.fi-versions | 70 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 70 insertions(+) create mode 100755 check-code.liw.fi-versions (limited to 'check-code.liw.fi-versions') diff --git a/check-code.liw.fi-versions b/check-code.liw.fi-versions new file mode 100755 index 0000000..8394a2d --- /dev/null +++ b/check-code.liw.fi-versions @@ -0,0 +1,70 @@ +#!/usr/bin/python +# +# All is OK if: +# +# - every package is in each architecture +# - every package is in each codename +# - if the version in unstable is x.y-z, then the version in codename foo +# is x.y-z.foo + + +import sys + + + +def read_package_data(f): + data = [] + for line in f: + pkg, version, s = line.split() + codename, main, arch = s.split('|') + if arch.endswith(':'): + arch = arch[:-1] + data.append((pkg, codename, arch, version)) + return data + + +def packages(data): + return set(p for p, c, a, v in data) + + +def check_package(data, package): + # Is the package in every architecture? + all_arches = set(a for p, c, a, v in data) + arches_with_p = set(a for p, c, a, v in data if p == package) + missing_from_arches = all_arches.difference(arches_with_p) + for arch in missing_from_arches: + print 'ERROR: package %s not in arch %s' % (package, arch) + + # Is the package in every codename? + all_codenames = set(c for p, c, a, v in data) + codenames_with_p = set(c for p, c, a, v in data if p == package) + missing_from_codenames = all_codenames.difference(codenames_with_p) + for codename in missing_from_codenames: + print 'ERROR: package %s not in codename %s' % (package, codename) + + # Does the package have the same version (modulo ".$codename" suffix) + # in every codename? + unstable_versions = set( + v for p, c, a, v in data if p == package and c == 'unstable') + if len(unstable_versions) == 0: + print 'ERROR: package %s not in unstable' % package + elif len(unstable_versions) > 1: + print 'ERROR: package %s has more than one version in unstable' % \ + package + else: + uv = unstable_versions.pop() + for p, c, a, v in data: + if p == package and c != 'unstable': + expected = '%s.%s' % (uv, c) + if v != expected: + print 'ERROR: package %s has version %s, expected %s' % \ + (package, v, expected) + +def main(): + data = read_package_data(sys.stdin) + + for p in sorted(list(packages(data))): + check_package(data, p) + + +main() -- cgit v1.2.1