Skip to content

Commit

Permalink
Add check for jck update (#2079)
Browse files Browse the repository at this point in the history
* Add Check for JCK update
  • Loading branch information
Mesbah-Alam authored Dec 2, 2020
1 parent e8699a5 commit fbb0896
Showing 1 changed file with 64 additions and 21 deletions.
85 changes: 64 additions & 21 deletions jck/build.xml
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,33 @@
</condition>
<target name="stage_jck_material">
<!-- Starting downloading or updating JCK materials based on JCK GIT REPO and JCK VERSION-->
<if>
<available file="${JCK_ROOT_USED}" type="dir" />
<then>
<!--Obtain local and remote SHA to figure out if local materials are up-to-date-->
<exec executable="git" dir="${JCK_ROOT_USED}" outputproperty="localSHA">
<arg line="rev-parse"/>
<arg line="HEAD"/>
</exec>
<exec executable="git" dir="${JCK_ROOT_USED}" outputproperty="remoteSHA">
<arg line="ls-remote"/>
<arg line="${JCK_GIT_REPO_USED}"/>
<arg line="${jck_branch}"/>
</exec>
<loadresource property="localSHATrimmed">
<propertyresource name="localSHA"/>
<filterchain>
<tokenfilter>
<trim/>
</tokenfilter>
<striplinebreaks/>
</filterchain>
</loadresource>
<condition property="local-material-uptodate">
<contains string="${remoteSHA}" substring="${localSHATrimmed}" />
</condition>
</then>
</if>
<if>
<not>
<available file="${JCK_ROOT_USED}" type="dir" />
Expand Down Expand Up @@ -84,34 +111,50 @@
<arg value="--force" />
<arg value="--quiet" />
</exec>
<echo message="Updating ${JCK_ROOT_USED} with latest..." />
<exec executable="git" dir="${JCK_ROOT_USED}" failonerror="true">
<arg value="pull" />
</exec>
<if>
<isset property="local-material-uptodate" />
<then>
<echo message="Local JCK materials up-to-date. Skipping update"/>
</then>
<else>
<echo message="Updating ${JCK_ROOT_USED} with latest..." />
<exec executable="git" dir="${JCK_ROOT_USED}" failonerror="true">
<arg value="pull" />
</exec>
</else>
</if>
</else>
</if>
</else>
</if>
<if>
<isset property="isZOS" />
<then>
<echo message="Performing hard reset of ${JCK_ROOT_USED} using .gitattributes.zos for file conversions..."/>
<delete includeemptydirs="true" failonerror="false">
<fileset dir="${JCK_ROOT_USED}/.git/info" includes="**/*"/>
</delete>
<mkdir dir="${JCK_ROOT_USED}/.git/info" />
<move file="${JCK_ROOT_USED}/.gitattributes.zos" tofile="${JCK_ROOT_USED}/.git/info/attributes" />
<exec executable="git" dir="${JCK_ROOT_USED}" failonerror="false">
<arg value="rm" />
<arg value="--cached" />
<arg value="-r" />
<arg value="-q" />
<arg value="." />
</exec>
<exec executable="git" dir="${JCK_ROOT_USED}" failonerror="false">
<arg value="reset" />
<arg value="--hard" />
</exec>
<if>
<isset property="local-material-uptodate"/>
<then>
<echo message="Local JCK materials up-to-date. Skipping hard reset"/>
</then>
<else>
<echo message="Performing hard reset of ${JCK_ROOT_USED} using .gitattributes.zos for file conversions..."/>
<delete includeemptydirs="true" failonerror="false">
<fileset dir="${JCK_ROOT_USED}/.git/info" includes="**/*"/>
</delete>
<mkdir dir="${JCK_ROOT_USED}/.git/info" />
<move file="${JCK_ROOT_USED}/.gitattributes.zos" tofile="${JCK_ROOT_USED}/.git/info/attributes" />
<exec executable="git" dir="${JCK_ROOT_USED}" failonerror="false">
<arg value="rm" />
<arg value="--cached" />
<arg value="-r" />
<arg value="-q" />
<arg value="." />
</exec>
<exec executable="git" dir="${JCK_ROOT_USED}" failonerror="false">
<arg value="reset" />
<arg value="--hard" />
</exec>
</else>
</if>
</then>
</if>
<!--Make all .sh files below ${JCK_ROOT_USED} readable and executable for anyone on a UNIX system.
Expand Down

0 comments on commit fbb0896

Please sign in to comment.