buildframework/helium/tools/preparation/password.ant.xml
changeset 628 7c4a911dc066
parent 217 0f5e3a7fb6af
child 645 b8d81fa19e7d
equal deleted inserted replaced
588:c7c26511138f 628:7c4a911dc066
   104         <hlm:logreplace regexp="${release.notes.password}" />
   104         <hlm:logreplace regexp="${release.notes.password}" />
   105     </target>
   105     </target>
   106 
   106 
   107     <!-- Retrieve the ccm password from the .netrc file and store it into ccm.password property. 
   107     <!-- Retrieve the ccm password from the .netrc file and store it into ccm.password property. 
   108     Requires ccm.enabled tobe set to 'true' to work.-->
   108     Requires ccm.enabled tobe set to 'true' to work.-->
   109     <target name="ccm-password" if="run.ccm">
   109     <target name="ccm-password" if="internal.ccm.enabled">
   110         <hlm:netrcPasswordMacro output-prop="ccm.password.rc" result-prop="ccm.password.available" type="synergy"/>
   110         <hlm:netrcPasswordMacro output-prop="ccm.password.rc" result-prop="ccm.password.available" type="synergy"/>
   111     </target>
   111     </target>
   112     
   112     
   113     <!-- Retrieve the ccm username from the .netrc file and store it into ccm.username property.
   113     <!-- Retrieve the ccm username from the .netrc file and store it into ccm.username property.
   114     Requires ccm.enabled tobe set to 'true' to work. -->
   114     Requires ccm.enabled tobe set to 'true' to work. -->
   115     <target name="ccm-username" if="run.ccm">
   115     <target name="ccm-username" if="internal.ccm.enabled">
   116         <hlm:netrcUsernameMacro output-prop="ccm.login.rc" result-prop="ccm.username.available" type="synergy"/>
   116         <hlm:netrcUsernameMacro output-prop="ccm.login.rc" result-prop="ccm.username.available" type="synergy"/>
   117     </target>
   117     </target>
   118     
   118     
   119     <!--
   119     <!--
   120         This target retreive user's login and password and tries to
   120         This target retreive user's login and password and tries to
   122         it sets the following properties:
   122         it sets the following properties:
   123          - ccm.user.login
   123          - ccm.user.login
   124          - ccm.user.password
   124          - ccm.user.password
   125         it requires ccm.database to be set to the wanted database and ccm.enabled to set to 'true'.
   125         it requires ccm.database to be set to the wanted database and ccm.enabled to set to 'true'.
   126     -->
   126     -->
   127     <target name="get-ccm-password" depends="ccm-password,ccm-username" unless="ccm.user.password">
   127     <target name="get-ccm-password" depends="ccm-password,ccm-username" unless="ccm.user.password" if="internal.ccm.enabled">
   128         <if>
   128         <hlm:filterRecordStartMacro pattern="${ccm.password.rc}" category="ccm"/>
   129             <isset property="run.ccm"/>
   129         <if>
   130             <then>
   130             <not>
   131                 <hlm:filterRecordStartMacro pattern="${ccm.password.rc}" category="ccm"/>
   131                 <and>
   132                 <if>
   132                     <isset property="ccm.login.rc"/>
   133                     <not>
   133                     <isset property="ccm.password.rc"/>
   134                         <and>
   134                 </and>
   135                             <isset property="ccm.login.rc"/>
   135             </not>
   136                             <isset property="ccm.password.rc"/>
   136             <then>
   137                         </and>
   137                 <if>              
   138                     </not>
   138                     <isset property="ccm.login.popup.disable"/> 
   139                     <then>
   139                     <then>
   140                         <if>              
   140                         <echo>Error: Unable to read synergy username and password from .netrc file.</echo>
   141                             <isset property="ccm.login.popup.disable"/> 
   141                         <property name="skip.password.validation" value="true"/>
   142                             <then>
   142                     </then> 
   143                                 <echo>Error: Unable to read synergy username and password from .netrc file.</echo>
       
   144                                 <property name="skip.password.validation" value="true"/>
       
   145                             </then> 
       
   146                             <else>
       
   147                                 <!-- Contains the user name for CCM by reading the information from .netrc file.
       
   148                                 @type string
       
   149                                 @scope private
       
   150                                 -->
       
   151                                 <property name="ccm.user.login" value="${env.USERNAME}"/>
       
   152                                 <antform title="Synergy login information">
       
   153                                     <label>Unable to read synergy username and password from h:\.netrc file.</label>
       
   154                                     <textProperty label="ccm login:" property="ccm.user.login"/>
       
   155                                     <textProperty label="ccm password:" property="ccm.user.password" password="true"/>
       
   156                                 </antform>
       
   157                                 <property name="ccm.password.available" value="1"/>
       
   158                                 <!-- Unix username.
       
   159                                 @type string
       
   160                                 @scope private
       
   161                                 -->
       
   162                                 <property name="unix.username" value="${env.USERNAME}"/>
       
   163                                 <!-- Unix password
       
   164                                 @type string
       
   165                                 @scope private
       
   166                                 -->
       
   167                                 <property name="unix.password" value="${ccm.user.password}"/>
       
   168                                 <!-- Equal 0 if the unix password if available
       
   169                                 @type string
       
   170                                 @scope private
       
   171                                 -->
       
   172                                 <property name="unix.password.available" value="1"/>
       
   173                             </else> 
       
   174                         </if>
       
   175                     </then>
       
   176                     <else>
   143                     <else>
   177                         <!-- Contains the user name for CCM by reading the information from .netrc file.
   144                         <!-- Contains the user name for CCM by reading the information from .netrc file.
   178                         @type string
   145                         @type string
   179                         @scope private
   146                         @scope private
   180                         -->
   147                         -->
   181                         <property name="ccm.user.login" value="${ccm.login.rc}"/>
   148                         <property name="ccm.user.login" value="${env.USERNAME}"/>
   182                         <!-- Contains the password for CCM user name by reading the information from .netrc file.
   149                         <antform title="Synergy login information">
   183                         @type string
   150                             <label>Unable to read synergy username and password from h:\.netrc file.</label>
   184                         @scope private
   151                             <textProperty label="ccm login:" property="ccm.user.login"/>
   185                         -->
   152                             <textProperty label="ccm password:" property="ccm.user.password" password="true"/>
   186                         <property name="ccm.user.password" value="${ccm.password.rc}"/>
   153                         </antform>
   187                     </else>
   154                         <property name="ccm.password.available" value="1"/>
       
   155                         <!-- Unix username.
       
   156                         @type string
       
   157                         @scope private
       
   158                         -->
       
   159                         <property name="unix.username" value="${env.USERNAME}"/>
       
   160                         <!-- Unix password
       
   161                         @type string
       
   162                         @scope private
       
   163                         -->
       
   164                         <property name="unix.password" value="${ccm.user.password}"/>
       
   165                         <!-- Equal 0 if the unix password if available
       
   166                         @type string
       
   167                         @scope private
       
   168                         -->
       
   169                         <property name="unix.password.available" value="1"/>
       
   170                     </else> 
   188                 </if>
   171                 </if>
   189                 <antcall target="ccm-check"/>
   172             </then>
   190                 <hlm:filterRecordStopMacro/>
   173             <else>
   191             </then>
   174                 <!-- Contains the user name for CCM by reading the information from .netrc file.
   192             <!--echo> ccm not enabled so not get password</echo-->
   175                 @type string
   193         </if>
   176                 @scope private
       
   177                 -->
       
   178                 <property name="ccm.user.login" value="${ccm.login.rc}"/>
       
   179                 <!-- Contains the password for CCM user name by reading the information from .netrc file.
       
   180                 @type string
       
   181                 @scope private
       
   182                 -->
       
   183                 <property name="ccm.user.password" value="${ccm.password.rc}"/>
       
   184             </else>
       
   185         </if>
       
   186         <antcall target="ccm-check"/>
       
   187         <hlm:filterRecordStopMacro/>
   194     </target>
   188     </target>
   195     
   189     
   196     <!-- check synergy is available needs ccm.enabled to be set to 'true' as well.-->
   190     <!-- check synergy is available needs ccm.enabled to be set to 'true' as well.-->
   197     <target name="ccm-check" unless="skip.password.validation">
   191     <target name="ccm-check" unless="skip.password.validation" if="internal.ccm.enabled">
   198         <if>
   192         <hlm:ccmAvailableMacro resultproperty="ccm.session.created"/>
   199             <isset property="run.ccm"/>
   193         <echo>ccm.session.created = ${ccm.session.created}</echo>
   200             <then>
   194         <if>
   201                 <hlm:ccmAvailableMacro resultproperty="ccm.session.created"/>
   195             <equals arg1="${ccm.session.created}" arg2="-1"/>
   202                 <echo>ccm.session.created = ${ccm.session.created}</echo>
   196             <then>
   203                 <if>
   197                 <fail message="Unable to create CCM session."/>
   204                     <equals arg1="${ccm.session.created}" arg2="-1"/>
   198             </then>
   205                     <then>
   199         </if>
   206                         <fail message="Unable to create CCM session."/>
   200         <if>
   207                     </then>
   201             <equals arg1="${ccm.session.created}" arg2="-2"/>
   208                 </if>
   202             <then>
   209                 <if>
   203                 <fail message="Access Denied for user."/>
   210                     <equals arg1="${ccm.session.created}" arg2="-2"/>
   204             </then>
   211                     <then>
   205         </if>
   212                         <fail message="Access Denied for user."/>
   206     </target>
   213                     </then>
       
   214                 </if>
       
   215             </then>
       
   216         </if>
       
   217     </target>
       
   218     
       
   219 </project>
   207 </project>