dbrtools/dbr/checkenv.py
changeset 179 eab8a264a833
child 200 12422144aae1
equal deleted inserted replaced
177:6d3c3db11e72 179:eab8a264a833
       
     1 # Copyright (c) 2009 Symbian Foundation Ltd
       
     2 # This component and the accompanying materials are made available
       
     3 # under the terms of the License "Eclipse Public License v1.0"
       
     4 # which accompanies this distribution, and is available
       
     5 # at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     6 #
       
     7 # Initial Contributors:
       
     8 # Symbian Foundation Ltd - initial contribution.
       
     9 #
       
    10 # Contributors:
       
    11 # mattd <mattd@symbian.org>
       
    12 #
       
    13 # Description:
       
    14 # DBR checkenv - Checks your environment against what was installed
       
    15 
       
    16 import dbrbaseline
       
    17 import dbrpatch
       
    18 import dbrutils
       
    19 import glob
       
    20 
       
    21 import os.path
       
    22 
       
    23 def main():
       
    24     dbfilename = dbrutils.defaultdb()
       
    25 
       
    26     baseline = dbrbaseline.readdb(dbfilename)
       
    27     if(len(baseline ) > 0):
       
    28         patches = dbrpatch.loadpatches(dbrpatch.dbrutils.patchpath())
       
    29         db = dbrpatch.createpatchedbaseline(baseline,patches)
       
    30         env = dbrutils.scanenv()
       
    31         dbrpatch.newupdatedb(db,env)
       
    32         baseline = dbrpatch.updatebaseline(baseline, db)
       
    33         patches = dbrpatch.updatepatches(patches, db)
       
    34 
       
    35         dbrpatch.savepatches(patches)        
       
    36     else:
       
    37         baseline = createdb()
       
    38     dbrbaseline.writedb(baseline,dbfilename)
       
    39 
       
    40 def createdb():
       
    41     print 'creating db...Move CreateDB into dbrutils!!!'
       
    42     env = dbrutils.scanenv()
       
    43     hashes = glob.glob(os.path.join(dbrutils.patchpath(),'*.md5'))
       
    44     for file in hashes:
       
    45         print 'Reading: %s\n' % file
       
    46         dbrutils.gethashes(env, file)
       
    47     return env
       
    48 
       
    49 def run(args):  
       
    50   main()
       
    51 
       
    52 def help():
       
    53   print "Shows the current state of the environment"
       
    54   print "Usage\n\tdbr checkenv"