File tree Expand file tree Collapse file tree 2 files changed +30
-9
lines changed
Expand file tree Collapse file tree 2 files changed +30
-9
lines changed Original file line number Diff line number Diff line change @@ -195,7 +195,30 @@ def in_tar_name(fn):
195195
196196 return file1
197197
198- def determine_curr_snapshot_info (triple ):
198+ def curr_snapshot_rev ():
199+ i = 0
200+ found_snap = False
201+ date = None
202+ rev = None
203+
204+ f = open (snapshotfile )
205+ for line in f .readlines ():
206+ i += 1
207+ parsed = parse_line (i , line )
208+ if (not parsed ): continue
209+
210+ if parsed ["type" ] == "snapshot" :
211+ date = parsed ["date" ]
212+ rev = parsed ["rev" ]
213+ found_snap = True
214+ break
215+
216+ if not found_snap :
217+ raise Exception ("no snapshot entries in file" )
218+
219+ return (date , rev )
220+
221+ def determine_curr_snapshot (triple ):
199222 i = 0
200223 platform = get_platform (triple )
201224
@@ -228,7 +251,4 @@ def determine_curr_snapshot_info(triple):
228251 raise Exception ("no snapshot file found for platform %s, rev %s" %
229252 (platform , rev ))
230253
231- return (date , rev , platform , hsh )
232-
233- def determine_curr_snapshot (triple ):
234- return full_snapshot_name (* determine_curr_snapshot_info (triple ))
254+ return full_snapshot_name (date , rev , platform , hsh )
Original file line number Diff line number Diff line change @@ -57,12 +57,13 @@ def do_license_check(name, contents):
5757 match = re .match (r'^.*//\s*SNAP\s+(\w+)' , line )
5858 if match :
5959 hsh = match .group (1 )
60- a , b , c , phash = snapshot .determine_curr_snapshot_info ()
61- if not phash .startswith (hsh ):
62- report_err ("Snapshot out of date: " + line )
60+ date , rev = snapshot .curr_snapshot_rev ()
61+ if not hsh .startswith (rev ):
62+ report_err ("snapshot out of date (" + date
63+ + "): " + line )
6364 else :
6465 if "SNAP" in line :
65- report_warn ("Unmatched SNAP line: " + line )
66+ report_warn ("unmatched SNAP line: " + line )
6667
6768 if (line .find ('\t ' ) != - 1 and
6869 fileinput .filename ().find ("Makefile" ) == - 1 ):
You can’t perform that action at this time.
0 commit comments