<project name="QA-to-Prod" default="scripts" basedir=".">
<property name="dir.qa" value="./QA"/> <property name="dir.prod" value="./PROD"/>
<target name="scripts"> <copy todir="${dir.prod}"> <fileset dir="${dir.qa}"> <include name="**/dist/Scripts/*"/> </fileset> <mapper type="regexp" from="(?:.*[/\\])*([1-9][0-9]?\.[0-9][0-9]\.[0-9][0-9])(?:-)([0-9][0-9])([/\\].*[/\\])+(.*)" to="\1\3\2-\4" /> </copy> </target> </project>
At 04:24 PM 9/9/2003, you wrote:
Does anyone have any suggestions for converting the following bash script to an equivalent set of ANT Targets?
The basic idea is to take a path of the form
./QA/3.04.10-01/dist/Scripts/zz-Post-Install.sql
and turn it into
./PROD/3.04.10/dist/Scripts/01-zz-Post-Install.sql
I'm heading down the path of a <copy> with a regexp mapper. Are there better alternatives?
Thanks!
Ken
#/usr/bin/bash # # Current directory should contain two directory structures: # QA/ # 3.04.10-01 # 3.04.10-02 # 3.04.10-03 # . # . # . # 3.04.10-99 # PROD/ # 3.04.10 # #
# Release Id is of the form 3.04.10 (Major/Minor/Patch) RELEASE_ID=${1} # if [ "" = "${RELEASE_ID}" ] then echo No release number specified. exit 1 fi # QA Releases are identified by the Release Id followed by a hyphen and the # build number: 3.04.10-01 # # PROD Releases are identified by the Release Id only. # # We want to move the scripts from each QA Release, in order, to the PROD # tree, prefixing each script with its build number. For Example # # QA/3.04.10-01/dist/Scripts/zz-Post-Install.sql # QA/3.04.10-02/dist/Scripts/zz-Post-Install.sql # # becomes # # PROD/3.04.10/dist/Scripts/01-zz-Post-Install.sql # PROD/3.04.10/dist/Scripts/02-zz-Post-Install.sql # for REL in QA/${RELEASE_ID}-?? do # Start with QA/3.04.10-01 t=${REL%*-[0-9][0-9]} # Get everything but build: QA/3.04.10 QA_NUM=${REL#${t}-} # Get the build number: 01 echo $REL - QA Release $QA_NUM echo Release Directory is $REL for SCR in ${REL}/dist/Scripts/* do FNAME=$(basename "${SCR}") if [ "${FNAME}" != "vssver.scc" ] then cp "${SCR}" "PROD/${RELEASE_ID}/dist/Scripts/${QA_NUM}-${FNAME}" fi done done
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]