dbrtools/dbr/checkenv.py
changeset 203 e274d29c8bc9
parent 200 12422144aae1
child 205 213f75c7878c
equal deleted inserted replaced
202:f6ae410bd493 203:e274d29c8bc9
     1 # Copyright (c) 2009 Symbian Foundation Ltd
     1 # Copyright (c) 2010 Symbian Foundation Ltd
     2 # This component and the accompanying materials are made available
     2 # This component and the accompanying materials are made available
     3 # under the terms of the License "Eclipse Public License v1.0"
     3 # under the terms of the License "Eclipse Public License v1.0"
     4 # which accompanies this distribution, and is available
     4 # which accompanies this distribution, and is available
     5 # at the URL "http://www.eclipse.org/legal/epl-v10.html".
     5 # at the URL "http://www.eclipse.org/legal/epl-v10.html".
     6 #
     6 #
     9 #
     9 #
    10 # Contributors:
    10 # Contributors:
    11 # mattd <mattd@symbian.org>
    11 # mattd <mattd@symbian.org>
    12 #
    12 #
    13 # Description:
    13 # Description:
    14 # DBR checkenv - Checks your environment against what was installed
    14 # new checkenv - uses OO interface.
    15 
    15 
    16 import dbrbaseline
    16 import dbrenv
    17 import dbrpatch
       
    18 import dbrutils
       
    19 
    17 
    20 import os.path
    18 def run(args):
       
    19   location = '/'
       
    20 #needs a fix to scanenv for this to work...  
       
    21 #  if(len(args)):
       
    22 #    location = args[0]
       
    23   db = dbrenv.CreateDB(location)
       
    24   local = dbrenv.DBRLocalEnv(location)
       
    25   results = db.compare(local)
       
    26   local.verify(results.unknown)
       
    27   results2 = db.compare(local)hg diff -U 
       
    28   results2.printdetail()
       
    29   results2.printsummary()
       
    30   db.update(local, results2.touched)
       
    31   db.save()
       
    32     
       
    33 def help():
       
    34   print "Checks the status of the current environment"
       
    35   print "Usage:"
       
    36   print "\tdbr checkenv"
       
    37     
       
    38   
    21 
    39 
    22 def main():
       
    23     dbfilename = dbrutils.defaultdb()
       
    24 
       
    25     baseline = dbrbaseline.readdb(dbfilename)
       
    26     if(len(baseline ) > 0):
       
    27         patches = dbrpatch.loadpatches(dbrpatch.dbrutils.patchpath())
       
    28         db = dbrpatch.createpatchedbaseline(baseline,patches)
       
    29         env = dbrutils.scanenv()
       
    30         dbrpatch.newupdatedb(db,env)
       
    31         baseline = dbrpatch.updatebaseline(baseline, db)
       
    32         patches = dbrpatch.updatepatches(patches, db)
       
    33 
       
    34         dbrpatch.savepatches(patches)        
       
    35     else:
       
    36         baseline = dbrbaseline.createdb()
       
    37     dbrbaseline.writedb(baseline,dbfilename)
       
    38 
       
    39 
       
    40 def run(args):  
       
    41   main()
       
    42 
       
    43 def help():
       
    44   print "Shows the current state of the environment"
       
    45   print "Usage\n\tdbr checkenv"