From 3bc5a23184c6f598cf3a9670ada03c6f00764a39 Mon Sep 17 00:00:00 2001 From: Lars Wirzenius Date: Mon, 1 Apr 2013 23:01:19 +0100 Subject: Run reprepro directly --- check-code.liw.fi-versions | 31 +++++++++++++++++++++++++++---- 1 file changed, 27 insertions(+), 4 deletions(-) diff --git a/check-code.liw.fi-versions b/check-code.liw.fi-versions index 8394a2d..eac6d8e 100755 --- a/check-code.liw.fi-versions +++ b/check-code.liw.fi-versions @@ -8,14 +8,36 @@ # is x.y-z.foo +import subprocess import sys +def produce_package_data(): + with open('/home/liw/code.liw.fi/debian/conf/distributions') as f: + text = f.read() -def read_package_data(f): + codenames = set( + line.split()[1] + for line in text.splitlines() + if line.startswith('Codename:')) + + data = '' + for codename in codenames: + p = subprocess.Popen( + ['reprepro', '-b', '/home/liw/code.liw.fi/debian', 'list', codename], + stdout=subprocess.PIPE) + out, err = p.communicate('') + if p.returncode != 0: + raise Exception('reprepro failed:\n%s' % err) + data += out + + return data + + +def parse_package_data(text): data = [] - for line in f: - pkg, version, s = line.split() + for line in text.splitlines(): + s, pkg, version = line.split() codename, main, arch = s.split('|') if arch.endswith(':'): arch = arch[:-1] @@ -61,7 +83,8 @@ def check_package(data, package): (package, v, expected) def main(): - data = read_package_data(sys.stdin) + text = produce_package_data() + data = parse_package_data(text) for p in sorted(list(packages(data))): check_package(data, p) -- cgit v1.2.1