143 |
143 |
144 def newcomparepatcheddbs(drive1, drive2): |
144 def newcomparepatcheddbs(drive1, drive2): |
145 envdbroot = dbrutils.defaultdb() |
145 envdbroot = dbrutils.defaultdb() |
146 print "MattD: should move this function to a better location..." |
146 print "MattD: should move this function to a better location..." |
147 print 'Comparing %s with %s' % (drive2,drive1) |
147 print 'Comparing %s with %s' % (drive2,drive1) |
148 print 'Loading %s' % drive1 |
148 |
149 baseline1 = dbrbaseline.readdb('%s%s' %(drive1,envdbroot)) |
149 db1 = loadpatcheddb(drive1) |
150 patches1 = loadpatches('%s/%s' %(drive1,dbrutils.patchpath())) |
150 db2 = loadpatcheddb(drive2) |
151 db1 = createpatchedbaseline(baseline1,patches1) |
151 |
152 |
|
153 print 'Loading %s' % drive2 |
|
154 baseline2 = dbrbaseline.readdb('%s%s' %(drive2,envdbroot)) |
|
155 patches2 = loadpatches('%s/%s' %(drive2,dbrutils.patchpath())) |
|
156 db2 = createpatchedbaseline(baseline2,patches2) |
|
157 |
|
158 results = newcompare(db1, db2) |
152 results = newcompare(db1, db2) |
159 printresults(results) |
153 printresults(results) |
160 |
154 |
161 |
155 def loadpatcheddb(drive): |
|
156 envdbroot = dbrutils.defaultdb() |
|
157 print 'Loading %s' % drive |
|
158 baseline = dbrbaseline.readdb('%s%s' %(drive,envdbroot)) |
|
159 if(len(baseline) > 0): |
|
160 patches = loadpatches('%s/%s' %(drive,dbrutils.patchpath())) |
|
161 return createpatchedbaseline(baseline,patches) |
|
162 else: |
|
163 return dbrbaseline.readzippeddb(drive) |
162 |
164 |
163 def createpatchzip(patch, patchname): |
165 def createpatchzip(patch, patchname): |
164 patchtext = '%s.txt' % patchname |
166 patchtext = '%s.txt' % patchname |
165 patchtext = os.path.join(dbrutils.patchpath(),patchtext) |
167 patchtext = os.path.join(dbrutils.patchpath(),patchtext) |
166 |
168 |
190 if(patches[patch]['name'] == origin): |
192 if(patches[patch]['name'] == origin): |
191 mod=0 |
193 mod=0 |
192 if(file in patches[patch]['added']): |
194 if(file in patches[patch]['added']): |
193 mod = 'added' |
195 mod = 'added' |
194 if(file in patches[patch]['changed']): |
196 if(file in patches[patch]['changed']): |
195 mod = 'changed' |
197 mod = 'changed' |
196 if(mod): |
198 if(mod): |
197 if (patches[patch][mod][file]['time'] != db[file]['time']): |
199 if (patches[patch][mod][file]['time'] != db[file]['time']): |
198 patches[patch][mod][file]['time'] = db[file]['time'] |
200 patches[patch][mod][file]['time'] = db[file]['time'] |
199 print 'Updating timestamp in %s for %s' %(patches[patch]['name'],file) |
201 print 'Updating timestamp in %s for %s' %(patches[patch]['name'],file) |
200 return patches |
202 return patches |