author | Dario Sestito <darios@symbian.org> |
Wed, 24 Mar 2010 15:37:22 +0000 | |
changeset 215 | a403724f631c |
parent 208 | 01c2b1268053 |
child 217 | 1eec8c29548a |
permissions | -rw-r--r-- |
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:
diff
changeset
|
1 |
# Copyright (c) 2010 Symbian Foundation Ltd |
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:
diff
changeset
|
2 |
# This component and the accompanying materials are made available |
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:
diff
changeset
|
3 |
# under the terms of the License "Eclipse Public License v1.0" |
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:
diff
changeset
|
4 |
# which accompanies this distribution, and is available |
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:
diff
changeset
|
5 |
# at the URL "http://www.eclipse.org/legal/epl-v10.html". |
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:
diff
changeset
|
6 |
# |
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:
diff
changeset
|
7 |
# Initial Contributors: |
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:
diff
changeset
|
8 |
# Symbian Foundation Ltd - initial contribution. |
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:
diff
changeset
|
9 |
# |
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:
diff
changeset
|
10 |
# Contributors: |
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:
diff
changeset
|
11 |
# mattd <mattd@symbian.org> |
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:
diff
changeset
|
12 |
# |
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:
diff
changeset
|
13 |
# Description: |
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:
diff
changeset
|
14 |
# DBREnv - OO rewrite of the Environments |
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:
diff
changeset
|
15 |
|
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:
diff
changeset
|
16 |
#I'm using the existing stuff as helpers until things get relocated... |
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:
diff
changeset
|
17 |
import os.path |
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:
diff
changeset
|
18 |
import glob |
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:
diff
changeset
|
19 |
|
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:
diff
changeset
|
20 |
import dbrutils |
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:
diff
changeset
|
21 |
import dbrbaseline |
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:
diff
changeset
|
22 |
import dbrpatch |
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:
diff
changeset
|
23 |
|
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:
diff
changeset
|
24 |
|
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:
diff
changeset
|
25 |
def CreateDB(location): #virtual constructor |
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:
diff
changeset
|
26 |
print location |
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:
diff
changeset
|
27 |
# print dbrutils.patch_path_internal() |
208
01c2b1268053
Embryonic support for filtering. Can now use a file list with diffenv to filter the results.
MattD <mattd@symbian.org>
parents:
203
diff
changeset
|
28 |
if(os.path.isfile(os.path.join(location,dbrutils.defaultdb()))): |
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:
diff
changeset
|
29 |
# print 'loading baseline environment' |
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:
diff
changeset
|
30 |
# return DBRBaselineEnv(location) |
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:
diff
changeset
|
31 |
print 'loading patched baseline environment' |
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:
diff
changeset
|
32 |
return DBRPatchedBaselineEnv(location) |
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:
diff
changeset
|
33 |
if(os.path.exists(os.path.join(location,'build_md5.zip'))): |
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:
diff
changeset
|
34 |
print 'loading zipped environment' |
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:
diff
changeset
|
35 |
return DBRZippedEnv(location) |
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:
diff
changeset
|
36 |
if(os.path.exists(os.path.join(location,dbrutils.patch_path_internal()))): #should do something more fun with creating a basleine if we have MD5s |
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:
diff
changeset
|
37 |
print 'loading new env...warning: this is only here for compatibility' |
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:
diff
changeset
|
38 |
return DBRNewLocalEnv(location) |
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:
diff
changeset
|
39 |
if(os.path.exists(os.path.join(location,'epoc32'))): |
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:
diff
changeset
|
40 |
print 'loading localenv' |
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:
diff
changeset
|
41 |
return DBRLocalEnv(location) |
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:
diff
changeset
|
42 |
|
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:
diff
changeset
|
43 |
return DBREnv(location) |
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:
diff
changeset
|
44 |
|
208
01c2b1268053
Embryonic support for filtering. Can now use a file list with diffenv to filter the results.
MattD <mattd@symbian.org>
parents:
203
diff
changeset
|
45 |
#Start simple with the filtering... |
01c2b1268053
Embryonic support for filtering. Can now use a file list with diffenv to filter the results.
MattD <mattd@symbian.org>
parents:
203
diff
changeset
|
46 |
def CreateFilter(arg): |
01c2b1268053
Embryonic support for filtering. Can now use a file list with diffenv to filter the results.
MattD <mattd@symbian.org>
parents:
203
diff
changeset
|
47 |
if(os.path.isfile(arg)): |
01c2b1268053
Embryonic support for filtering. Can now use a file list with diffenv to filter the results.
MattD <mattd@symbian.org>
parents:
203
diff
changeset
|
48 |
return DBRFileFilter(arg) |
01c2b1268053
Embryonic support for filtering. Can now use a file list with diffenv to filter the results.
MattD <mattd@symbian.org>
parents:
203
diff
changeset
|
49 |
return DBRFilter() |
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:
diff
changeset
|
50 |
|
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:
diff
changeset
|
51 |
class DBREnv: |
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:
diff
changeset
|
52 |
db = dict() |
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:
diff
changeset
|
53 |
location = '' |
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:
diff
changeset
|
54 |
name = '' |
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:
diff
changeset
|
55 |
def __init__(self, location): |
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:
diff
changeset
|
56 |
self.location = location |
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:
diff
changeset
|
57 |
|
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:
diff
changeset
|
58 |
def compare(self, other): |
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:
diff
changeset
|
59 |
db1files = set(self.db.keys()) |
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:
diff
changeset
|
60 |
db2files = set(other.db.keys()) |
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:
diff
changeset
|
61 |
|
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:
diff
changeset
|
62 |
removed = db1files - db2files |
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:
diff
changeset
|
63 |
added = db2files - db1files |
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:
diff
changeset
|
64 |
common = db1files & db2files |
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:
diff
changeset
|
65 |
|
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:
diff
changeset
|
66 |
touched = set() |
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:
diff
changeset
|
67 |
for file in common: |
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:
diff
changeset
|
68 |
if(int(self.db[file]['time']) != int(other.db[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:
diff
changeset
|
69 |
touched.add(file) |
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:
diff
changeset
|
70 |
|
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:
diff
changeset
|
71 |
sizechanged = set() |
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:
diff
changeset
|
72 |
for file in common: |
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:
diff
changeset
|
73 |
if(int(self.db[file]['size']) != int(other.db[file]['size'])): |
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:
diff
changeset
|
74 |
sizechanged.add(file) |
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:
diff
changeset
|
75 |
#can be funny with some zip files...suggest we don't use sizechanged... |
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:
diff
changeset
|
76 |
# changed = sizechanged |
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:
diff
changeset
|
77 |
changed = set() |
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:
diff
changeset
|
78 |
touched = touched - changed |
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:
diff
changeset
|
79 |
unknown = set() |
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:
diff
changeset
|
80 |
for file in 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:
diff
changeset
|
81 |
if((self.db[file]['md5'] == "xxx") or (other.db[file]['md5'] == "xxx")): |
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:
diff
changeset
|
82 |
unknown.add(file) |
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:
diff
changeset
|
83 |
# if((self.db[file]['md5'] == "xxx")): |
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:
diff
changeset
|
84 |
# print 'unknown left: %s' % file |
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:
diff
changeset
|
85 |
# else: |
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:
diff
changeset
|
86 |
# print 'unknown right: %s' % file |
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:
diff
changeset
|
87 |
else: |
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:
diff
changeset
|
88 |
if(self.db[file]['md5'] != other.db[file]['md5']): |
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:
diff
changeset
|
89 |
# print '%s %s %s' % (file, self.db[file]['md5'], other.db[file]['md5'] ) |
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:
diff
changeset
|
90 |
changed.add(file) |
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:
diff
changeset
|
91 |
touched = touched - unknown |
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:
diff
changeset
|
92 |
touched = touched - changed |
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:
diff
changeset
|
93 |
|
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:
diff
changeset
|
94 |
results = DBRCompResults(added, removed, touched, changed, unknown) |
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:
diff
changeset
|
95 |
return results |
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:
diff
changeset
|
96 |
|
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:
diff
changeset
|
97 |
def verify(self, files): |
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:
diff
changeset
|
98 |
print 'this is a pure virtual...' |
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:
diff
changeset
|
99 |
def save(self): |
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:
diff
changeset
|
100 |
print 'this is a pure virtual...' |
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:
diff
changeset
|
101 |
|
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:
diff
changeset
|
102 |
def remove(self, files): |
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:
diff
changeset
|
103 |
for file in files: |
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:
diff
changeset
|
104 |
if(file in self.db): |
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:
diff
changeset
|
105 |
del self.db[file] |
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:
diff
changeset
|
106 |
else: |
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:
diff
changeset
|
107 |
print 'warning: del: %s isnt defined' % file |
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:
diff
changeset
|
108 |
|
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:
diff
changeset
|
109 |
def add(self, other, files): |
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:
diff
changeset
|
110 |
for file in files: |
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:
diff
changeset
|
111 |
if(file in self.db): |
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:
diff
changeset
|
112 |
print 'warning: add: %s already defined' % file |
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:
diff
changeset
|
113 |
else: |
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:
diff
changeset
|
114 |
if(other.db[file]['md5'] == 'xxx'): #don't update a null md5 |
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:
diff
changeset
|
115 |
print 'warning: MD5: %s isnt defined' % file |
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:
diff
changeset
|
116 |
else: |
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:
diff
changeset
|
117 |
self.db[file] = other.db[file] |
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:
diff
changeset
|
118 |
|
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:
diff
changeset
|
119 |
def update(self, other, files): |
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:
diff
changeset
|
120 |
for file in files: |
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:
diff
changeset
|
121 |
if(other.db[file]['md5'] != 'xxx'): #don't update a null md5 |
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:
diff
changeset
|
122 |
self.db[file]['md5'] = other.db[file]['md5'] |
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:
diff
changeset
|
123 |
else: |
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:
diff
changeset
|
124 |
print 'warning: MD5: %s isnt defined' % file |
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:
diff
changeset
|
125 |
|
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:
diff
changeset
|
126 |
self.db[file]['time'] = other.db[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:
diff
changeset
|
127 |
self.db[file]['size'] = other.db[file]['size'] |
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:
diff
changeset
|
128 |
|
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:
diff
changeset
|
129 |
|
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:
diff
changeset
|
130 |
#Database plus local filesystem access |
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:
diff
changeset
|
131 |
class DBRLocalEnv (DBREnv): |
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:
diff
changeset
|
132 |
def __init__(self, location): |
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:
diff
changeset
|
133 |
DBREnv.__init__(self, location) |
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:
diff
changeset
|
134 |
#load up local files... |
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:
diff
changeset
|
135 |
self.db = dbrutils.scanenv() |
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:
diff
changeset
|
136 |
|
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:
diff
changeset
|
137 |
def verify(self, files): |
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:
diff
changeset
|
138 |
#should assert that the files are in the local DB. |
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:
diff
changeset
|
139 |
localfiles = set(self.db.keys()) |
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:
diff
changeset
|
140 |
if(localfiles.issuperset(files)): |
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:
diff
changeset
|
141 |
md5s = dbrutils.generateMD5s(files) |
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:
diff
changeset
|
142 |
for file in files: |
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:
diff
changeset
|
143 |
self.db[file]['md5'] = md5s[file]['md5'] |
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:
diff
changeset
|
144 |
|
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:
diff
changeset
|
145 |
class DBRNewLocalEnv (DBRLocalEnv): |
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:
diff
changeset
|
146 |
def __init__(self, location): |
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:
diff
changeset
|
147 |
DBRLocalEnv.__init__(self, location) |
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:
diff
changeset
|
148 |
#load up local files... |
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:
diff
changeset
|
149 |
hashes = glob.glob(os.path.join(dbrutils.patchpath(),'*.md5')) |
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:
diff
changeset
|
150 |
for file in hashes: |
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:
diff
changeset
|
151 |
print 'Reading: %s\n' % file |
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:
diff
changeset
|
152 |
dbrutils.gethashes(self.db, file, False) |
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:
diff
changeset
|
153 |
|
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:
diff
changeset
|
154 |
def save(self): |
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:
diff
changeset
|
155 |
filename = os.path.join(self.location,dbrutils.defaultdb()) |
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:
diff
changeset
|
156 |
print 'Saving %s' % filename |
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:
diff
changeset
|
157 |
dbrbaseline.writedb(self.db,filename) |
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:
diff
changeset
|
158 |
|
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:
diff
changeset
|
159 |
|
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:
diff
changeset
|
160 |
|
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:
diff
changeset
|
161 |
|
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:
diff
changeset
|
162 |
#zipped files, contains MD5s. |
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:
diff
changeset
|
163 |
class DBRZippedEnv (DBREnv): |
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:
diff
changeset
|
164 |
def __init__(self, location): |
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:
diff
changeset
|
165 |
DBREnv.__init__(self, location) |
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:
diff
changeset
|
166 |
#load up zip MD5 and stuff |
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:
diff
changeset
|
167 |
self.db = dbrutils.getzippedDB(self.location) |
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:
diff
changeset
|
168 |
|
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:
diff
changeset
|
169 |
#Database, but no filesystem access |
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:
diff
changeset
|
170 |
class DBRBaselineEnv (DBREnv): |
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:
diff
changeset
|
171 |
def __init__(self, location): |
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:
diff
changeset
|
172 |
DBREnv.__init__(self, location) |
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:
diff
changeset
|
173 |
#load up database... |
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:
diff
changeset
|
174 |
filename = os.path.join(self.location,dbrutils.defaultdb()) |
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:
diff
changeset
|
175 |
print 'Loading %s' % filename |
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:
diff
changeset
|
176 |
self.db = dbrbaseline.readdb(filename) |
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:
diff
changeset
|
177 |
|
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:
diff
changeset
|
178 |
def save(self): |
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:
diff
changeset
|
179 |
filename = os.path.join(self.location,dbrutils.defaultdb()) |
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:
diff
changeset
|
180 |
print 'Saving %s' % filename |
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:
diff
changeset
|
181 |
dbrbaseline.writedb(self.db,filename) |
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:
diff
changeset
|
182 |
|
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:
diff
changeset
|
183 |
class DBRPatchedBaselineEnv (DBRBaselineEnv): |
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:
diff
changeset
|
184 |
patches = [] |
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:
diff
changeset
|
185 |
baseline = [] |
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:
diff
changeset
|
186 |
def __init__(self, location): |
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:
diff
changeset
|
187 |
DBRBaselineEnv.__init__(self, location) |
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:
diff
changeset
|
188 |
#load up patches... |
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:
diff
changeset
|
189 |
if(len(self.db) > 0): |
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:
diff
changeset
|
190 |
self.baseline = self.db |
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:
diff
changeset
|
191 |
self.patches = dbrpatch.loadpatches(os.path.join(self.location,dbrutils.patchpath())) |
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:
diff
changeset
|
192 |
self.db = dbrpatch.createpatchedbaseline(self.baseline,self.patches) |
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:
diff
changeset
|
193 |
|
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:
diff
changeset
|
194 |
def save(self): |
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:
diff
changeset
|
195 |
self.baseline = dbrpatch.updatebaseline(self.baseline, self.db) |
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:
diff
changeset
|
196 |
self.patches = dbrpatch.updatepatches(self.patches, self.db) |
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:
diff
changeset
|
197 |
dbrpatch.savepatches(self.patches) |
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:
diff
changeset
|
198 |
self.db = self.baseline |
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:
diff
changeset
|
199 |
DBRBaselineEnv.save(self) |
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:
diff
changeset
|
200 |
|
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:
diff
changeset
|
201 |
|
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:
diff
changeset
|
202 |
class CBREnv (DBREnv): # placeholder for handling CBR components... |
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:
diff
changeset
|
203 |
def __init__(self, location): |
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:
diff
changeset
|
204 |
DBREnv.__init__(self, location) |
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:
diff
changeset
|
205 |
|
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:
diff
changeset
|
206 |
|
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:
diff
changeset
|
207 |
#comparison results... |
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:
diff
changeset
|
208 |
class DBRCompResults: |
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:
diff
changeset
|
209 |
added = set() |
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:
diff
changeset
|
210 |
removed = set() |
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:
diff
changeset
|
211 |
touched = set() |
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:
diff
changeset
|
212 |
changed = set() |
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:
diff
changeset
|
213 |
unknown = set() |
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:
diff
changeset
|
214 |
def __init__(self, added, removed, touched, changed, unknown): |
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:
diff
changeset
|
215 |
#Should probably assert that these are disjoint. |
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:
diff
changeset
|
216 |
self.added = added |
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:
diff
changeset
|
217 |
self.removed = removed |
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:
diff
changeset
|
218 |
self.touched = 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:
diff
changeset
|
219 |
self.changed = changed |
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:
diff
changeset
|
220 |
self.unknown = unknown |
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:
diff
changeset
|
221 |
|
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:
diff
changeset
|
222 |
def printdetail(self): |
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:
diff
changeset
|
223 |
for file in sorted(self.added): |
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:
diff
changeset
|
224 |
print 'added:', file |
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:
diff
changeset
|
225 |
for file in sorted(self.removed): |
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:
diff
changeset
|
226 |
print 'removed:', file |
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:
diff
changeset
|
227 |
for file in sorted(self.changed): |
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:
diff
changeset
|
228 |
print 'changed:', file |
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:
diff
changeset
|
229 |
for file in sorted(self.unknown): |
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:
diff
changeset
|
230 |
print 'unknown:', file |
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:
diff
changeset
|
231 |
|
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:
diff
changeset
|
232 |
def printsummary(self): |
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:
diff
changeset
|
233 |
if(len(self.added | self.removed | self.changed | self.unknown)): |
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:
diff
changeset
|
234 |
print 'status: dirty' |
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:
diff
changeset
|
235 |
else: |
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:
diff
changeset
|
236 |
print 'status: clean' |
208
01c2b1268053
Embryonic support for filtering. Can now use a file list with diffenv to filter the results.
MattD <mattd@symbian.org>
parents:
203
diff
changeset
|
237 |
|
01c2b1268053
Embryonic support for filtering. Can now use a file list with diffenv to filter the results.
MattD <mattd@symbian.org>
parents:
203
diff
changeset
|
238 |
|
01c2b1268053
Embryonic support for filtering. Can now use a file list with diffenv to filter the results.
MattD <mattd@symbian.org>
parents:
203
diff
changeset
|
239 |
|
01c2b1268053
Embryonic support for filtering. Can now use a file list with diffenv to filter the results.
MattD <mattd@symbian.org>
parents:
203
diff
changeset
|
240 |
class DBRFilter: |
01c2b1268053
Embryonic support for filtering. Can now use a file list with diffenv to filter the results.
MattD <mattd@symbian.org>
parents:
203
diff
changeset
|
241 |
info = '' |
01c2b1268053
Embryonic support for filtering. Can now use a file list with diffenv to filter the results.
MattD <mattd@symbian.org>
parents:
203
diff
changeset
|
242 |
def __init__(self): |
01c2b1268053
Embryonic support for filtering. Can now use a file list with diffenv to filter the results.
MattD <mattd@symbian.org>
parents:
203
diff
changeset
|
243 |
self.info = 'null filter' |
01c2b1268053
Embryonic support for filtering. Can now use a file list with diffenv to filter the results.
MattD <mattd@symbian.org>
parents:
203
diff
changeset
|
244 |
def filter(self, results): |
01c2b1268053
Embryonic support for filtering. Can now use a file list with diffenv to filter the results.
MattD <mattd@symbian.org>
parents:
203
diff
changeset
|
245 |
return results |
01c2b1268053
Embryonic support for filtering. Can now use a file list with diffenv to filter the results.
MattD <mattd@symbian.org>
parents:
203
diff
changeset
|
246 |
|
01c2b1268053
Embryonic support for filtering. Can now use a file list with diffenv to filter the results.
MattD <mattd@symbian.org>
parents:
203
diff
changeset
|
247 |
class DBRFileFilter (DBRFilter): |
01c2b1268053
Embryonic support for filtering. Can now use a file list with diffenv to filter the results.
MattD <mattd@symbian.org>
parents:
203
diff
changeset
|
248 |
filename = '' |
01c2b1268053
Embryonic support for filtering. Can now use a file list with diffenv to filter the results.
MattD <mattd@symbian.org>
parents:
203
diff
changeset
|
249 |
def __init__(self, filename): |
01c2b1268053
Embryonic support for filtering. Can now use a file list with diffenv to filter the results.
MattD <mattd@symbian.org>
parents:
203
diff
changeset
|
250 |
DBRFilter.__init__(self) |
01c2b1268053
Embryonic support for filtering. Can now use a file list with diffenv to filter the results.
MattD <mattd@symbian.org>
parents:
203
diff
changeset
|
251 |
self.info = 'file filter' |
01c2b1268053
Embryonic support for filtering. Can now use a file list with diffenv to filter the results.
MattD <mattd@symbian.org>
parents:
203
diff
changeset
|
252 |
self.filename = filename |
01c2b1268053
Embryonic support for filtering. Can now use a file list with diffenv to filter the results.
MattD <mattd@symbian.org>
parents:
203
diff
changeset
|
253 |
self.files = dbrutils.readfilenamesfromfile(self.filename) |
01c2b1268053
Embryonic support for filtering. Can now use a file list with diffenv to filter the results.
MattD <mattd@symbian.org>
parents:
203
diff
changeset
|
254 |
# for file in sorted(self.files): |
01c2b1268053
Embryonic support for filtering. Can now use a file list with diffenv to filter the results.
MattD <mattd@symbian.org>
parents:
203
diff
changeset
|
255 |
# print file |
01c2b1268053
Embryonic support for filtering. Can now use a file list with diffenv to filter the results.
MattD <mattd@symbian.org>
parents:
203
diff
changeset
|
256 |
|
01c2b1268053
Embryonic support for filtering. Can now use a file list with diffenv to filter the results.
MattD <mattd@symbian.org>
parents:
203
diff
changeset
|
257 |
def filter(self, results): |
01c2b1268053
Embryonic support for filtering. Can now use a file list with diffenv to filter the results.
MattD <mattd@symbian.org>
parents:
203
diff
changeset
|
258 |
return DBRCompResults(results.added & self.files, results.removed & self.files, results.touched & self.files, results.changed & self.files, results.unknown & self.files) |
01c2b1268053
Embryonic support for filtering. Can now use a file list with diffenv to filter the results.
MattD <mattd@symbian.org>
parents:
203
diff
changeset
|
259 |