dbrtools/dbr/createpatch.py
changeset 178 eab8a264a833
equal deleted inserted replaced
176:6d3c3db11e72 178: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 createpatch - Creates a patch of the changes made to a patched baseline
       
    15 
       
    16 import sys
       
    17 import dbrbaseline
       
    18 import dbrpatch
       
    19 import dbrutils
       
    20 
       
    21 def run(args):
       
    22     if(len(args)):
       
    23       dbfilename = dbrutils.defaultdb()
       
    24       patchname = args[0]
       
    25       if(patchname):
       
    26           print 'Creating Patch:%s\n' % patchname
       
    27           baseline = dbrbaseline.readdb(dbfilename)
       
    28           if(len(baseline) > 0):
       
    29               patches = dbrpatch.loadpatches(dbrpatch.dbrutils.patchpath())
       
    30               db = dbrpatch.createpatchedbaseline(baseline,patches)
       
    31               env = dbrutils.scanenv()
       
    32               db = dbrpatch.newcreatepatch(patchname,db,env)
       
    33               baseline = dbrpatch.updatebaseline(baseline, db)
       
    34               patches = dbrpatch.updatepatches(patches, db)
       
    35               dbrpatch.savepatches(patches)
       
    36               dbrbaseline.writedb(baseline,dbfilename)
       
    37       else:
       
    38           help()
       
    39     else:
       
    40       help()
       
    41       
       
    42 def help():
       
    43   print 'usage: Createpatch <patchname>'
       
    44         
       
    45