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):
195
195
196
196
return file1
197
197
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 ):
199
222
i = 0
200
223
platform = get_platform (triple )
201
224
@@ -228,7 +251,4 @@ def determine_curr_snapshot_info(triple):
228
251
raise Exception ("no snapshot file found for platform %s, rev %s" %
229
252
(platform , rev ))
230
253
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):
57
57
match = re .match (r'^.*//\s*SNAP\s+(\w+)' , line )
58
58
if match :
59
59
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 )
63
64
else :
64
65
if "SNAP" in line :
65
- report_warn ("Unmatched SNAP line: " + line )
66
+ report_warn ("unmatched SNAP line: " + line )
66
67
67
68
if (line .find ('\t ' ) != - 1 and
68
69
fileinput .filename ().find ("Makefile" ) == - 1 ):
You can’t perform that action at this time.
0 commit comments