28 added = db2files - db1files |
28 added = db2files - db1files |
29 common = db1files & db2files |
29 common = db1files & db2files |
30 |
30 |
31 touched = set() |
31 touched = set() |
32 for file in common: |
32 for file in common: |
33 if(db1[file]['time'] != db2[file]['time']): |
33 if(int(db1[file]['time']) != int(db2[file]['time'])): |
|
34 print 'touched %s %s - %s' % (db1[file]['time'], db2[file]['time'],file) |
34 touched.add(file) |
35 touched.add(file) |
35 |
36 |
36 sizechanged = set() |
37 sizechanged = set() |
37 for file in common: |
38 for file in common: |
38 if(db1[file]['size'] != db2[file]['size']): |
39 if(int(db1[file]['size']) != int(db2[file]['size'])): |
39 sizechanged.add(file) |
40 sizechanged.add(file) |
40 |
41 |
41 changed = set() |
42 changed = set() |
42 |
43 |
43 genmd5 = 1 #I probably want to try to generate... add this as a third arg??? |
44 genmd5 = 1 #I probably want to try to generate... add this as a third arg??? |
54 db2[file]['md5'] = md5s[file]['md5'] |
55 db2[file]['md5'] = md5s[file]['md5'] |
55 for file in touched: |
56 for file in touched: |
56 if(db1[file]['md5'] != db2[file]['md5']): |
57 if(db1[file]['md5'] != db2[file]['md5']): |
57 changed.add(file) |
58 changed.add(file) |
58 touched = touched - changed |
59 touched = touched - changed |
59 |
60 |
60 untestable1 = set() |
|
61 untestable2 = set() |
|
62 for file in common: |
|
63 if(db1[file]['md5'] == "xxx"): |
|
64 untestable1.add(file) |
|
65 if(db2[file]['md5'] == 'xxx'): |
|
66 untestable2.add(file) |
|
67 |
|
68 untestable = untestable1 & untestable2 |
|
69 changed = changed - untestable |
|
70 |
61 |
71 #remove the ones we know are changed |
62 #remove the ones we know are changed |
72 touched = touched - changed |
63 touched = touched - changed |
73 touched = touched - untestable |
64 |
74 |
|
75 results = dict() |
65 results = dict() |
76 results['added'] = dict() |
66 results['added'] = dict() |
77 results['removed'] = dict() |
67 results['removed'] = dict() |
78 results['touched'] = dict() |
68 results['touched'] = dict() |
79 results['changed'] = dict() |
69 results['changed'] = dict() |
82 for file in added: |
72 for file in added: |
83 results['added'][file] = db2[file] |
73 results['added'][file] = db2[file] |
84 for file in removed: |
74 for file in removed: |
85 results['removed'][file] = 0 |
75 results['removed'][file] = 0 |
86 for file in touched: |
76 for file in touched: |
87 results['touched'][file] = db2[file] |
77 results['touched'][file] = db2[file] |
88 for file in changed: |
78 for file in changed: |
89 results['changed'][file] = db2[file] |
79 results['changed'][file] = db2[file] |
90 for file in untestable: |
80 # for file in untestable: |
91 results['untestable'][file] = 0 |
81 # results['untestable'][file] = 0 |
92 return results |
82 return results |
93 |
83 |
94 def printresults(results): |
84 def printresults(results): |
95 for file in sorted (results['added']): |
85 for file in sorted (results['added']): |
96 print 'added:', file |
86 print 'added:', file |
97 for file in sorted (results['removed']): |
87 for file in sorted (results['removed']): |
98 print 'removed:', file |
88 print 'removed:', file |
99 for file in sorted (results['touched']): |
89 # for file in sorted (results['touched']): |
100 print 'touched:', file |
90 # print 'touched:', file |
101 for file in sorted (results['changed']): |
91 for file in sorted (results['changed']): |
102 print 'changed:', file |
92 print 'changed:', file |
103 for file in sorted (results['untestable']): |
93 # for file in sorted (results['untestable']): |
104 print 'untestable:', file |
94 # print 'untestable:', file |
105 if(len(results['added']) + len(results['removed']) + len(results['changed']) + len(results['untestable']) == 0): |
95 if(len(results['added']) + len(results['removed']) + len(results['changed']) + len(results['untestable']) == 0): |
106 print '\nStatus:\tclean' |
96 print '\nStatus:\tclean' |
107 else: |
97 else: |
108 print '\nStatus:\tdirty' |
98 print '\nStatus:\tdirty' |
109 |
99 |