author | MattD <mattd@symbian.org> |
Sun, 13 Jun 2010 20:39:03 +0100 | |
branch | DBRToolsDev |
changeset 285 | 6a928cf9e181 |
parent 217 | 1eec8c29548a |
permissions | -rw-r--r-- |
179
eab8a264a833
Pulled the DBRTools from their own repo and popped them into this one. Still very much a 'work in progress'.
MattD <mattd@symbian.org>
parents:
diff
changeset
|
1 |
# Copyright (c) 2009 Symbian Foundation Ltd |
eab8a264a833
Pulled the DBRTools from their own repo and popped them into this one. Still very much a 'work in progress'.
MattD <mattd@symbian.org>
parents:
diff
changeset
|
2 |
# This component and the accompanying materials are made available |
eab8a264a833
Pulled the DBRTools from their own repo and popped them into this one. Still very much a 'work in progress'.
MattD <mattd@symbian.org>
parents:
diff
changeset
|
3 |
# under the terms of the License "Eclipse Public License v1.0" |
eab8a264a833
Pulled the DBRTools from their own repo and popped them into this one. Still very much a 'work in progress'.
MattD <mattd@symbian.org>
parents:
diff
changeset
|
4 |
# which accompanies this distribution, and is available |
eab8a264a833
Pulled the DBRTools from their own repo and popped them into this one. Still very much a 'work in progress'.
MattD <mattd@symbian.org>
parents:
diff
changeset
|
5 |
# at the URL "http://www.eclipse.org/legal/epl-v10.html". |
eab8a264a833
Pulled the DBRTools from their own repo and popped them into this one. Still very much a 'work in progress'.
MattD <mattd@symbian.org>
parents:
diff
changeset
|
6 |
# |
eab8a264a833
Pulled the DBRTools from their own repo and popped them into this one. Still very much a 'work in progress'.
MattD <mattd@symbian.org>
parents:
diff
changeset
|
7 |
# Initial Contributors: |
eab8a264a833
Pulled the DBRTools from their own repo and popped them into this one. Still very much a 'work in progress'.
MattD <mattd@symbian.org>
parents:
diff
changeset
|
8 |
# Symbian Foundation Ltd - initial contribution. |
eab8a264a833
Pulled the DBRTools from their own repo and popped them into this one. Still very much a 'work in progress'.
MattD <mattd@symbian.org>
parents:
diff
changeset
|
9 |
# |
eab8a264a833
Pulled the DBRTools from their own repo and popped them into this one. Still very much a 'work in progress'.
MattD <mattd@symbian.org>
parents:
diff
changeset
|
10 |
# Contributors: |
eab8a264a833
Pulled the DBRTools from their own repo and popped them into this one. Still very much a 'work in progress'.
MattD <mattd@symbian.org>
parents:
diff
changeset
|
11 |
# mattd <mattd@symbian.org> |
eab8a264a833
Pulled the DBRTools from their own repo and popped them into this one. Still very much a 'work in progress'.
MattD <mattd@symbian.org>
parents:
diff
changeset
|
12 |
# |
eab8a264a833
Pulled the DBRTools from their own repo and popped them into this one. Still very much a 'work in progress'.
MattD <mattd@symbian.org>
parents:
diff
changeset
|
13 |
# Description: |
eab8a264a833
Pulled the DBRTools from their own repo and popped them into this one. Still very much a 'work in progress'.
MattD <mattd@symbian.org>
parents:
diff
changeset
|
14 |
# DBRpatch - module for handling patched baselines |
eab8a264a833
Pulled the DBRTools from their own repo and popped them into this one. Still very much a 'work in progress'.
MattD <mattd@symbian.org>
parents:
diff
changeset
|
15 |
|
eab8a264a833
Pulled the DBRTools from their own repo and popped them into this one. Still very much a 'work in progress'.
MattD <mattd@symbian.org>
parents:
diff
changeset
|
16 |
import re |
eab8a264a833
Pulled the DBRTools from their own repo and popped them into this one. Still very much a 'work in progress'.
MattD <mattd@symbian.org>
parents:
diff
changeset
|
17 |
import os.path #used for 'listpatches' |
eab8a264a833
Pulled the DBRTools from their own repo and popped them into this one. Still very much a 'work in progress'.
MattD <mattd@symbian.org>
parents:
diff
changeset
|
18 |
import string |
eab8a264a833
Pulled the DBRTools from their own repo and popped them into this one. Still very much a 'work in progress'.
MattD <mattd@symbian.org>
parents:
diff
changeset
|
19 |
import glob |
eab8a264a833
Pulled the DBRTools from their own repo and popped them into this one. Still very much a 'work in progress'.
MattD <mattd@symbian.org>
parents:
diff
changeset
|
20 |
import dbrutils |
eab8a264a833
Pulled the DBRTools from their own repo and popped them into this one. Still very much a 'work in progress'.
MattD <mattd@symbian.org>
parents:
diff
changeset
|
21 |
import dbrbaseline |
eab8a264a833
Pulled the DBRTools from their own repo and popped them into this one. Still very much a 'work in progress'.
MattD <mattd@symbian.org>
parents:
diff
changeset
|
22 |
|
eab8a264a833
Pulled the DBRTools from their own repo and popped them into this one. Still very much a 'work in progress'.
MattD <mattd@symbian.org>
parents:
diff
changeset
|
23 |
def newcompare(db1, db2): |
eab8a264a833
Pulled the DBRTools from their own repo and popped them into this one. Still very much a 'work in progress'.
MattD <mattd@symbian.org>
parents:
diff
changeset
|
24 |
db1files = set(db1.keys()) |
eab8a264a833
Pulled the DBRTools from their own repo and popped them into this one. Still very much a 'work in progress'.
MattD <mattd@symbian.org>
parents:
diff
changeset
|
25 |
db2files = set(db2.keys()) |
eab8a264a833
Pulled the DBRTools from their own repo and popped them into this one. Still very much a 'work in progress'.
MattD <mattd@symbian.org>
parents:
diff
changeset
|
26 |
|
eab8a264a833
Pulled the DBRTools from their own repo and popped them into this one. Still very much a 'work in progress'.
MattD <mattd@symbian.org>
parents:
diff
changeset
|
27 |
removed = db1files - db2files |
eab8a264a833
Pulled the DBRTools from their own repo and popped them into this one. Still very much a 'work in progress'.
MattD <mattd@symbian.org>
parents:
diff
changeset
|
28 |
added = db2files - db1files |
eab8a264a833
Pulled the DBRTools from their own repo and popped them into this one. Still very much a 'work in progress'.
MattD <mattd@symbian.org>
parents:
diff
changeset
|
29 |
common = db1files & db2files |
eab8a264a833
Pulled the DBRTools from their own repo and popped them into this one. Still very much a 'work in progress'.
MattD <mattd@symbian.org>
parents:
diff
changeset
|
30 |
|
eab8a264a833
Pulled the DBRTools from their own repo and popped them into this one. Still very much a 'work in progress'.
MattD <mattd@symbian.org>
parents:
diff
changeset
|
31 |
touched = set() |
eab8a264a833
Pulled the DBRTools from their own repo and popped them into this one. Still very much a 'work in progress'.
MattD <mattd@symbian.org>
parents:
diff
changeset
|
32 |
for file in common: |
203
e274d29c8bc9
Initial version of code cleanup. Now have classes for the environments. checkenv and diffenv updated to use it (although there are minor changes to the paths).
MattD <mattd@symbian.org>
parents:
200
diff
changeset
|
33 |
if(int(db1[file]['time']) != int(db2[file]['time'])): |
e274d29c8bc9
Initial version of code cleanup. Now have classes for the environments. checkenv and diffenv updated to use it (although there are minor changes to the paths).
MattD <mattd@symbian.org>
parents:
200
diff
changeset
|
34 |
print 'touched %s %s - %s' % (db1[file]['time'], db2[file]['time'],file) |
179
eab8a264a833
Pulled the DBRTools from their own repo and popped them into this one. Still very much a 'work in progress'.
MattD <mattd@symbian.org>
parents:
diff
changeset
|
35 |
touched.add(file) |
eab8a264a833
Pulled the DBRTools from their own repo and popped them into this one. Still very much a 'work in progress'.
MattD <mattd@symbian.org>
parents:
diff
changeset
|
36 |
|
eab8a264a833
Pulled the DBRTools from their own repo and popped them into this one. Still very much a 'work in progress'.
MattD <mattd@symbian.org>
parents:
diff
changeset
|
37 |
sizechanged = set() |
eab8a264a833
Pulled the DBRTools from their own repo and popped them into this one. Still very much a 'work in progress'.
MattD <mattd@symbian.org>
parents:
diff
changeset
|
38 |
for file in common: |
203
e274d29c8bc9
Initial version of code cleanup. Now have classes for the environments. checkenv and diffenv updated to use it (although there are minor changes to the paths).
MattD <mattd@symbian.org>
parents:
200
diff
changeset
|
39 |
if(int(db1[file]['size']) != int(db2[file]['size'])): |
179
eab8a264a833
Pulled the DBRTools from their own repo and popped them into this one. Still very much a 'work in progress'.
MattD <mattd@symbian.org>
parents:
diff
changeset
|
40 |
sizechanged.add(file) |
eab8a264a833
Pulled the DBRTools from their own repo and popped them into this one. Still very much a 'work in progress'.
MattD <mattd@symbian.org>
parents:
diff
changeset
|
41 |
|
eab8a264a833
Pulled the DBRTools from their own repo and popped them into this one. Still very much a 'work in progress'.
MattD <mattd@symbian.org>
parents:
diff
changeset
|
42 |
changed = set() |
eab8a264a833
Pulled the DBRTools from their own repo and popped them into this one. Still very much a 'work in progress'.
MattD <mattd@symbian.org>
parents:
diff
changeset
|
43 |
|
eab8a264a833
Pulled the DBRTools from their own repo and popped them into this one. Still very much a 'work in progress'.
MattD <mattd@symbian.org>
parents:
diff
changeset
|
44 |
genmd5 = 1 #I probably want to try to generate... add this as a third arg??? |
eab8a264a833
Pulled the DBRTools from their own repo and popped them into this one. Still very much a 'work in progress'.
MattD <mattd@symbian.org>
parents:
diff
changeset
|
45 |
|
eab8a264a833
Pulled the DBRTools from their own repo and popped them into this one. Still very much a 'work in progress'.
MattD <mattd@symbian.org>
parents:
diff
changeset
|
46 |
if(len(touched)): |
eab8a264a833
Pulled the DBRTools from their own repo and popped them into this one. Still very much a 'work in progress'.
MattD <mattd@symbian.org>
parents:
diff
changeset
|
47 |
if(genmd5): |
eab8a264a833
Pulled the DBRTools from their own repo and popped them into this one. Still very much a 'work in progress'.
MattD <mattd@symbian.org>
parents:
diff
changeset
|
48 |
md5testset = set() |
eab8a264a833
Pulled the DBRTools from their own repo and popped them into this one. Still very much a 'work in progress'.
MattD <mattd@symbian.org>
parents:
diff
changeset
|
49 |
for file in touched: |
eab8a264a833
Pulled the DBRTools from their own repo and popped them into this one. Still very much a 'work in progress'.
MattD <mattd@symbian.org>
parents:
diff
changeset
|
50 |
if((db1[file]['md5'] != 'xxx' ) and (db2[file]['md5'] == 'xxx')): #no point geenrating an MD5 if we've nothing to compare it to... |
eab8a264a833
Pulled the DBRTools from their own repo and popped them into this one. Still very much a 'work in progress'.
MattD <mattd@symbian.org>
parents:
diff
changeset
|
51 |
# print 'testing %s' % file |
eab8a264a833
Pulled the DBRTools from their own repo and popped them into this one. Still very much a 'work in progress'.
MattD <mattd@symbian.org>
parents:
diff
changeset
|
52 |
md5testset.add(file) |
eab8a264a833
Pulled the DBRTools from their own repo and popped them into this one. Still very much a 'work in progress'.
MattD <mattd@symbian.org>
parents:
diff
changeset
|
53 |
md5s = dbrutils.generateMD5s(md5testset) |
eab8a264a833
Pulled the DBRTools from their own repo and popped them into this one. Still very much a 'work in progress'.
MattD <mattd@symbian.org>
parents:
diff
changeset
|
54 |
for file in md5testset: |
eab8a264a833
Pulled the DBRTools from their own repo and popped them into this one. Still very much a 'work in progress'.
MattD <mattd@symbian.org>
parents:
diff
changeset
|
55 |
db2[file]['md5'] = md5s[file]['md5'] |
eab8a264a833
Pulled the DBRTools from their own repo and popped them into this one. Still very much a 'work in progress'.
MattD <mattd@symbian.org>
parents:
diff
changeset
|
56 |
for file in touched: |
eab8a264a833
Pulled the DBRTools from their own repo and popped them into this one. Still very much a 'work in progress'.
MattD <mattd@symbian.org>
parents:
diff
changeset
|
57 |
if(db1[file]['md5'] != db2[file]['md5']): |
eab8a264a833
Pulled the DBRTools from their own repo and popped them into this one. Still very much a 'work in progress'.
MattD <mattd@symbian.org>
parents:
diff
changeset
|
58 |
changed.add(file) |
eab8a264a833
Pulled the DBRTools from their own repo and popped them into this one. Still very much a 'work in progress'.
MattD <mattd@symbian.org>
parents:
diff
changeset
|
59 |
touched = touched - changed |
203
e274d29c8bc9
Initial version of code cleanup. Now have classes for the environments. checkenv and diffenv updated to use it (although there are minor changes to the paths).
MattD <mattd@symbian.org>
parents:
200
diff
changeset
|
60 |
|
179
eab8a264a833
Pulled the DBRTools from their own repo and popped them into this one. Still very much a 'work in progress'.
MattD <mattd@symbian.org>
parents:
diff
changeset
|
61 |
|
eab8a264a833
Pulled the DBRTools from their own repo and popped them into this one. Still very much a 'work in progress'.
MattD <mattd@symbian.org>
parents:
diff
changeset
|
62 |
#remove the ones we know are changed |
eab8a264a833
Pulled the DBRTools from their own repo and popped them into this one. Still very much a 'work in progress'.
MattD <mattd@symbian.org>
parents:
diff
changeset
|
63 |
touched = touched - changed |
203
e274d29c8bc9
Initial version of code cleanup. Now have classes for the environments. checkenv and diffenv updated to use it (although there are minor changes to the paths).
MattD <mattd@symbian.org>
parents:
200
diff
changeset
|
64 |
|
179
eab8a264a833
Pulled the DBRTools from their own repo and popped them into this one. Still very much a 'work in progress'.
MattD <mattd@symbian.org>
parents:
diff
changeset
|
65 |
results = dict() |
eab8a264a833
Pulled the DBRTools from their own repo and popped them into this one. Still very much a 'work in progress'.
MattD <mattd@symbian.org>
parents:
diff
changeset
|
66 |
results['added'] = dict() |
eab8a264a833
Pulled the DBRTools from their own repo and popped them into this one. Still very much a 'work in progress'.
MattD <mattd@symbian.org>
parents:
diff
changeset
|
67 |
results['removed'] = dict() |
eab8a264a833
Pulled the DBRTools from their own repo and popped them into this one. Still very much a 'work in progress'.
MattD <mattd@symbian.org>
parents:
diff
changeset
|
68 |
results['touched'] = dict() |
eab8a264a833
Pulled the DBRTools from their own repo and popped them into this one. Still very much a 'work in progress'.
MattD <mattd@symbian.org>
parents:
diff
changeset
|
69 |
results['changed'] = dict() |
eab8a264a833
Pulled the DBRTools from their own repo and popped them into this one. Still very much a 'work in progress'.
MattD <mattd@symbian.org>
parents:
diff
changeset
|
70 |
results['untestable'] = dict() |
eab8a264a833
Pulled the DBRTools from their own repo and popped them into this one. Still very much a 'work in progress'.
MattD <mattd@symbian.org>
parents:
diff
changeset
|
71 |
|
eab8a264a833
Pulled the DBRTools from their own repo and popped them into this one. Still very much a 'work in progress'.
MattD <mattd@symbian.org>
parents:
diff
changeset
|
72 |
for file in added: |
eab8a264a833
Pulled the DBRTools from their own repo and popped them into this one. Still very much a 'work in progress'.
MattD <mattd@symbian.org>
parents:
diff
changeset
|
73 |
results['added'][file] = db2[file] |
eab8a264a833
Pulled the DBRTools from their own repo and popped them into this one. Still very much a 'work in progress'.
MattD <mattd@symbian.org>
parents:
diff
changeset
|
74 |
for file in removed: |
eab8a264a833
Pulled the DBRTools from their own repo and popped them into this one. Still very much a 'work in progress'.
MattD <mattd@symbian.org>
parents:
diff
changeset
|
75 |
results['removed'][file] = 0 |
eab8a264a833
Pulled the DBRTools from their own repo and popped them into this one. Still very much a 'work in progress'.
MattD <mattd@symbian.org>
parents:
diff
changeset
|
76 |
for file in touched: |
203
e274d29c8bc9
Initial version of code cleanup. Now have classes for the environments. checkenv and diffenv updated to use it (although there are minor changes to the paths).
MattD <mattd@symbian.org>
parents:
200
diff
changeset
|
77 |
results['touched'][file] = db2[file] |
179
eab8a264a833
Pulled the DBRTools from their own repo and popped them into this one. Still very much a 'work in progress'.
MattD <mattd@symbian.org>
parents:
diff
changeset
|
78 |
for file in changed: |
eab8a264a833
Pulled the DBRTools from their own repo and popped them into this one. Still very much a 'work in progress'.
MattD <mattd@symbian.org>
parents:
diff
changeset
|
79 |
results['changed'][file] = db2[file] |
203
e274d29c8bc9
Initial version of code cleanup. Now have classes for the environments. checkenv and diffenv updated to use it (although there are minor changes to the paths).
MattD <mattd@symbian.org>
parents:
200
diff
changeset
|
80 |
# for file in untestable: |
e274d29c8bc9
Initial version of code cleanup. Now have classes for the environments. checkenv and diffenv updated to use it (although there are minor changes to the paths).
MattD <mattd@symbian.org>
parents:
200
diff
changeset
|
81 |
# results['untestable'][file] = 0 |
179
eab8a264a833
Pulled the DBRTools from their own repo and popped them into this one. Still very much a 'work in progress'.
MattD <mattd@symbian.org>
parents:
diff
changeset
|
82 |
return results |
eab8a264a833
Pulled the DBRTools from their own repo and popped them into this one. Still very much a 'work in progress'.
MattD <mattd@symbian.org>
parents:
diff
changeset
|
83 |
|
eab8a264a833
Pulled the DBRTools from their own repo and popped them into this one. Still very much a 'work in progress'.
MattD <mattd@symbian.org>
parents:
diff
changeset
|
84 |
def printresults(results): |
eab8a264a833
Pulled the DBRTools from their own repo and popped them into this one. Still very much a 'work in progress'.
MattD <mattd@symbian.org>
parents:
diff
changeset
|
85 |
for file in sorted (results['added']): |
eab8a264a833
Pulled the DBRTools from their own repo and popped them into this one. Still very much a 'work in progress'.
MattD <mattd@symbian.org>
parents:
diff
changeset
|
86 |
print 'added:', file |
eab8a264a833
Pulled the DBRTools from their own repo and popped them into this one. Still very much a 'work in progress'.
MattD <mattd@symbian.org>
parents:
diff
changeset
|
87 |
for file in sorted (results['removed']): |
eab8a264a833
Pulled the DBRTools from their own repo and popped them into this one. Still very much a 'work in progress'.
MattD <mattd@symbian.org>
parents:
diff
changeset
|
88 |
print 'removed:', file |
203
e274d29c8bc9
Initial version of code cleanup. Now have classes for the environments. checkenv and diffenv updated to use it (although there are minor changes to the paths).
MattD <mattd@symbian.org>
parents:
200
diff
changeset
|
89 |
# for file in sorted (results['touched']): |
e274d29c8bc9
Initial version of code cleanup. Now have classes for the environments. checkenv and diffenv updated to use it (although there are minor changes to the paths).
MattD <mattd@symbian.org>
parents:
200
diff
changeset
|
90 |
# print 'touched:', file |
179
eab8a264a833
Pulled the DBRTools from their own repo and popped them into this one. Still very much a 'work in progress'.
MattD <mattd@symbian.org>
parents:
diff
changeset
|
91 |
for file in sorted (results['changed']): |
eab8a264a833
Pulled the DBRTools from their own repo and popped them into this one. Still very much a 'work in progress'.
MattD <mattd@symbian.org>
parents:
diff
changeset
|
92 |
print 'changed:', file |
203
e274d29c8bc9
Initial version of code cleanup. Now have classes for the environments. checkenv and diffenv updated to use it (although there are minor changes to the paths).
MattD <mattd@symbian.org>
parents:
200
diff
changeset
|
93 |
# for file in sorted (results['untestable']): |
e274d29c8bc9
Initial version of code cleanup. Now have classes for the environments. checkenv and diffenv updated to use it (although there are minor changes to the paths).
MattD <mattd@symbian.org>
parents:
200
diff
changeset
|
94 |
# print 'untestable:', file |
179
eab8a264a833
Pulled the DBRTools from their own repo and popped them into this one. Still very much a 'work in progress'.
MattD <mattd@symbian.org>
parents:
diff
changeset
|
95 |
if(len(results['added']) + len(results['removed']) + len(results['changed']) + len(results['untestable']) == 0): |
eab8a264a833
Pulled the DBRTools from their own repo and popped them into this one. Still very much a 'work in progress'.
MattD <mattd@symbian.org>
parents:
diff
changeset
|
96 |
print '\nStatus:\tclean' |
eab8a264a833
Pulled the DBRTools from their own repo and popped them into this one. Still very much a 'work in progress'.
MattD <mattd@symbian.org>
parents:
diff
changeset
|
97 |
else: |
eab8a264a833
Pulled the DBRTools from their own repo and popped them into this one. Still very much a 'work in progress'.
MattD <mattd@symbian.org>
parents:
diff
changeset
|
98 |
print '\nStatus:\tdirty' |
eab8a264a833
Pulled the DBRTools from their own repo and popped them into this one. Still very much a 'work in progress'.
MattD <mattd@symbian.org>
parents:
diff
changeset
|
99 |
|
eab8a264a833
Pulled the DBRTools from their own repo and popped them into this one. Still very much a 'work in progress'.
MattD <mattd@symbian.org>
parents:
diff
changeset
|
100 |
def newupdatedb(baseline,env): |
eab8a264a833
Pulled the DBRTools from their own repo and popped them into this one. Still very much a 'work in progress'.
MattD <mattd@symbian.org>
parents:
diff
changeset
|
101 |
results = newcompare(baseline, env) |
eab8a264a833
Pulled the DBRTools from their own repo and popped them into this one. Still very much a 'work in progress'.
MattD <mattd@symbian.org>
parents:
diff
changeset
|
102 |
printresults(results) |
eab8a264a833
Pulled the DBRTools from their own repo and popped them into this one. Still very much a 'work in progress'.
MattD <mattd@symbian.org>
parents:
diff
changeset
|
103 |
for file in results['touched']: |
eab8a264a833
Pulled the DBRTools from their own repo and popped them into this one. Still very much a 'work in progress'.
MattD <mattd@symbian.org>
parents:
diff
changeset
|
104 |
baseline[file]['time'] = env[file]['time'] |
eab8a264a833
Pulled the DBRTools from their own repo and popped them into this one. Still very much a 'work in progress'.
MattD <mattd@symbian.org>
parents:
diff
changeset
|
105 |
return results |
eab8a264a833
Pulled the DBRTools from their own repo and popped them into this one. Still very much a 'work in progress'.
MattD <mattd@symbian.org>
parents:
diff
changeset
|
106 |
|
eab8a264a833
Pulled the DBRTools from their own repo and popped them into this one. Still very much a 'work in progress'.
MattD <mattd@symbian.org>
parents:
diff
changeset
|
107 |
def newcreatepatch(name, db1, db2): |
eab8a264a833
Pulled the DBRTools from their own repo and popped them into this one. Still very much a 'work in progress'.
MattD <mattd@symbian.org>
parents:
diff
changeset
|
108 |
results = newcompare(db1, db2) |
eab8a264a833
Pulled the DBRTools from their own repo and popped them into this one. Still very much a 'work in progress'.
MattD <mattd@symbian.org>
parents:
diff
changeset
|
109 |
printresults(results) |
eab8a264a833
Pulled the DBRTools from their own repo and popped them into this one. Still very much a 'work in progress'.
MattD <mattd@symbian.org>
parents:
diff
changeset
|
110 |
for file in results['touched']: |
eab8a264a833
Pulled the DBRTools from their own repo and popped them into this one. Still very much a 'work in progress'.
MattD <mattd@symbian.org>
parents:
diff
changeset
|
111 |
db1[file]['time'] = db2[file]['time'] |
eab8a264a833
Pulled the DBRTools from their own repo and popped them into this one. Still very much a 'work in progress'.
MattD <mattd@symbian.org>
parents:
diff
changeset
|
112 |
|
eab8a264a833
Pulled the DBRTools from their own repo and popped them into this one. Still very much a 'work in progress'.
MattD <mattd@symbian.org>
parents:
diff
changeset
|
113 |
patch = dict(); |
eab8a264a833
Pulled the DBRTools from their own repo and popped them into this one. Still very much a 'work in progress'.
MattD <mattd@symbian.org>
parents:
diff
changeset
|
114 |
patch['name'] = name |
eab8a264a833
Pulled the DBRTools from their own repo and popped them into this one. Still very much a 'work in progress'.
MattD <mattd@symbian.org>
parents:
diff
changeset
|
115 |
patch['time'] = 'now!!!' |
eab8a264a833
Pulled the DBRTools from their own repo and popped them into this one. Still very much a 'work in progress'.
MattD <mattd@symbian.org>
parents:
diff
changeset
|
116 |
patch['removed'] = results['removed'] |
eab8a264a833
Pulled the DBRTools from their own repo and popped them into this one. Still very much a 'work in progress'.
MattD <mattd@symbian.org>
parents:
diff
changeset
|
117 |
added = results['added'].keys() |
eab8a264a833
Pulled the DBRTools from their own repo and popped them into this one. Still very much a 'work in progress'.
MattD <mattd@symbian.org>
parents:
diff
changeset
|
118 |
md5sAdded = dbrutils.generateMD5s(added) |
eab8a264a833
Pulled the DBRTools from their own repo and popped them into this one. Still very much a 'work in progress'.
MattD <mattd@symbian.org>
parents:
diff
changeset
|
119 |
for file in added: |
eab8a264a833
Pulled the DBRTools from their own repo and popped them into this one. Still very much a 'work in progress'.
MattD <mattd@symbian.org>
parents:
diff
changeset
|
120 |
results['added'][file]['md5'] = md5sAdded[file]['md5'] |
eab8a264a833
Pulled the DBRTools from their own repo and popped them into this one. Still very much a 'work in progress'.
MattD <mattd@symbian.org>
parents:
diff
changeset
|
121 |
patch['added'] = results['added'] |
eab8a264a833
Pulled the DBRTools from their own repo and popped them into this one. Still very much a 'work in progress'.
MattD <mattd@symbian.org>
parents:
diff
changeset
|
122 |
print "Need to add in the untestable stuff here also!!!" |
eab8a264a833
Pulled the DBRTools from their own repo and popped them into this one. Still very much a 'work in progress'.
MattD <mattd@symbian.org>
parents:
diff
changeset
|
123 |
patch['changed'] = results['changed'] |
eab8a264a833
Pulled the DBRTools from their own repo and popped them into this one. Still very much a 'work in progress'.
MattD <mattd@symbian.org>
parents:
diff
changeset
|
124 |
patchname = "%spatch_%s" %(dbrutils.patchpath(), name) |
eab8a264a833
Pulled the DBRTools from their own repo and popped them into this one. Still very much a 'work in progress'.
MattD <mattd@symbian.org>
parents:
diff
changeset
|
125 |
|
eab8a264a833
Pulled the DBRTools from their own repo and popped them into this one. Still very much a 'work in progress'.
MattD <mattd@symbian.org>
parents:
diff
changeset
|
126 |
createpatchzip(patch, patchname) |
eab8a264a833
Pulled the DBRTools from their own repo and popped them into this one. Still very much a 'work in progress'.
MattD <mattd@symbian.org>
parents:
diff
changeset
|
127 |
|
eab8a264a833
Pulled the DBRTools from their own repo and popped them into this one. Still very much a 'work in progress'.
MattD <mattd@symbian.org>
parents:
diff
changeset
|
128 |
#update the ownership |
eab8a264a833
Pulled the DBRTools from their own repo and popped them into this one. Still very much a 'work in progress'.
MattD <mattd@symbian.org>
parents:
diff
changeset
|
129 |
for file in patch['changed']: |
eab8a264a833
Pulled the DBRTools from their own repo and popped them into this one. Still very much a 'work in progress'.
MattD <mattd@symbian.org>
parents:
diff
changeset
|
130 |
db1[file]['name'] = name |
eab8a264a833
Pulled the DBRTools from their own repo and popped them into this one. Still very much a 'work in progress'.
MattD <mattd@symbian.org>
parents:
diff
changeset
|
131 |
|
eab8a264a833
Pulled the DBRTools from their own repo and popped them into this one. Still very much a 'work in progress'.
MattD <mattd@symbian.org>
parents:
diff
changeset
|
132 |
return db1 |
eab8a264a833
Pulled the DBRTools from their own repo and popped them into this one. Still very much a 'work in progress'.
MattD <mattd@symbian.org>
parents:
diff
changeset
|
133 |
|
eab8a264a833
Pulled the DBRTools from their own repo and popped them into this one. Still very much a 'work in progress'.
MattD <mattd@symbian.org>
parents:
diff
changeset
|
134 |
def newcomparepatcheddbs(drive1, drive2): |
eab8a264a833
Pulled the DBRTools from their own repo and popped them into this one. Still very much a 'work in progress'.
MattD <mattd@symbian.org>
parents:
diff
changeset
|
135 |
envdbroot = dbrutils.defaultdb() |
eab8a264a833
Pulled the DBRTools from their own repo and popped them into this one. Still very much a 'work in progress'.
MattD <mattd@symbian.org>
parents:
diff
changeset
|
136 |
print "MattD: should move this function to a better location..." |
eab8a264a833
Pulled the DBRTools from their own repo and popped them into this one. Still very much a 'work in progress'.
MattD <mattd@symbian.org>
parents:
diff
changeset
|
137 |
print 'Comparing %s with %s' % (drive2,drive1) |
eab8a264a833
Pulled the DBRTools from their own repo and popped them into this one. Still very much a 'work in progress'.
MattD <mattd@symbian.org>
parents:
diff
changeset
|
138 |
|
200
12422144aae1
DBRTools - initial version that will diff against a packed release. Also did minor cleanup. Probably caused some regressions.
MattD <mattd@symbian.org>
parents:
179
diff
changeset
|
139 |
db1 = loadpatcheddb(drive1) |
12422144aae1
DBRTools - initial version that will diff against a packed release. Also did minor cleanup. Probably caused some regressions.
MattD <mattd@symbian.org>
parents:
179
diff
changeset
|
140 |
db2 = loadpatcheddb(drive2) |
12422144aae1
DBRTools - initial version that will diff against a packed release. Also did minor cleanup. Probably caused some regressions.
MattD <mattd@symbian.org>
parents:
179
diff
changeset
|
141 |
|
179
eab8a264a833
Pulled the DBRTools from their own repo and popped them into this one. Still very much a 'work in progress'.
MattD <mattd@symbian.org>
parents:
diff
changeset
|
142 |
results = newcompare(db1, db2) |
eab8a264a833
Pulled the DBRTools from their own repo and popped them into this one. Still very much a 'work in progress'.
MattD <mattd@symbian.org>
parents:
diff
changeset
|
143 |
printresults(results) |
eab8a264a833
Pulled the DBRTools from their own repo and popped them into this one. Still very much a 'work in progress'.
MattD <mattd@symbian.org>
parents:
diff
changeset
|
144 |
|
200
12422144aae1
DBRTools - initial version that will diff against a packed release. Also did minor cleanup. Probably caused some regressions.
MattD <mattd@symbian.org>
parents:
179
diff
changeset
|
145 |
def loadpatcheddb(drive): |
12422144aae1
DBRTools - initial version that will diff against a packed release. Also did minor cleanup. Probably caused some regressions.
MattD <mattd@symbian.org>
parents:
179
diff
changeset
|
146 |
envdbroot = dbrutils.defaultdb() |
12422144aae1
DBRTools - initial version that will diff against a packed release. Also did minor cleanup. Probably caused some regressions.
MattD <mattd@symbian.org>
parents:
179
diff
changeset
|
147 |
print 'Loading %s' % drive |
12422144aae1
DBRTools - initial version that will diff against a packed release. Also did minor cleanup. Probably caused some regressions.
MattD <mattd@symbian.org>
parents:
179
diff
changeset
|
148 |
baseline = dbrbaseline.readdb('%s%s' %(drive,envdbroot)) |
12422144aae1
DBRTools - initial version that will diff against a packed release. Also did minor cleanup. Probably caused some regressions.
MattD <mattd@symbian.org>
parents:
179
diff
changeset
|
149 |
if(len(baseline) > 0): |
12422144aae1
DBRTools - initial version that will diff against a packed release. Also did minor cleanup. Probably caused some regressions.
MattD <mattd@symbian.org>
parents:
179
diff
changeset
|
150 |
patches = loadpatches('%s/%s' %(drive,dbrutils.patchpath())) |
12422144aae1
DBRTools - initial version that will diff against a packed release. Also did minor cleanup. Probably caused some regressions.
MattD <mattd@symbian.org>
parents:
179
diff
changeset
|
151 |
return createpatchedbaseline(baseline,patches) |
12422144aae1
DBRTools - initial version that will diff against a packed release. Also did minor cleanup. Probably caused some regressions.
MattD <mattd@symbian.org>
parents:
179
diff
changeset
|
152 |
else: |
12422144aae1
DBRTools - initial version that will diff against a packed release. Also did minor cleanup. Probably caused some regressions.
MattD <mattd@symbian.org>
parents:
179
diff
changeset
|
153 |
return dbrbaseline.readzippeddb(drive) |
179
eab8a264a833
Pulled the DBRTools from their own repo and popped them into this one. Still very much a 'work in progress'.
MattD <mattd@symbian.org>
parents:
diff
changeset
|
154 |
|
eab8a264a833
Pulled the DBRTools from their own repo and popped them into this one. Still very much a 'work in progress'.
MattD <mattd@symbian.org>
parents:
diff
changeset
|
155 |
def createpatchzip(patch, patchname): |
eab8a264a833
Pulled the DBRTools from their own repo and popped them into this one. Still very much a 'work in progress'.
MattD <mattd@symbian.org>
parents:
diff
changeset
|
156 |
patchtext = '%s.txt' % patchname |
eab8a264a833
Pulled the DBRTools from their own repo and popped them into this one. Still very much a 'work in progress'.
MattD <mattd@symbian.org>
parents:
diff
changeset
|
157 |
patchtext = os.path.join(dbrutils.patchpath(),patchtext) |
eab8a264a833
Pulled the DBRTools from their own repo and popped them into this one. Still very much a 'work in progress'.
MattD <mattd@symbian.org>
parents:
diff
changeset
|
158 |
|
eab8a264a833
Pulled the DBRTools from their own repo and popped them into this one. Still very much a 'work in progress'.
MattD <mattd@symbian.org>
parents:
diff
changeset
|
159 |
writepatch(patch, patchtext) |
eab8a264a833
Pulled the DBRTools from their own repo and popped them into this one. Still very much a 'work in progress'.
MattD <mattd@symbian.org>
parents:
diff
changeset
|
160 |
files = set() |
eab8a264a833
Pulled the DBRTools from their own repo and popped them into this one. Still very much a 'work in progress'.
MattD <mattd@symbian.org>
parents:
diff
changeset
|
161 |
files.update(patch['added']) |
eab8a264a833
Pulled the DBRTools from their own repo and popped them into this one. Still very much a 'work in progress'.
MattD <mattd@symbian.org>
parents:
diff
changeset
|
162 |
files.update(patch['changed']) |
eab8a264a833
Pulled the DBRTools from their own repo and popped them into this one. Still very much a 'work in progress'.
MattD <mattd@symbian.org>
parents:
diff
changeset
|
163 |
files.add(re.sub('\\\\','',patchtext)) #remove leading slash - Nasty - need to fix the whole EPOCROOT thing. |
eab8a264a833
Pulled the DBRTools from their own repo and popped them into this one. Still very much a 'work in progress'.
MattD <mattd@symbian.org>
parents:
diff
changeset
|
164 |
|
eab8a264a833
Pulled the DBRTools from their own repo and popped them into this one. Still very much a 'work in progress'.
MattD <mattd@symbian.org>
parents:
diff
changeset
|
165 |
zipname = '%s.zip' % patchname |
eab8a264a833
Pulled the DBRTools from their own repo and popped them into this one. Still very much a 'work in progress'.
MattD <mattd@symbian.org>
parents:
diff
changeset
|
166 |
dbrutils.createzip(files, zipname) |
eab8a264a833
Pulled the DBRTools from their own repo and popped them into this one. Still very much a 'work in progress'.
MattD <mattd@symbian.org>
parents:
diff
changeset
|
167 |
|
eab8a264a833
Pulled the DBRTools from their own repo and popped them into this one. Still very much a 'work in progress'.
MattD <mattd@symbian.org>
parents:
diff
changeset
|
168 |
|
eab8a264a833
Pulled the DBRTools from their own repo and popped them into this one. Still very much a 'work in progress'.
MattD <mattd@symbian.org>
parents:
diff
changeset
|
169 |
def updatebaseline(baseline, db): |
eab8a264a833
Pulled the DBRTools from their own repo and popped them into this one. Still very much a 'work in progress'.
MattD <mattd@symbian.org>
parents:
diff
changeset
|
170 |
for file in (db.keys()): |
eab8a264a833
Pulled the DBRTools from their own repo and popped them into this one. Still very much a 'work in progress'.
MattD <mattd@symbian.org>
parents:
diff
changeset
|
171 |
origin = db[file]['name'] |
eab8a264a833
Pulled the DBRTools from their own repo and popped them into this one. Still very much a 'work in progress'.
MattD <mattd@symbian.org>
parents:
diff
changeset
|
172 |
if(origin == 'baseline'): |
eab8a264a833
Pulled the DBRTools from their own repo and popped them into this one. Still very much a 'work in progress'.
MattD <mattd@symbian.org>
parents:
diff
changeset
|
173 |
if(baseline[file]['time'] != db[file]['time']): |
eab8a264a833
Pulled the DBRTools from their own repo and popped them into this one. Still very much a 'work in progress'.
MattD <mattd@symbian.org>
parents:
diff
changeset
|
174 |
baseline[file]['time'] = db[file]['time'] |
eab8a264a833
Pulled the DBRTools from their own repo and popped them into this one. Still very much a 'work in progress'.
MattD <mattd@symbian.org>
parents:
diff
changeset
|
175 |
print 'Updating timestamp for %s in baseline' % file |
eab8a264a833
Pulled the DBRTools from their own repo and popped them into this one. Still very much a 'work in progress'.
MattD <mattd@symbian.org>
parents:
diff
changeset
|
176 |
return baseline |
eab8a264a833
Pulled the DBRTools from their own repo and popped them into this one. Still very much a 'work in progress'.
MattD <mattd@symbian.org>
parents:
diff
changeset
|
177 |
|
eab8a264a833
Pulled the DBRTools from their own repo and popped them into this one. Still very much a 'work in progress'.
MattD <mattd@symbian.org>
parents:
diff
changeset
|
178 |
def updatepatches(patches, db): |
eab8a264a833
Pulled the DBRTools from their own repo and popped them into this one. Still very much a 'work in progress'.
MattD <mattd@symbian.org>
parents:
diff
changeset
|
179 |
for file in (db.keys()): |
eab8a264a833
Pulled the DBRTools from their own repo and popped them into this one. Still very much a 'work in progress'.
MattD <mattd@symbian.org>
parents:
diff
changeset
|
180 |
origin = db[file]['name'] |
eab8a264a833
Pulled the DBRTools from their own repo and popped them into this one. Still very much a 'work in progress'.
MattD <mattd@symbian.org>
parents:
diff
changeset
|
181 |
for patch in patches.keys(): |
eab8a264a833
Pulled the DBRTools from their own repo and popped them into this one. Still very much a 'work in progress'.
MattD <mattd@symbian.org>
parents:
diff
changeset
|
182 |
if(patches[patch]['name'] == origin): |
eab8a264a833
Pulled the DBRTools from their own repo and popped them into this one. Still very much a 'work in progress'.
MattD <mattd@symbian.org>
parents:
diff
changeset
|
183 |
mod=0 |
eab8a264a833
Pulled the DBRTools from their own repo and popped them into this one. Still very much a 'work in progress'.
MattD <mattd@symbian.org>
parents:
diff
changeset
|
184 |
if(file in patches[patch]['added']): |
eab8a264a833
Pulled the DBRTools from their own repo and popped them into this one. Still very much a 'work in progress'.
MattD <mattd@symbian.org>
parents:
diff
changeset
|
185 |
mod = 'added' |
eab8a264a833
Pulled the DBRTools from their own repo and popped them into this one. Still very much a 'work in progress'.
MattD <mattd@symbian.org>
parents:
diff
changeset
|
186 |
if(file in patches[patch]['changed']): |
200
12422144aae1
DBRTools - initial version that will diff against a packed release. Also did minor cleanup. Probably caused some regressions.
MattD <mattd@symbian.org>
parents:
179
diff
changeset
|
187 |
mod = 'changed' |
179
eab8a264a833
Pulled the DBRTools from their own repo and popped them into this one. Still very much a 'work in progress'.
MattD <mattd@symbian.org>
parents:
diff
changeset
|
188 |
if(mod): |
eab8a264a833
Pulled the DBRTools from their own repo and popped them into this one. Still very much a 'work in progress'.
MattD <mattd@symbian.org>
parents:
diff
changeset
|
189 |
if (patches[patch][mod][file]['time'] != db[file]['time']): |
eab8a264a833
Pulled the DBRTools from their own repo and popped them into this one. Still very much a 'work in progress'.
MattD <mattd@symbian.org>
parents:
diff
changeset
|
190 |
patches[patch][mod][file]['time'] = db[file]['time'] |
eab8a264a833
Pulled the DBRTools from their own repo and popped them into this one. Still very much a 'work in progress'.
MattD <mattd@symbian.org>
parents:
diff
changeset
|
191 |
print 'Updating timestamp in %s for %s' %(patches[patch]['name'],file) |
eab8a264a833
Pulled the DBRTools from their own repo and popped them into this one. Still very much a 'work in progress'.
MattD <mattd@symbian.org>
parents:
diff
changeset
|
192 |
return patches |
eab8a264a833
Pulled the DBRTools from their own repo and popped them into this one. Still very much a 'work in progress'.
MattD <mattd@symbian.org>
parents:
diff
changeset
|
193 |
|
eab8a264a833
Pulled the DBRTools from their own repo and popped them into this one. Still very much a 'work in progress'.
MattD <mattd@symbian.org>
parents:
diff
changeset
|
194 |
|
eab8a264a833
Pulled the DBRTools from their own repo and popped them into this one. Still very much a 'work in progress'.
MattD <mattd@symbian.org>
parents:
diff
changeset
|
195 |
def createpatchedbaseline(baseline,patches): |
eab8a264a833
Pulled the DBRTools from their own repo and popped them into this one. Still very much a 'work in progress'.
MattD <mattd@symbian.org>
parents:
diff
changeset
|
196 |
files = dict() |
eab8a264a833
Pulled the DBRTools from their own repo and popped them into this one. Still very much a 'work in progress'.
MattD <mattd@symbian.org>
parents:
diff
changeset
|
197 |
files = addtodb(files,baseline,'baseline') |
eab8a264a833
Pulled the DBRTools from their own repo and popped them into this one. Still very much a 'work in progress'.
MattD <mattd@symbian.org>
parents:
diff
changeset
|
198 |
for patch in sorted(patches.keys()): |
eab8a264a833
Pulled the DBRTools from their own repo and popped them into this one. Still very much a 'work in progress'.
MattD <mattd@symbian.org>
parents:
diff
changeset
|
199 |
# print 'adding patch: %s' % patch |
eab8a264a833
Pulled the DBRTools from their own repo and popped them into this one. Still very much a 'work in progress'.
MattD <mattd@symbian.org>
parents:
diff
changeset
|
200 |
files = addtodb(files,patches[patch]['added'],patches[patch]['name']) |
eab8a264a833
Pulled the DBRTools from their own repo and popped them into this one. Still very much a 'work in progress'.
MattD <mattd@symbian.org>
parents:
diff
changeset
|
201 |
files = addtodb(files,patches[patch]['changed'],patches[patch]['name']) |
eab8a264a833
Pulled the DBRTools from their own repo and popped them into this one. Still very much a 'work in progress'.
MattD <mattd@symbian.org>
parents:
diff
changeset
|
202 |
files = removefromdb(files,patches[patch]['removed'],patches[patch]['name']) |
eab8a264a833
Pulled the DBRTools from their own repo and popped them into this one. Still very much a 'work in progress'.
MattD <mattd@symbian.org>
parents:
diff
changeset
|
203 |
return files |
eab8a264a833
Pulled the DBRTools from their own repo and popped them into this one. Still very much a 'work in progress'.
MattD <mattd@symbian.org>
parents:
diff
changeset
|
204 |
|
eab8a264a833
Pulled the DBRTools from their own repo and popped them into this one. Still very much a 'work in progress'.
MattD <mattd@symbian.org>
parents:
diff
changeset
|
205 |
def removefromdb(db,removed,name): |
eab8a264a833
Pulled the DBRTools from their own repo and popped them into this one. Still very much a 'work in progress'.
MattD <mattd@symbian.org>
parents:
diff
changeset
|
206 |
for file in removed: |
eab8a264a833
Pulled the DBRTools from their own repo and popped them into this one. Still very much a 'work in progress'.
MattD <mattd@symbian.org>
parents:
diff
changeset
|
207 |
if(file in db): |
eab8a264a833
Pulled the DBRTools from their own repo and popped them into this one. Still very much a 'work in progress'.
MattD <mattd@symbian.org>
parents:
diff
changeset
|
208 |
# print '%s removing %s' %(name,file) |
eab8a264a833
Pulled the DBRTools from their own repo and popped them into this one. Still very much a 'work in progress'.
MattD <mattd@symbian.org>
parents:
diff
changeset
|
209 |
del db[file] |
eab8a264a833
Pulled the DBRTools from their own repo and popped them into this one. Still very much a 'work in progress'.
MattD <mattd@symbian.org>
parents:
diff
changeset
|
210 |
return db |
eab8a264a833
Pulled the DBRTools from their own repo and popped them into this one. Still very much a 'work in progress'.
MattD <mattd@symbian.org>
parents:
diff
changeset
|
211 |
|
eab8a264a833
Pulled the DBRTools from their own repo and popped them into this one. Still very much a 'work in progress'.
MattD <mattd@symbian.org>
parents:
diff
changeset
|
212 |
def addtodb(db,new,name): |
eab8a264a833
Pulled the DBRTools from their own repo and popped them into this one. Still very much a 'work in progress'.
MattD <mattd@symbian.org>
parents:
diff
changeset
|
213 |
for file in new: |
eab8a264a833
Pulled the DBRTools from their own repo and popped them into this one. Still very much a 'work in progress'.
MattD <mattd@symbian.org>
parents:
diff
changeset
|
214 |
if(file not in db): |
eab8a264a833
Pulled the DBRTools from their own repo and popped them into this one. Still very much a 'work in progress'.
MattD <mattd@symbian.org>
parents:
diff
changeset
|
215 |
db[file] = dict() |
eab8a264a833
Pulled the DBRTools from their own repo and popped them into this one. Still very much a 'work in progress'.
MattD <mattd@symbian.org>
parents:
diff
changeset
|
216 |
# else: |
eab8a264a833
Pulled the DBRTools from their own repo and popped them into this one. Still very much a 'work in progress'.
MattD <mattd@symbian.org>
parents:
diff
changeset
|
217 |
# print '%s overriding %s' % (name,file) |
eab8a264a833
Pulled the DBRTools from their own repo and popped them into this one. Still very much a 'work in progress'.
MattD <mattd@symbian.org>
parents:
diff
changeset
|
218 |
db[file]['time'] = new[file]['time'] |
eab8a264a833
Pulled the DBRTools from their own repo and popped them into this one. Still very much a 'work in progress'.
MattD <mattd@symbian.org>
parents:
diff
changeset
|
219 |
db[file]['md5'] = new[file]['md5'] |
eab8a264a833
Pulled the DBRTools from their own repo and popped them into this one. Still very much a 'work in progress'.
MattD <mattd@symbian.org>
parents:
diff
changeset
|
220 |
db[file]['size'] = new[file]['size'] |
eab8a264a833
Pulled the DBRTools from their own repo and popped them into this one. Still very much a 'work in progress'.
MattD <mattd@symbian.org>
parents:
diff
changeset
|
221 |
db[file]['name'] = name |
eab8a264a833
Pulled the DBRTools from their own repo and popped them into this one. Still very much a 'work in progress'.
MattD <mattd@symbian.org>
parents:
diff
changeset
|
222 |
return db |
eab8a264a833
Pulled the DBRTools from their own repo and popped them into this one. Still very much a 'work in progress'.
MattD <mattd@symbian.org>
parents:
diff
changeset
|
223 |
|
eab8a264a833
Pulled the DBRTools from their own repo and popped them into this one. Still very much a 'work in progress'.
MattD <mattd@symbian.org>
parents:
diff
changeset
|
224 |
def listpatches(): |
217
1eec8c29548a
DBRTools - did some fixes to the nasty path appending I'd done for patches. This fixes some of the problems with doing 'diffenv' on patched databases with UNC paths.
MattD <mattd@symbian.org>
parents:
203
diff
changeset
|
225 |
patchfiles = glob.glob(os.path.join(dbrutils.patchpath(),'patch*.txt')) |
179
eab8a264a833
Pulled the DBRTools from their own repo and popped them into this one. Still very much a 'work in progress'.
MattD <mattd@symbian.org>
parents:
diff
changeset
|
226 |
print 'Installed patches' |
eab8a264a833
Pulled the DBRTools from their own repo and popped them into this one. Still very much a 'work in progress'.
MattD <mattd@symbian.org>
parents:
diff
changeset
|
227 |
for file in patchfiles: |
eab8a264a833
Pulled the DBRTools from their own repo and popped them into this one. Still very much a 'work in progress'.
MattD <mattd@symbian.org>
parents:
diff
changeset
|
228 |
print '\t%s' % re.sub('.txt','',os.path.basename(file)) |
eab8a264a833
Pulled the DBRTools from their own repo and popped them into this one. Still very much a 'work in progress'.
MattD <mattd@symbian.org>
parents:
diff
changeset
|
229 |
|
eab8a264a833
Pulled the DBRTools from their own repo and popped them into this one. Still very much a 'work in progress'.
MattD <mattd@symbian.org>
parents:
diff
changeset
|
230 |
def removepatch(patch): |
eab8a264a833
Pulled the DBRTools from their own repo and popped them into this one. Still very much a 'work in progress'.
MattD <mattd@symbian.org>
parents:
diff
changeset
|
231 |
path = dbrutils.patchpath() |
217
1eec8c29548a
DBRTools - did some fixes to the nasty path appending I'd done for patches. This fixes some of the problems with doing 'diffenv' on patched databases with UNC paths.
MattD <mattd@symbian.org>
parents:
203
diff
changeset
|
232 |
file = os.path.join(path,'%s.txt' % patch) |
179
eab8a264a833
Pulled the DBRTools from their own repo and popped them into this one. Still very much a 'work in progress'.
MattD <mattd@symbian.org>
parents:
diff
changeset
|
233 |
files = set() |
eab8a264a833
Pulled the DBRTools from their own repo and popped them into this one. Still very much a 'work in progress'.
MattD <mattd@symbian.org>
parents:
diff
changeset
|
234 |
files.add(file) |
eab8a264a833
Pulled the DBRTools from their own repo and popped them into this one. Still very much a 'work in progress'.
MattD <mattd@symbian.org>
parents:
diff
changeset
|
235 |
dbrutils.deletefiles(files) |
eab8a264a833
Pulled the DBRTools from their own repo and popped them into this one. Still very much a 'work in progress'.
MattD <mattd@symbian.org>
parents:
diff
changeset
|
236 |
|
eab8a264a833
Pulled the DBRTools from their own repo and popped them into this one. Still very much a 'work in progress'.
MattD <mattd@symbian.org>
parents:
diff
changeset
|
237 |
|
eab8a264a833
Pulled the DBRTools from their own repo and popped them into this one. Still very much a 'work in progress'.
MattD <mattd@symbian.org>
parents:
diff
changeset
|
238 |
def loadpatches(path): |
eab8a264a833
Pulled the DBRTools from their own repo and popped them into this one. Still very much a 'work in progress'.
MattD <mattd@symbian.org>
parents:
diff
changeset
|
239 |
patches = dict() |
217
1eec8c29548a
DBRTools - did some fixes to the nasty path appending I'd done for patches. This fixes some of the problems with doing 'diffenv' on patched databases with UNC paths.
MattD <mattd@symbian.org>
parents:
203
diff
changeset
|
240 |
patchfiles = glob.glob(os.path.join(path,'patch*.txt')) |
179
eab8a264a833
Pulled the DBRTools from their own repo and popped them into this one. Still very much a 'work in progress'.
MattD <mattd@symbian.org>
parents:
diff
changeset
|
241 |
|
eab8a264a833
Pulled the DBRTools from their own repo and popped them into this one. Still very much a 'work in progress'.
MattD <mattd@symbian.org>
parents:
diff
changeset
|
242 |
for file in patchfiles: |
eab8a264a833
Pulled the DBRTools from their own repo and popped them into this one. Still very much a 'work in progress'.
MattD <mattd@symbian.org>
parents:
diff
changeset
|
243 |
print 'Loading patch: %s' % re.sub('.txt','',os.path.basename(file)) |
eab8a264a833
Pulled the DBRTools from their own repo and popped them into this one. Still very much a 'work in progress'.
MattD <mattd@symbian.org>
parents:
diff
changeset
|
244 |
# print 'Reading: %s\n' % file |
eab8a264a833
Pulled the DBRTools from their own repo and popped them into this one. Still very much a 'work in progress'.
MattD <mattd@symbian.org>
parents:
diff
changeset
|
245 |
# patchname = re.match('\S+patch(\S+)\.txt',file) |
eab8a264a833
Pulled the DBRTools from their own repo and popped them into this one. Still very much a 'work in progress'.
MattD <mattd@symbian.org>
parents:
diff
changeset
|
246 |
# print 'patchname %s' % patchname.group(1); |
eab8a264a833
Pulled the DBRTools from their own repo and popped them into this one. Still very much a 'work in progress'.
MattD <mattd@symbian.org>
parents:
diff
changeset
|
247 |
patch = readpatch(file) |
eab8a264a833
Pulled the DBRTools from their own repo and popped them into this one. Still very much a 'work in progress'.
MattD <mattd@symbian.org>
parents:
diff
changeset
|
248 |
# patches[patchname.group(1)] = patch |
eab8a264a833
Pulled the DBRTools from their own repo and popped them into this one. Still very much a 'work in progress'.
MattD <mattd@symbian.org>
parents:
diff
changeset
|
249 |
# print 'Read %s from %s' % (patch['name'],file) |
eab8a264a833
Pulled the DBRTools from their own repo and popped them into this one. Still very much a 'work in progress'.
MattD <mattd@symbian.org>
parents:
diff
changeset
|
250 |
patches[file] = patch |
eab8a264a833
Pulled the DBRTools from their own repo and popped them into this one. Still very much a 'work in progress'.
MattD <mattd@symbian.org>
parents:
diff
changeset
|
251 |
return patches |
eab8a264a833
Pulled the DBRTools from their own repo and popped them into this one. Still very much a 'work in progress'.
MattD <mattd@symbian.org>
parents:
diff
changeset
|
252 |
|
eab8a264a833
Pulled the DBRTools from their own repo and popped them into this one. Still very much a 'work in progress'.
MattD <mattd@symbian.org>
parents:
diff
changeset
|
253 |
|
eab8a264a833
Pulled the DBRTools from their own repo and popped them into this one. Still very much a 'work in progress'.
MattD <mattd@symbian.org>
parents:
diff
changeset
|
254 |
def savepatches(patches): |
eab8a264a833
Pulled the DBRTools from their own repo and popped them into this one. Still very much a 'work in progress'.
MattD <mattd@symbian.org>
parents:
diff
changeset
|
255 |
for patch in sorted(patches.keys()): |
eab8a264a833
Pulled the DBRTools from their own repo and popped them into this one. Still very much a 'work in progress'.
MattD <mattd@symbian.org>
parents:
diff
changeset
|
256 |
# print 'writing %s to %s' % (patches[patch]['name'],patch) |
eab8a264a833
Pulled the DBRTools from their own repo and popped them into this one. Still very much a 'work in progress'.
MattD <mattd@symbian.org>
parents:
diff
changeset
|
257 |
writepatch(patches[patch], patch) |
eab8a264a833
Pulled the DBRTools from their own repo and popped them into this one. Still very much a 'work in progress'.
MattD <mattd@symbian.org>
parents:
diff
changeset
|
258 |
|
eab8a264a833
Pulled the DBRTools from their own repo and popped them into this one. Still very much a 'work in progress'.
MattD <mattd@symbian.org>
parents:
diff
changeset
|
259 |
|
eab8a264a833
Pulled the DBRTools from their own repo and popped them into this one. Still very much a 'work in progress'.
MattD <mattd@symbian.org>
parents:
diff
changeset
|
260 |
def writepatch(patch, filename): |
eab8a264a833
Pulled the DBRTools from their own repo and popped them into this one. Still very much a 'work in progress'.
MattD <mattd@symbian.org>
parents:
diff
changeset
|
261 |
file = open(filename,'w') |
eab8a264a833
Pulled the DBRTools from their own repo and popped them into this one. Still very much a 'work in progress'.
MattD <mattd@symbian.org>
parents:
diff
changeset
|
262 |
# print 'saving patch to %s' %filename |
eab8a264a833
Pulled the DBRTools from their own repo and popped them into this one. Still very much a 'work in progress'.
MattD <mattd@symbian.org>
parents:
diff
changeset
|
263 |
file.write("name=%s\n" % patch['name']); |
eab8a264a833
Pulled the DBRTools from their own repo and popped them into this one. Still very much a 'work in progress'.
MattD <mattd@symbian.org>
parents:
diff
changeset
|
264 |
file.write("time=%s\n" % patch['time']); |
eab8a264a833
Pulled the DBRTools from their own repo and popped them into this one. Still very much a 'work in progress'.
MattD <mattd@symbian.org>
parents:
diff
changeset
|
265 |
|
eab8a264a833
Pulled the DBRTools from their own repo and popped them into this one. Still very much a 'work in progress'.
MattD <mattd@symbian.org>
parents:
diff
changeset
|
266 |
removed = patch['removed'] |
eab8a264a833
Pulled the DBRTools from their own repo and popped them into this one. Still very much a 'work in progress'.
MattD <mattd@symbian.org>
parents:
diff
changeset
|
267 |
for filename in sorted(removed): |
eab8a264a833
Pulled the DBRTools from their own repo and popped them into this one. Still very much a 'work in progress'.
MattD <mattd@symbian.org>
parents:
diff
changeset
|
268 |
str = "removed=%s\n" % filename |
eab8a264a833
Pulled the DBRTools from their own repo and popped them into this one. Still very much a 'work in progress'.
MattD <mattd@symbian.org>
parents:
diff
changeset
|
269 |
file.write(str) |
eab8a264a833
Pulled the DBRTools from their own repo and popped them into this one. Still very much a 'work in progress'.
MattD <mattd@symbian.org>
parents:
diff
changeset
|
270 |
|
eab8a264a833
Pulled the DBRTools from their own repo and popped them into this one. Still very much a 'work in progress'.
MattD <mattd@symbian.org>
parents:
diff
changeset
|
271 |
added = patch['added'] |
eab8a264a833
Pulled the DBRTools from their own repo and popped them into this one. Still very much a 'work in progress'.
MattD <mattd@symbian.org>
parents:
diff
changeset
|
272 |
for filename in sorted(added): |
eab8a264a833
Pulled the DBRTools from their own repo and popped them into this one. Still very much a 'work in progress'.
MattD <mattd@symbian.org>
parents:
diff
changeset
|
273 |
if (len(added[filename]) < 3): |
eab8a264a833
Pulled the DBRTools from their own repo and popped them into this one. Still very much a 'work in progress'.
MattD <mattd@symbian.org>
parents:
diff
changeset
|
274 |
added[filename].append('') |
eab8a264a833
Pulled the DBRTools from their own repo and popped them into this one. Still very much a 'work in progress'.
MattD <mattd@symbian.org>
parents:
diff
changeset
|
275 |
str = "added=%s:%s:%s:%s\n" %( added[filename]['time'],added[filename]['size'],added[filename]['md5'], filename) |
eab8a264a833
Pulled the DBRTools from their own repo and popped them into this one. Still very much a 'work in progress'.
MattD <mattd@symbian.org>
parents:
diff
changeset
|
276 |
file.write(str) |
eab8a264a833
Pulled the DBRTools from their own repo and popped them into this one. Still very much a 'work in progress'.
MattD <mattd@symbian.org>
parents:
diff
changeset
|
277 |
|
eab8a264a833
Pulled the DBRTools from their own repo and popped them into this one. Still very much a 'work in progress'.
MattD <mattd@symbian.org>
parents:
diff
changeset
|
278 |
changed = patch['changed'] |
eab8a264a833
Pulled the DBRTools from their own repo and popped them into this one. Still very much a 'work in progress'.
MattD <mattd@symbian.org>
parents:
diff
changeset
|
279 |
for filename in sorted(changed): |
eab8a264a833
Pulled the DBRTools from their own repo and popped them into this one. Still very much a 'work in progress'.
MattD <mattd@symbian.org>
parents:
diff
changeset
|
280 |
if (len(changed[filename]) < 3): |
eab8a264a833
Pulled the DBRTools from their own repo and popped them into this one. Still very much a 'work in progress'.
MattD <mattd@symbian.org>
parents:
diff
changeset
|
281 |
changed[filename].append('') |
eab8a264a833
Pulled the DBRTools from their own repo and popped them into this one. Still very much a 'work in progress'.
MattD <mattd@symbian.org>
parents:
diff
changeset
|
282 |
str = "changed=%s:%s:%s:%s\n" %( changed[filename]['time'],changed[filename]['size'],changed[filename]['md5'], filename) |
eab8a264a833
Pulled the DBRTools from their own repo and popped them into this one. Still very much a 'work in progress'.
MattD <mattd@symbian.org>
parents:
diff
changeset
|
283 |
file.write(str) |
eab8a264a833
Pulled the DBRTools from their own repo and popped them into this one. Still very much a 'work in progress'.
MattD <mattd@symbian.org>
parents:
diff
changeset
|
284 |
file.close() |
eab8a264a833
Pulled the DBRTools from their own repo and popped them into this one. Still very much a 'work in progress'.
MattD <mattd@symbian.org>
parents:
diff
changeset
|
285 |
|
eab8a264a833
Pulled the DBRTools from their own repo and popped them into this one. Still very much a 'work in progress'.
MattD <mattd@symbian.org>
parents:
diff
changeset
|
286 |
|
eab8a264a833
Pulled the DBRTools from their own repo and popped them into this one. Still very much a 'work in progress'.
MattD <mattd@symbian.org>
parents:
diff
changeset
|
287 |
def readpatch(filename): |
eab8a264a833
Pulled the DBRTools from their own repo and popped them into this one. Still very much a 'work in progress'.
MattD <mattd@symbian.org>
parents:
diff
changeset
|
288 |
file = open(filename,'r') |
eab8a264a833
Pulled the DBRTools from their own repo and popped them into this one. Still very much a 'work in progress'.
MattD <mattd@symbian.org>
parents:
diff
changeset
|
289 |
#name=blah |
eab8a264a833
Pulled the DBRTools from their own repo and popped them into this one. Still very much a 'work in progress'.
MattD <mattd@symbian.org>
parents:
diff
changeset
|
290 |
#time=blah |
eab8a264a833
Pulled the DBRTools from their own repo and popped them into this one. Still very much a 'work in progress'.
MattD <mattd@symbian.org>
parents:
diff
changeset
|
291 |
#removed=file |
eab8a264a833
Pulled the DBRTools from their own repo and popped them into this one. Still very much a 'work in progress'.
MattD <mattd@symbian.org>
parents:
diff
changeset
|
292 |
#added=time:size:md5:file |
eab8a264a833
Pulled the DBRTools from their own repo and popped them into this one. Still very much a 'work in progress'.
MattD <mattd@symbian.org>
parents:
diff
changeset
|
293 |
#changed=time:size:md5:file |
eab8a264a833
Pulled the DBRTools from their own repo and popped them into this one. Still very much a 'work in progress'.
MattD <mattd@symbian.org>
parents:
diff
changeset
|
294 |
patch = dict() |
eab8a264a833
Pulled the DBRTools from their own repo and popped them into this one. Still very much a 'work in progress'.
MattD <mattd@symbian.org>
parents:
diff
changeset
|
295 |
removed = set() |
eab8a264a833
Pulled the DBRTools from their own repo and popped them into this one. Still very much a 'work in progress'.
MattD <mattd@symbian.org>
parents:
diff
changeset
|
296 |
added = dict() |
eab8a264a833
Pulled the DBRTools from their own repo and popped them into this one. Still very much a 'work in progress'.
MattD <mattd@symbian.org>
parents:
diff
changeset
|
297 |
changed = dict() |
eab8a264a833
Pulled the DBRTools from their own repo and popped them into this one. Still very much a 'work in progress'.
MattD <mattd@symbian.org>
parents:
diff
changeset
|
298 |
for line in file: |
eab8a264a833
Pulled the DBRTools from their own repo and popped them into this one. Still very much a 'work in progress'.
MattD <mattd@symbian.org>
parents:
diff
changeset
|
299 |
results = re.split('=|\n',line) |
eab8a264a833
Pulled the DBRTools from their own repo and popped them into this one. Still very much a 'work in progress'.
MattD <mattd@symbian.org>
parents:
diff
changeset
|
300 |
type = results[0] |
eab8a264a833
Pulled the DBRTools from their own repo and popped them into this one. Still very much a 'work in progress'.
MattD <mattd@symbian.org>
parents:
diff
changeset
|
301 |
if( type == 'name'): |
eab8a264a833
Pulled the DBRTools from their own repo and popped them into this one. Still very much a 'work in progress'.
MattD <mattd@symbian.org>
parents:
diff
changeset
|
302 |
patch['name'] = results[1] |
eab8a264a833
Pulled the DBRTools from their own repo and popped them into this one. Still very much a 'work in progress'.
MattD <mattd@symbian.org>
parents:
diff
changeset
|
303 |
elif( type == 'time'): |
eab8a264a833
Pulled the DBRTools from their own repo and popped them into this one. Still very much a 'work in progress'.
MattD <mattd@symbian.org>
parents:
diff
changeset
|
304 |
patch['time'] = results[1] |
eab8a264a833
Pulled the DBRTools from their own repo and popped them into this one. Still very much a 'work in progress'.
MattD <mattd@symbian.org>
parents:
diff
changeset
|
305 |
elif( type == 'removed'): |
eab8a264a833
Pulled the DBRTools from their own repo and popped them into this one. Still very much a 'work in progress'.
MattD <mattd@symbian.org>
parents:
diff
changeset
|
306 |
removed.add(results[1]) |
eab8a264a833
Pulled the DBRTools from their own repo and popped them into this one. Still very much a 'work in progress'.
MattD <mattd@symbian.org>
parents:
diff
changeset
|
307 |
elif(( type == 'added') or (type == 'changed')): |
eab8a264a833
Pulled the DBRTools from their own repo and popped them into this one. Still very much a 'work in progress'.
MattD <mattd@symbian.org>
parents:
diff
changeset
|
308 |
results2 = re.split(':|\n',results[1]) |
eab8a264a833
Pulled the DBRTools from their own repo and popped them into this one. Still very much a 'work in progress'.
MattD <mattd@symbian.org>
parents:
diff
changeset
|
309 |
entry = dict() |
eab8a264a833
Pulled the DBRTools from their own repo and popped them into this one. Still very much a 'work in progress'.
MattD <mattd@symbian.org>
parents:
diff
changeset
|
310 |
entry['time'] = results2[0] |
eab8a264a833
Pulled the DBRTools from their own repo and popped them into this one. Still very much a 'work in progress'.
MattD <mattd@symbian.org>
parents:
diff
changeset
|
311 |
entry['size'] = results2[1] |
eab8a264a833
Pulled the DBRTools from their own repo and popped them into this one. Still very much a 'work in progress'.
MattD <mattd@symbian.org>
parents:
diff
changeset
|
312 |
entry['md5'] = results2[2] |
eab8a264a833
Pulled the DBRTools from their own repo and popped them into this one. Still very much a 'work in progress'.
MattD <mattd@symbian.org>
parents:
diff
changeset
|
313 |
if(type == 'added'): |
eab8a264a833
Pulled the DBRTools from their own repo and popped them into this one. Still very much a 'work in progress'.
MattD <mattd@symbian.org>
parents:
diff
changeset
|
314 |
added[results2[3]] = entry |
eab8a264a833
Pulled the DBRTools from their own repo and popped them into this one. Still very much a 'work in progress'.
MattD <mattd@symbian.org>
parents:
diff
changeset
|
315 |
else: |
eab8a264a833
Pulled the DBRTools from their own repo and popped them into this one. Still very much a 'work in progress'.
MattD <mattd@symbian.org>
parents:
diff
changeset
|
316 |
changed[results2[3]] = entry |
eab8a264a833
Pulled the DBRTools from their own repo and popped them into this one. Still very much a 'work in progress'.
MattD <mattd@symbian.org>
parents:
diff
changeset
|
317 |
file.close() |
eab8a264a833
Pulled the DBRTools from their own repo and popped them into this one. Still very much a 'work in progress'.
MattD <mattd@symbian.org>
parents:
diff
changeset
|
318 |
patch['removed'] = removed |
eab8a264a833
Pulled the DBRTools from their own repo and popped them into this one. Still very much a 'work in progress'.
MattD <mattd@symbian.org>
parents:
diff
changeset
|
319 |
patch['added'] = added |
eab8a264a833
Pulled the DBRTools from their own repo and popped them into this one. Still very much a 'work in progress'.
MattD <mattd@symbian.org>
parents:
diff
changeset
|
320 |
patch['changed'] = changed |
eab8a264a833
Pulled the DBRTools from their own repo and popped them into this one. Still very much a 'work in progress'.
MattD <mattd@symbian.org>
parents:
diff
changeset
|
321 |
return patch |
eab8a264a833
Pulled the DBRTools from their own repo and popped them into this one. Still very much a 'work in progress'.
MattD <mattd@symbian.org>
parents:
diff
changeset
|
322 |