#!/usr/bin/python import sys import re # Match the format we use to find # where entries begin date_format="\d{1,2} \w{3} \d{4}" # Used in version/revision bumps *foobar-1.0 (date) date_regex = re.compile(date_format) # Used in entries with the actual change text date_regex_semi = re.compile(date_format + ";") # + is used in package names (for example gtk+) so try to handle that ebuild_regex = re.compile("((,|\s)\+[\S\+]+\.ebuild)") def check_changelog(file): f = open(file) lines = f.readlines() # All *${P} entries as ${P} bumps = [] file_printed = False # Scan the whole file for new entries because with for example moves # from one category to another we have the ebuilds appearing as new # ones again for line in lines: if line.startswith("*"): if not date_regex.search(line): if not file_printed: print file + ":" file_printed = True sys.stdout.write("\tbad date entry for new revision/version entry: " + line) else: try: bumps.append(line[1:line.index(" ")]) except ValueError: sys.stderr.write("Failure in parsing: " + file + "\n") n=0 length = len(lines) while n < length: line = lines[n] if date_regex_semi.search(line): while True: for m in ebuild_regex.findall(line): # remove + and trailing .ebuild to_find = m[0][2:-7] if not to_find in bumps: if not file_printed: print file + ":" file_printed = True print "\tMissing new ebuild entry *${P} (date) for entry 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)