buildframework/helium/tools/preparation/synergy/ccmgetinput.ant.xml
author timothy.murphy@nokia.com
Sun, 06 Dec 2009 18:26:19 +0000
branchwip
changeset 88 b5820d0f3a1c
parent 1 be27ed110b50
child 179 d8ac696cc51f
permissions -rw-r--r--
Fix errors with parsing exit codes in status tags

<?xml version="1.0" encoding="UTF-8"?>
<!-- 
============================================================================ 
Name        : ccmgetinput.ant.xml 
Part of     : Helium 

Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
All rights reserved.
This component and the accompanying materials are made available
under the terms of the License "Eclipse Public License v1.0"
which accompanies this distribution, and is available
at the URL "http://www.eclipse.org/legal/epl-v10.html".

Initial Contributors:
Nokia Corporation - initial contribution.

Contributors:

Description:

============================================================================
-->
<project name="ccmgetinput" xmlns:hlm="http://www.nokia.com/helium">
    <description>
      Retrieves content from Synergy
    </description>

    <hlm:logfilterset id="prepWorkArea.logextract.config">
        <logfilter category="error" regex="^ERROR:" />
        <logfilter category="warning" regex="^WARNING:" />
        <logfilter category="info" regex="^INFO:" />
    </hlm:logfilterset>

    
    <!-- This target uses an XML input file to retrieve content from Synergy.
      -->
    <target name="prep-work-area" depends="log-build-start" if="run.ccm">
        <hlm:tempRecordStartMacro name="${build.id}_ccm_get_input.log" />
        <runtarget target="get-ccm-password"/>
        <runtarget target="ccm-prepare-input"/>
        
        <hlm:assertPropertySet property="prep.delivery.file" message="Property prep.delivery.file is not defined." />
        <trycatch>
            <try>
                <hlm:python failonerror="true">
import preparation
import configuration
import traceback
import logging            
import ant
import sys
import os.path

# enabling logging
logging.basicConfig(level=logging.INFO)

builder = None           
try:
    configBuilder = configuration.NestedConfigurationBuilder(open(ant.get_property(r'${prep.delivery.conf.parsed}'), 'r'))
    configSet = configBuilder.getConfiguration()
    builder = preparation.PreparationBuilder(configSet.getConfigurations(), ant.get_property(r'${ccm.user.login}'), ant.get_property(r'${ccm.user.password}'), cache=ant.get_property(r'${ccm.cache.xml}'))
    builder.check()
    builder.get_content()
    builder.close()
except Exception, e:
    print "ERROR: error found during preparation phase:" 
    for l in traceback.format_exc().splitlines(False):
        print "ERROR: %s" % l         
    print "ERROR: this is a critical error, build will fail now:"
    for l in str(e).splitlines(False):
        print "ERROR: %s" % l         
    if builder != None:
        builder.close()
    sys.exit(-1)
sys.exit(0)
                </hlm:python>
            </try>
            <finally>
                <hlm:tempRecordStopMacro name="${build.id}_ccm_get_input.log" filterref="filterset.prepWorkArea"/>
                <hlm:assertFileExists file="${build.cache.log.dir}/${build.id}_ccm_get_input.log" />
            </finally>
        </trycatch>
    </target>

    <!--
        This target uses an XML input file to retrieve content from Synergy.
        <deprecated>Please use prep-work-area</deprecated>
    -->
    <target name="ccm-get-input" depends="prep-work-area" />

</project>