#!/usr/bin/python import sys import re # Match the format we use to find # where entries begin date_regex = re.compile("\d{2} \w{3} \d{4};") ebuild_regex = re.compile("\+\S+\.ebuild") def check_changelog(file): f = open(file) lines = f.readlines() n=0 length = len(lines) while n < length: line = lines[n] if date_regex.search(line): while True: for m in ebuild_regex.findall(line): # remove + and trailing .ebuild to_find = m[1:-7] i = n-1 match = False while i >= 0 and not match: match = lines[i].startswith("*" + to_find) i-=1 if not match: print file + " is broken (new ebuild on line " + str(n+1) + ")" n+=1 if line.find(":") >= 0 or n == length: break line = lines[n] n+=1 f.close() for ch in sys.argv[1:]: check_changelog(ch)