buildframework/helium/tools/preparation/password.ant.xml
changeset 1 be27ed110b50
child 179 d8ac696cc51f
equal deleted inserted replaced
0:044383f39525 1:be27ed110b50
       
     1 <?xml version="1.0" encoding="UTF-8"?>
       
     2 <!-- 
       
     3 ============================================================================ 
       
     4 Name        : password.ant.xml 
       
     5 Part of     : Helium 
       
     6 
       
     7 Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
       
     8 All rights reserved.
       
     9 This component and the accompanying materials are made available
       
    10 under the terms of the License "Eclipse Public License v1.0"
       
    11 which accompanies this distribution, and is available
       
    12 at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
    13 
       
    14 Initial Contributors:
       
    15 Nokia Corporation - initial contribution.
       
    16 
       
    17 Contributors:
       
    18 
       
    19 Description:
       
    20 
       
    21 ============================================================================
       
    22 -->
       
    23 <project name="password" xmlns:hlm="http://www.nokia.com/helium">
       
    24     <description>
       
    25     Password retrieval targets
       
    26     </description>
       
    27 
       
    28     <!-- Retrieve the ATS password from the .netrc file and store it into ats.password property. -->
       
    29     <target name="ats-password">
       
    30         <hlm:netrcPasswordMacro output-prop="ats.password" result-prop="ats.password.available" type="ats"/>
       
    31     </target>
       
    32     
       
    33     <!-- Retrieve the ATS username from the .netrc file and store it into ats.username property. -->
       
    34     <target name="ats-username">
       
    35         <hlm:netrcUsernameMacro output-prop="ats.username" result-prop="ats.username.available" type="ats"/>
       
    36     </target>
       
    37 
       
    38     <!-- Retrieve the unix password from the .netrc file and store it into unix.password property. -->
       
    39     <target name="unix-password">
       
    40         <hlm:netrcPasswordMacro output-prop="unix.password" result-prop="unix.password.available" type="synergy"/>
       
    41     </target>
       
    42     
       
    43     <!-- Retrieve the unix username from the .netrc file and store it into unix.username property. -->
       
    44     <target name="unix-username">
       
    45         <hlm:netrcUsernameMacro output-prop="unix.username" result-prop="unix.username.available" type="synergy"/>
       
    46     </target>
       
    47     
       
    48     <!-- Ask for unix login using UI. -->
       
    49     <target name="get-unix-password" depends="unix-username,unix-password">
       
    50         <hlm:filterRecordStartMacro/>
       
    51         <if>
       
    52             <not>
       
    53                 <equals arg1="${unix.password.available}" arg2="0"/>
       
    54             </not>
       
    55             <then>
       
    56                 <property name="unix.username" value="${env.USERNAME}"/>
       
    57                 <antform title="User login information">
       
    58                     <textProperty label="UNIX login:" property="unix.username"/>
       
    59                     <textProperty label="UNIX password:" property="unix.password" password="true"/>
       
    60                 </antform>
       
    61                 <property name="unix.password.available" value="1"/>
       
    62             </then>
       
    63         </if>
       
    64         <hlm:filterRecordStopMacro pattern="${unix.password}"/>
       
    65     </target>
       
    66     
       
    67     <!-- Retrieve the GRACE password from the .netrc file and store it into release.grace.password property. -->
       
    68     <target name="grace-password" if="release.grace">
       
    69         <hlm:netrcPasswordMacro output-prop="release.grace.password" result-prop="grace.password.available" type="grace"/>
       
    70     </target>
       
    71     
       
    72     <!-- Retrieve the NOE password from the .netrc file and store it into noe.password property. -->
       
    73     <target name="noe-password">
       
    74         <hlm:netrcPasswordMacro output-prop="noe.password" result-prop="noe.password.available" type="noe"/>
       
    75         <if>
       
    76             <not>
       
    77                 <isset property="noe.password"/>
       
    78             </not>
       
    79             <then>
       
    80                 <antform title="NOE login information">
       
    81                     <label>Unable to read NOE password from h:\.netrc file.</label>
       
    82                     <textProperty label="NOE password:" property="noe.password" password="true"/>
       
    83                 </antform>
       
    84             </then>
       
    85         </if>
       
    86     </target>
       
    87     
       
    88     <!-- Retrieve the notes password from the .netrc file and store it into notes.password property. -->    
       
    89     <target name="notes-password">
       
    90         <hlm:netrcPasswordMacro output-prop="release.notes.password" result-prop="notes.password.available" type="notes"/>
       
    91     </target>
       
    92 
       
    93     <!-- Retrieve the ccm password from the .netrc file and store it into ccm.password property. 
       
    94     Requires ccm.enabled tobe set to 'true' to work.-->
       
    95     <target name="ccm-password">
       
    96         <if>
       
    97             <isset property="run.ccm"/>
       
    98             <then>
       
    99                 <hlm:netrcPasswordMacro output-prop="ccm.password.rc" result-prop="ccm.password.available" type="synergy"/>
       
   100             </then>
       
   101         </if>
       
   102     </target>
       
   103     
       
   104     <!-- Retrieve the ccm username from the .netrc file and store it into ccm.username property.
       
   105     Requires ccm.enabled tobe set to 'true' to work. -->
       
   106     <target name="ccm-username">
       
   107         <if>
       
   108             <isset property="run.ccm"/>
       
   109             <then>
       
   110                 <hlm:netrcUsernameMacro output-prop="ccm.login.rc" result-prop="ccm.username.available" type="synergy"/>
       
   111             </then>
       
   112         </if>
       
   113     </target>
       
   114     
       
   115     <!--
       
   116         This target retreive user's login and password and tries to
       
   117         open a synergy session. if it fails it leaves ant
       
   118         it sets the following properties:
       
   119          - ccm.user.login
       
   120          - ccm.user.password
       
   121         it requires ccm.database to be set to the wanted database and ccm.enabled to set to 'true'.
       
   122     -->
       
   123     <target name="get-ccm-password" depends="ccm-password,ccm-username" unless="ccm.user.password">
       
   124         <if>
       
   125             <isset property="run.ccm"/>
       
   126             <then>
       
   127                 <hlm:filterRecordStartMacro/>
       
   128                 <if>
       
   129                     <not>
       
   130                         <and>
       
   131                             <isset property="ccm.login.rc"/>
       
   132                             <isset property="ccm.password.rc"/>
       
   133                         </and>
       
   134                     </not>
       
   135                     <then>
       
   136                         <if>              
       
   137                             <isset property="ccm.login.popup.disable"/> 
       
   138                             <then>
       
   139                                 <echo>Error: Unable to read synergy username and password from .netrc file.</echo>
       
   140                                 <property name="skip.password.validation" value="true"/>
       
   141                             </then> 
       
   142                             <else>
       
   143                                 <property name="ccm.user.login" value="${env.USERNAME}"/>
       
   144                                 <antform title="Synergy login information">
       
   145                                     <label>Unable to read synergy username and password from h:\.netrc file.</label>
       
   146                                     <textProperty label="ccm login:" property="ccm.user.login"/>
       
   147                                     <textProperty label="ccm password:" property="ccm.user.password" password="true"/>
       
   148                                 </antform>
       
   149                                 <property name="ccm.password.available" value="1"/>
       
   150                                 <property name="unix.username" value="${env.USERNAME}"/>
       
   151                                 <property name="unix.password" value="${ccm.user.password}"/>
       
   152                                 <property name="unix.password.available" value="1"/>
       
   153                             </else> 
       
   154                         </if>
       
   155                     </then>
       
   156                     <else>
       
   157                         <property name="ccm.user.login" value="${ccm.login.rc}"/>
       
   158                         <property name="ccm.user.password" value="${ccm.password.rc}"/>
       
   159                     </else>
       
   160                 </if>
       
   161         
       
   162                 <antcall target="ccm-check"/>
       
   163                 <hlm:filterRecordStopMacro pattern="${ccm.user.password}"/>
       
   164             </then>
       
   165             <!--echo> ccm not enabled so not get password</echo-->
       
   166         </if>
       
   167     </target>
       
   168     
       
   169     <!-- check synergy is available needs ccm.enabled to be set to 'true' as well.-->
       
   170     <target name="ccm-check" unless="skip.password.validation">
       
   171         <if>
       
   172             <isset property="run.ccm"/>
       
   173             <then>
       
   174                 <hlm:ccmAvailableMacro resultproperty="ccm.session.created"/>
       
   175                 <echo>ccm.session.created = ${ccm.session.created}</echo>
       
   176                 <if>
       
   177                     <equals arg1="${ccm.session.created}" arg2="-1"/>
       
   178                     <then>
       
   179                         <fail message="Unable to create CCM session."/>
       
   180                     </then>
       
   181                 </if>
       
   182                 <if>
       
   183                     <equals arg1="${ccm.session.created}" arg2="-2"/>
       
   184                     <then>
       
   185                         <fail message="Access Denied for user."/>
       
   186                     </then>
       
   187                 </if>
       
   188             </then>
       
   189         </if>
       
   190     </target>
       
   191     
       
   192 </project>