Skip to content

Commit

Permalink
etc/tidy: don't check SNAP against triple
Browse files Browse the repository at this point in the history
  • Loading branch information
adrientetar committed Feb 5, 2014
1 parent 2bf575c commit fc1d655
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 9 deletions.
30 changes: 25 additions & 5 deletions src/etc/snapshot.py
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,30 @@ def in_tar_name(fn):

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)

Expand Down Expand Up @@ -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)
9 changes: 5 additions & 4 deletions src/etc/tidy.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,12 +57,13 @@ def do_license_check(name, contents):
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):
Expand Down

0 comments on commit fc1d655

Please sign in to comment.