@@ -108,26 +108,29 @@ def compareDb(db1, db2, ignore=None):
108
108
temp ._type = "Signal Defines"
109
109
result .addChild (temp )
110
110
111
- for vt1 in db1 .valueTables :
112
- if vt1 not in db2 .valueTables :
113
- result .addChild (
114
- compareResult (
115
- "deleted" ,
116
- "valuetable " + vt1 ,
117
- db1 .valueTables ))
118
- else :
119
- result .addChild (
120
- compareValueTable (
121
- db1 .valueTables [vt1 ],
122
- db2 .valueTables [vt1 ]))
111
+ if "VALUETABLES" in ignore and ignore ["VALUETABLES" ]:
112
+ pass
113
+ else :
114
+ for vt1 in db1 .valueTables :
115
+ if vt1 not in db2 .valueTables :
116
+ result .addChild (
117
+ compareResult (
118
+ "deleted" ,
119
+ "valuetable " + vt1 ,
120
+ db1 .valueTables ))
121
+ else :
122
+ result .addChild (
123
+ compareValueTable (
124
+ db1 .valueTables [vt1 ],
125
+ db2 .valueTables [vt1 ]))
123
126
124
- for vt2 in db2 .valueTables :
125
- if vt2 not in db1 .valueTables :
126
- result .addChild (
127
- compareResult (
128
- "added" ,
129
- "valuetable " + vt2 ,
130
- db2 .valueTables ))
127
+ for vt2 in db2 .valueTables :
128
+ if vt2 not in db1 .valueTables :
129
+ result .addChild (
130
+ compareResult (
131
+ "added" ,
132
+ "valuetable " + vt2 ,
133
+ db2 .valueTables ))
131
134
132
135
propagateChanges (result )
133
136
@@ -250,11 +253,12 @@ def compareAttributes(ele1, ele2, ignore=None):
250
253
def compareBu (bu1 , bu2 , ignore = None ):
251
254
result = compareResult ("equal" , "ECU" , bu1 )
252
255
253
- if bu1 .comment != bu2 .comment :
254
- result .addChild (
255
- compareResult (
256
- "changed" , "ECU" , bu1 , [
257
- bu1 .comment , bu2 .comment ]))
256
+ if not "comment" in ignore :
257
+ if bu1 .comment != bu2 .comment :
258
+ result .addChild (
259
+ compareResult (
260
+ "changed" , "ECU" , bu1 , [
261
+ bu1 .comment , bu2 .comment ]))
258
262
259
263
if ignore is not None and "ATTRIBUTE" in ignore and ignore [
260
264
"ATTRIBUTE" ] == "*" :
@@ -293,15 +297,16 @@ def compareFrame(f1, f2, ignore=None):
293
297
"extended-Flag: %d" %
294
298
f1 .extended , "extended-Flag: %d" %
295
299
f2 .extended ]))
296
- if f2 .comment is None :
297
- f2 .addComment ("" )
298
- if f1 .comment is None :
299
- f1 .addComment ("" )
300
- if f1 .comment != f2 .comment :
301
- result .addChild (
302
- compareResult (
303
- "changed" , "FRAME" , f1 , [
304
- "comment: " + f1 .comment , "comment: " + f2 .comment ]))
300
+ if not "comment" in ignore :
301
+ if f2 .comment is None :
302
+ f2 .addComment ("" )
303
+ if f1 .comment is None :
304
+ f1 .addComment ("" )
305
+ if f1 .comment != f2 .comment :
306
+ result .addChild (
307
+ compareResult (
308
+ "changed" , "FRAME" , f1 , [
309
+ "comment: " + f1 .comment , "comment: " + f2 .comment ]))
305
310
306
311
for s2 in f2 .signals :
307
312
s1 = f1 .signalByName (s2 .name )
@@ -340,14 +345,14 @@ def compareFrame(f1, f2, ignore=None):
340
345
def compareSignal (s1 , s2 , ignore = None ):
341
346
result = compareResult ("equal" , "SIGNAL" , s1 )
342
347
343
- if s1 .startbit != s2 .startbit :
348
+ if s1 .startBit != s2 .startBit :
344
349
result .addChild (
345
350
compareResult (
346
351
"changed" , "startbit" , s1 , [
347
352
" %d" %
348
353
s1 .startbit , " %d" %
349
354
s2 .startbit ]))
350
- if s1 .signalsize != s2 .signalsize :
355
+ if s1 .size != s2 .size :
351
356
result .addChild (
352
357
compareResult (
353
358
"changed" , "signalsize" , s1 , [
@@ -396,17 +401,18 @@ def compareSignal(s1, s2, ignore=None):
396
401
compareResult (
397
402
"changed" , "unit" , s1 , [
398
403
s1 .unit , s2 .unit ]))
399
- if s1 .comment is not None and s2 .comment is not None and s1 .comment != s2 .comment :
400
- if s1 .comment .replace ("\n " , " " ) != s2 .comment .replace ("\n " , " " ):
401
- result .addChild (
402
- compareResult (
403
- "changed" , "comment" , s1 , [
404
- s1 .comment , s2 .comment ]))
405
- else :
406
- result .addChild (
407
- compareResult (
408
- "changed" , "comment" , s1 , [
409
- "only whitespaces differ" , "" ]))
404
+ if not "comment" in ignore :
405
+ if s1 .comment is not None and s2 .comment is not None and s1 .comment != s2 .comment :
406
+ if s1 .comment .replace ("\n " , " " ) != s2 .comment .replace ("\n " , " " ):
407
+ result .addChild (
408
+ compareResult (
409
+ "changed" , "comment" , s1 , [
410
+ s1 .comment , s2 .comment ]))
411
+ else :
412
+ result .addChild (
413
+ compareResult (
414
+ "changed" , "comment" , s1 , [
415
+ "only whitespaces differ" , "" ]))
410
416
411
417
for receiver in s1 .receiver :
412
418
if receiver .strip () not in s2 .receiver :
@@ -432,7 +438,10 @@ def compareSignal(s1, s2, ignore=None):
432
438
else :
433
439
result .addChild (compareAttributes (s1 , s2 , ignore ))
434
440
435
- result .addChild (compareValueTable (s1 .values , s2 .values ))
441
+ if "VALUETABLES" in ignore and ignore ["VALUETABLES" ]:
442
+ pass
443
+ else :
444
+ result .addChild (compareValueTable (s1 .values , s2 .values ))
436
445
437
446
return result
438
447
@@ -498,6 +507,25 @@ def main():
498
507
action = "store_true" ,
499
508
help = "show list of frames" ,
500
509
default = False )
510
+ parser .add_option (
511
+ "-c" , "--comments" ,
512
+ dest = "check_comments" ,
513
+ action = "store_true" ,
514
+ help = "check changed comments" ,
515
+ default = False )
516
+ parser .add_option (
517
+ "-a" , "--attributes" ,
518
+ dest = "check_attributes" ,
519
+ action = "store_true" ,
520
+ help = "check changed attributes" ,
521
+ default = False )
522
+ parser .add_option (
523
+ "-t" , "--valueTable" ,
524
+ dest = "ignore_valuetables" ,
525
+ action = "store_true" ,
526
+ help = "check changed valuetables" ,
527
+ default = False )
528
+
501
529
(cmdlineOptions , args ) = parser .parse_args ()
502
530
503
531
if len (args ) < 2 :
@@ -526,6 +554,17 @@ def main():
526
554
logger .info ("%d Frames found" % (db2 .frames .__len__ ()))
527
555
528
556
ignore = {}
557
+
558
+ if not cmdlineOptions .check_comments :
559
+ ignore ["comment" ] = "*"
560
+
561
+ if not cmdlineOptions .check_attributes :
562
+ ignore ["ATTRIBUTE" ] = "*"
563
+
564
+
565
+ if cmdlineOptions .ignore_valuetables :
566
+ ignore ["VALUETABLES" ] = True
567
+
529
568
if cmdlineOptions .frames :
530
569
onlyInMatrix1 = []
531
570
onlyInMatrix2 = []
0 commit comments