From fc1d655ed29a6ead06dfccece1b585e2c4212e16 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Adrien=20T=C3=A9tar?= Date: Sun, 2 Feb 2014 11:24:43 +0100 Subject: [PATCH] etc/tidy: don't check SNAP against triple --- src/etc/snapshot.py | 30 +++++++++++++++++++++++++----- src/etc/tidy.py | 9 +++++---- 2 files changed, 30 insertions(+), 9 deletions(-) diff --git a/src/etc/snapshot.py b/src/etc/snapshot.py index 8aeee7e22eb..036bfd2cf08 100644 --- a/src/etc/snapshot.py +++ b/src/etc/snapshot.py @@ -195,7 +195,30 @@ def make_snapshot(stage, triple): return file1 -def determine_curr_snapshot_info(triple): +def curr_snapshot_rev(): + i = 0 + found_snap = False + date = None + rev = None + + f = open(snapshotfile) + for line in f.readlines(): + i += 1 + parsed = parse_line(i, line) + if (not parsed): continue + + if parsed["type"] == "snapshot": + date = parsed["date"] + rev = parsed["rev"] + found_snap = True + break + + if not found_snap: + raise Exception("no snapshot entries in file") + + return (date, rev) + +def determine_curr_snapshot(triple): i = 0 platform = get_platform(triple) @@ -228,7 +251,4 @@ def determine_curr_snapshot_info(triple): raise Exception("no snapshot file found for platform %s, rev %s" % (platform, rev)) - return (date, rev, platform, hsh) - -def determine_curr_snapshot(triple): - return full_snapshot_name(*determine_curr_snapshot_info(triple)) + return full_snapshot_name(date, rev, platform, hsh) diff --git a/src/etc/tidy.py b/src/etc/tidy.py index 8157ffba3ef..bd6448d156e 100644 --- a/src/etc/tidy.py +++ b/src/etc/tidy.py @@ -57,12 +57,13 @@ try: match = re.match(r'^.*//\s*SNAP\s+(\w+)', line) if match: hsh = match.group(1) - a, b, c, phash = snapshot.determine_curr_snapshot_info() - if not phash.startswith(hsh): - report_err("Snapshot out of date: " + line) + date, rev = snapshot.curr_snapshot_rev() + if not hsh.startswith(rev): + report_err("snapshot out of date (" + date + + "): " + line) else: if "SNAP" in line: - report_warn("Unmatched SNAP line: " + line) + report_warn("unmatched SNAP line: " + line) if (line.find('\t') != -1 and fileinput.filename().find("Makefile") == -1):