buildframework/helium/tools/common/python/lib/sis.py
changeset 1 be27ed110b50
child 179 d8ac696cc51f
equal deleted inserted replaced
0:044383f39525 1:be27ed110b50
       
     1 #============================================================================ 
       
     2 #Name        : sis.py 
       
     3 #Part of     : Helium 
       
     4 
       
     5 #Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
       
     6 #All rights reserved.
       
     7 #This component and the accompanying materials are made available
       
     8 #under the terms of the License "Eclipse Public License v1.0"
       
     9 #which accompanies this distribution, and is available
       
    10 #at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
    11 #
       
    12 #Initial Contributors:
       
    13 #Nokia Corporation - initial contribution.
       
    14 #
       
    15 #Contributors:
       
    16 #
       
    17 #Description:
       
    18 #===============================================================================
       
    19 
       
    20 import os
       
    21 
       
    22 import configuration
       
    23 import buildtools
       
    24 
       
    25 
       
    26 class SisPreBuilder(buildtools.PreBuilder):
       
    27     """"""
       
    28     def __init__(self, config):
       
    29         buildtools.PreBuilder.__init__(self, config)
       
    30 
       
    31     def write(self, buildFilePath):
       
    32         sisConfigs = self.configSet.getConfigurations()
       
    33         commandList = buildtools.CommandList()
       
    34         for config in sisConfigs:
       
    35             sis_filename = config['name'] + '.sis'
       
    36             if config.get('sis.name', None) != None:
       
    37                 sis_filename = config['sis.name'] + '.sis'
       
    38             makeSisArgs = ['-v', config['name'] + '.pkg', sis_filename]
       
    39             makeSisCommand = buildtools.Command(config['makesis.tool'], config['path'], makeSisArgs)
       
    40             commandList.addCommand(makeSisCommand)
       
    41             
       
    42             if config.get_boolean('publish.unsigned', False):
       
    43                 # This is hardcoded xcopy operation that should be replaced by a more generic
       
    44                 # definition of tasks that can be created in build files
       
    45                 srcFile = os.path.join(config['path'], sis_filename)
       
    46                 todir = config['build.sisfiles.dir']
       
    47                 copyCommand = buildtools.Copy(srcFile, todir)
       
    48                 commandList.addCommand(copyCommand, newstage=True)
       
    49 
       
    50             sisx_filename = sis_filename + 'x'
       
    51             signSisArgs = ['-v', sis_filename, sisx_filename, config['cert'], config['key']]
       
    52             signSisCommand = buildtools.Command(config['signsis.tool'], config['path'], signSisArgs)
       
    53             commandList.addCommand(signSisCommand, newstage=True)
       
    54 
       
    55             # This is hardcoded xcopy operation that should be replaced by a more generic
       
    56             # definition of tasks that can be created in build files
       
    57             srcFile = os.path.join(config['path'], sisx_filename)
       
    58             todir = config['build.sisfiles.dir']
       
    59             copyCommand = buildtools.Copy(srcFile, todir)
       
    60             commandList.addCommand(copyCommand, newstage=True)
       
    61 
       
    62         self.writeBuildFile(commandList, buildFilePath)