author | MattD <mattd@symbian.org> |
Sun, 13 Jun 2010 20:39:03 +0100 | |
branch | DBRToolsDev |
changeset 285 | 6a928cf9e181 |
parent 283 | 398d483e91bb |
permissions | -rw-r--r-- |
206
2fd92922bf5c
DBRTools - initial version of cleanenv using new structure. Works ok apart from cleaning patches, which isn't in this version.
MattD <mattd@symbian.org>
parents:
203
diff
changeset
|
1 |
# Copyright (c) 2009-2010 Symbian Foundation Ltd |
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
|
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 |
# DBR cleanenv - cleans your environment |
eab8a264a833
Pulled the DBRTools 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 |
|
206
2fd92922bf5c
DBRTools - initial version of cleanenv using new structure. Works ok apart from cleaning patches, which isn't in this version.
MattD <mattd@symbian.org>
parents:
203
diff
changeset
|
16 |
|
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
|
17 |
import dbrutils |
206
2fd92922bf5c
DBRTools - initial version of cleanenv using new structure. Works ok apart from cleaning patches, which isn't in this version.
MattD <mattd@symbian.org>
parents:
203
diff
changeset
|
18 |
import dbrenv |
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
|
19 |
|
eab8a264a833
Pulled the DBRTools 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 re #temporary for dealing with patches |
213
6272bdcb6221
DBRTools - minor nasty hack to get cleanenv working better
MattD <mattd@symbian.org>
parents:
206
diff
changeset
|
21 |
import os |
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
|
22 |
|
206
2fd92922bf5c
DBRTools - initial version of cleanenv using new structure. Works ok apart from cleaning patches, which isn't in this version.
MattD <mattd@symbian.org>
parents:
203
diff
changeset
|
23 |
def run(args): |
2fd92922bf5c
DBRTools - initial version of cleanenv using new structure. Works ok apart from cleaning patches, which isn't in this version.
MattD <mattd@symbian.org>
parents:
203
diff
changeset
|
24 |
zippath = '/' |
2fd92922bf5c
DBRTools - initial version of cleanenv using new structure. Works ok apart from cleaning patches, which isn't in this version.
MattD <mattd@symbian.org>
parents:
203
diff
changeset
|
25 |
if(len(args)): |
2fd92922bf5c
DBRTools - initial version of cleanenv using new structure. Works ok apart from cleaning patches, which isn't in this version.
MattD <mattd@symbian.org>
parents:
203
diff
changeset
|
26 |
zippath = args[0] |
2fd92922bf5c
DBRTools - initial version of cleanenv using new structure. Works ok apart from cleaning patches, which isn't in this version.
MattD <mattd@symbian.org>
parents:
203
diff
changeset
|
27 |
#This block is a cut'n'paste from checkenv...we call call that instead... |
2fd92922bf5c
DBRTools - initial version of cleanenv using new structure. Works ok apart from cleaning patches, which isn't in this version.
MattD <mattd@symbian.org>
parents:
203
diff
changeset
|
28 |
|
2fd92922bf5c
DBRTools - initial version of cleanenv using new structure. Works ok apart from cleaning patches, which isn't in this version.
MattD <mattd@symbian.org>
parents:
203
diff
changeset
|
29 |
location = '/' |
2fd92922bf5c
DBRTools - initial version of cleanenv using new structure. Works ok apart from cleaning patches, which isn't in this version.
MattD <mattd@symbian.org>
parents:
203
diff
changeset
|
30 |
#needs a fix to scanenv for this to work... |
2fd92922bf5c
DBRTools - initial version of cleanenv using new structure. Works ok apart from cleaning patches, which isn't in this version.
MattD <mattd@symbian.org>
parents:
203
diff
changeset
|
31 |
# if(len(args)): |
2fd92922bf5c
DBRTools - initial version of cleanenv using new structure. Works ok apart from cleaning patches, which isn't in this version.
MattD <mattd@symbian.org>
parents:
203
diff
changeset
|
32 |
# location = args[0] |
2fd92922bf5c
DBRTools - initial version of cleanenv using new structure. Works ok apart from cleaning patches, which isn't in this version.
MattD <mattd@symbian.org>
parents:
203
diff
changeset
|
33 |
db = dbrenv.CreateDB(location) |
2fd92922bf5c
DBRTools - initial version of cleanenv using new structure. Works ok apart from cleaning patches, which isn't in this version.
MattD <mattd@symbian.org>
parents:
203
diff
changeset
|
34 |
local = dbrenv.DBRLocalEnv(location) |
2fd92922bf5c
DBRTools - initial version of cleanenv using new structure. Works ok apart from cleaning patches, which isn't in this version.
MattD <mattd@symbian.org>
parents:
203
diff
changeset
|
35 |
results = db.compare(local) |
2fd92922bf5c
DBRTools - initial version of cleanenv using new structure. Works ok apart from cleaning patches, which isn't in this version.
MattD <mattd@symbian.org>
parents:
203
diff
changeset
|
36 |
local.verify(results.unknown) |
2fd92922bf5c
DBRTools - initial version of cleanenv using new structure. Works ok apart from cleaning patches, which isn't in this version.
MattD <mattd@symbian.org>
parents:
203
diff
changeset
|
37 |
results2 = db.compare(local) |
2fd92922bf5c
DBRTools - initial version of cleanenv using new structure. Works ok apart from cleaning patches, which isn't in this version.
MattD <mattd@symbian.org>
parents:
203
diff
changeset
|
38 |
db.update(local, results2.touched) |
2fd92922bf5c
DBRTools - initial version of cleanenv using new structure. Works ok apart from cleaning patches, which isn't in this version.
MattD <mattd@symbian.org>
parents:
203
diff
changeset
|
39 |
#cleaning |
2fd92922bf5c
DBRTools - initial version of cleanenv using new structure. Works ok apart from cleaning patches, which isn't in this version.
MattD <mattd@symbian.org>
parents:
203
diff
changeset
|
40 |
dbrutils.deletefiles(sorted(results2.added)) |
2fd92922bf5c
DBRTools - initial version of cleanenv using new structure. Works ok apart from cleaning patches, which isn't in this version.
MattD <mattd@symbian.org>
parents:
203
diff
changeset
|
41 |
required = results2.changed | results2.removed |
2fd92922bf5c
DBRTools - initial version of cleanenv using new structure. Works ok apart from cleaning patches, which isn't in this version.
MattD <mattd@symbian.org>
parents:
203
diff
changeset
|
42 |
dbrutils.extractfiles(required, zippath) |
2fd92922bf5c
DBRTools - initial version of cleanenv using new structure. Works ok apart from cleaning patches, which isn't in this version.
MattD <mattd@symbian.org>
parents:
203
diff
changeset
|
43 |
#do something about the patches here... |
213
6272bdcb6221
DBRTools - minor nasty hack to get cleanenv working better
MattD <mattd@symbian.org>
parents:
206
diff
changeset
|
44 |
print 'Need to extract the patches in a nicer manner!!!' |
6272bdcb6221
DBRTools - minor nasty hack to get cleanenv working better
MattD <mattd@symbian.org>
parents:
206
diff
changeset
|
45 |
dbrutils.extractfiles(required, os.path.join(location,dbrutils.patch_path_internal())) |
6272bdcb6221
DBRTools - minor nasty hack to get cleanenv working better
MattD <mattd@symbian.org>
parents:
206
diff
changeset
|
46 |
|
206
2fd92922bf5c
DBRTools - initial version of cleanenv using new structure. Works ok apart from cleaning patches, which isn't in this version.
MattD <mattd@symbian.org>
parents:
203
diff
changeset
|
47 |
#scan again...create a new 'local' |
2fd92922bf5c
DBRTools - initial version of cleanenv using new structure. Works ok apart from cleaning patches, which isn't in this version.
MattD <mattd@symbian.org>
parents:
203
diff
changeset
|
48 |
local = dbrenv.DBRLocalEnv(location) |
2fd92922bf5c
DBRTools - initial version of cleanenv using new structure. Works ok apart from cleaning patches, which isn't in this version.
MattD <mattd@symbian.org>
parents:
203
diff
changeset
|
49 |
local.verify(required) |
2fd92922bf5c
DBRTools - initial version of cleanenv using new structure. Works ok apart from cleaning patches, which isn't in this version.
MattD <mattd@symbian.org>
parents:
203
diff
changeset
|
50 |
results3 = db.compare(local) |
2fd92922bf5c
DBRTools - initial version of cleanenv using new structure. Works ok apart from cleaning patches, which isn't in this version.
MattD <mattd@symbian.org>
parents:
203
diff
changeset
|
51 |
db.update(local, results3.touched) |
2fd92922bf5c
DBRTools - initial version of cleanenv using new structure. Works ok apart from cleaning patches, which isn't in this version.
MattD <mattd@symbian.org>
parents:
203
diff
changeset
|
52 |
db.save() |
2fd92922bf5c
DBRTools - initial version of cleanenv using new structure. Works ok apart from cleaning patches, which isn't in this version.
MattD <mattd@symbian.org>
parents:
203
diff
changeset
|
53 |
results3.printdetail() |
2fd92922bf5c
DBRTools - initial version of cleanenv using new structure. Works ok apart from cleaning patches, which isn't in this version.
MattD <mattd@symbian.org>
parents:
203
diff
changeset
|
54 |
results3.printsummary() |
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
|
55 |
|
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
|
56 |
|
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
|
57 |
|
eab8a264a833
Pulled the DBRTools 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 |
|
eab8a264a833
Pulled the DBRTools 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 |
def help(): |
eab8a264a833
Pulled the DBRTools from their own repo and popped them into this one. Still very much a 'work in progress'.
MattD <mattd@symbian.org>
parents:
diff
changeset
|
60 |
print "Cleans the current environment" |
eab8a264a833
Pulled the DBRTools 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 |
print "Usage\n\tdbr cleanenv (<baseline_zip_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
|
62 |
print "\nDefault behaviour presumes baselie zips exist at the root" |
283
398d483e91bb
Changed help so that summaries come from components. Added smoketest method to try to reduce regressions (when I write some tests). A few minor cleanups.
MattD <mattd@symbian.org>
parents:
213
diff
changeset
|
63 |
|
398d483e91bb
Changed help so that summaries come from components. Added smoketest method to try to reduce regressions (when I write some tests). A few minor cleanups.
MattD <mattd@symbian.org>
parents:
213
diff
changeset
|
64 |
def summary(): |
398d483e91bb
Changed help so that summaries come from components. Added smoketest method to try to reduce regressions (when I write some tests). A few minor cleanups.
MattD <mattd@symbian.org>
parents:
213
diff
changeset
|
65 |
return "Cleans the current environment" |