?
Solved

Filterset begintoken

Posted on 2009-12-22
6
Medium Priority
?
876 Views
Last Modified: 2013-11-10
I am trying to use filterset. I have managed to do it in one way but when I try to do it in a diffent way it wont work. It has to do with that the filterset cant be empty. How can I make this work?

So this is the situations.
1. Hudson builds with build.xml file
2. Hudson puts in all info from version.template to version.properties (this works fine)
3. sync_to_clearcase.xml is running but it wont change the label gal.version.hudson.clearcase.tag=No tag. No sync yet.

So this is where it goes wrong
<filterset begintoken="No tag" endtoken="yet.">

What should I write so it finds the NO tag. No sync yet and exchange it?
build.xml
---------------------------------
<target name="compile_after_ext">
	        <echo>Substituting values in version.properties</echo>
	            <tstamp>
	                <format property="build_tstamp" pattern="yyyy-MM-dd,HH:mm:ss" />
	            </tstamp>

	        <property environment="env" />
	        <property name="env.JOB_NAME" value="Not built from Hudson" />
	        <property name="env.BUILD_ID" value="Not built from Hudson - ${build_tstamp}" />
	        <property name="env.BUILD_TAG" value="Not built from Hudson - no tag" />
	        <property name="env.SVN_BRANCH" value="SVN_BRANCH was not specified" />
	        <property name="env.BUILD_NUMBER" value="Not built from Hudson - ${build_tstamp}" />
	        <property name="env.HUDSON_BUILD" value="Not built from Hudson" />
	        <property name="env.CLEARCASE_TAG" value="Not built from Hudson" /> 
	        <property name="env.VERSION_TAG" value="1.0.0.0" /> 

	        <copy file="resources/version/version.properties.template" toFile="resources/version/version.properties" overwrite="true" >
	            <filterset begintoken="$${" endtoken="}">
	                <filter token="hudson.job.name" value="${env.JOB_NAME}"/>
	                <filter token="hudson.build.id" value="${env.BUILD_ID}"/>
	                <filter token="hudson.build.tag" value="${env.BUILD_TAG}"/>
	                <filter token="hudson.svn.branch" value="${env.SVN_BRANCH}"/>
	                <filter token="hudson.build.number" value="${env.BUILD_NUMBER}"/>
	                <filter token="hudson.subversion.tag" value="trunk-V2-${env.BUILD_NUMBER}-${env.BUILD_ID}"/>    
	                <filter token="hudson.clearcase.tag" value="No tag. No sync yet."/>   
	                <filter token="hudson.version.tag" value="1.0.0.0"/>           
	            </filterset>
	        </copy>
	    </target>


version.template
------------------------------------
gal.version.id=${hudson.build.id}
gal.version.number=${hudson.build.number}
gal.version.tag=${hudson.svn.branch}-${hudson.build.id}
gal.version.job.name=${hudson.job.name}
gal.version.hudson.subversion.tag=${hudson.subversion.tag}
gal.version.hudson.clearcase.tag=${hudson.clearcase.tag}
gal.version.version=${hudson.version.tag}
PrintNetKnap=${hudson.build.number}




version.properties
---------------------------------------
gal.version.id=Not built from Hudson - 2009-12-04,13:57:40
gal.version.number=Not built from Hudson - 2009-12-04,13:57:40
gal.version.tag=SVN_BRANCH was not specified-Not built from Hudson - 2009-12-04,13:57:40
gal.version.job.name=Not built from Hudson
gal.version.hudson.subversion.tag=P-trunk-V2-99-2009-05-20_02-01-31
gal.version.hudson.clearcase.tag=No tag. No sync yet.
gal.version.version=${hudson.version.tag}
PrintNetKnap=332



sync_to_clearcase.xml
---------------------------------

<target name="start5" >
		<property name="subversion.tag" value="P_trunk_${env.BUILD_ID}" /> 
		<echo>Substituting values in version.properties for P view in clearcase</echo>
  	<property environment="env" />        
 		 <copy file="../../resources/version/version.properties" toFile="../../Dresources/version/version.properties.tmp" overwrite="true" >
  			<filterset begintoken="No tag" endtoken="yet.">
  					<filter token="No tag. No sync yet." value="P_trunk_${env.BUILD_ID}"/>              
  			</filterset>
  		</copy>	
        
 		 <move file="../../Dresources/version/version.properties.tmp" toFile="../../resources/version/version.properties" overwrite="true" />
		<antcall target="do-the-stuff"/>
	</target>

Open in new window

0
Comment
Question by:Mickeys
  • 3
  • 3
6 Comments
 
LVL 5

Expert Comment

by:TomLun
ID: 26124210
The begin/end token marks the prefix/suffix of the token.
So with the beginToken="No tag" and endToken="yet." the token should be ". No sync " i.e.
 beginToken+token+endToken="No tag. No sync yet".
0
 

Author Comment

by:Mickeys
ID: 26124317
I didnt really understand that.

If this is what I want to look for:  No tag. No sync yet

What should here be written instead for this?
beginToken="No tag" and endToken="yet."
0
 
LVL 5

Expert Comment

by:TomLun
ID: 26124326
With the beginToken and endToken you're using the token becomes '. No sync '.

If beginToken and endToken is @ then you're matching @XXXX@ where XXXX is the token.
You have beginToken=No tag (the first @), and endToken=yet. (the last @).
0
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 

Author Comment

by:Mickeys
ID: 26124364
So I shold write what (???)  to make it
No tag. No sync yet.
0
 
LVL 5

Accepted Solution

by:
TomLun earned 2000 total points
ID: 26124500
To follow your setup replace the filterset in sync_to_clearcase.xml with the following:

<filterset begintoken="No tag" endtoken="yet.">
  <filter token=". No sync " value="P_trunk_${env.BUILD_ID}"/>              
</filterset>
0
 

Author Closing Comment

by:Mickeys
ID: 31669328
It works. Thx
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Here is a helpful source code for C++ Builder programmers that allows you to manage and manipulate HTML content from C++ code, while also handling HTML events like onclick, onmouseover, ... Some objects defined and used in this source include: …
Jaspersoft Studio is a plugin for Eclipse that lets you create reports from a datasource.  In this article, we'll go over creating a report from a default template and setting up a datasource that connects to your database.
This tutorial covers a step-by-step guide to install VisualVM launcher in eclipse.
The viewer will learn how to use NetBeans IDE 8.0 for Windows to connect to a MySQL database. Open Services Panel: Create a new connection using New Connection Wizard: Create a test database called eetutorial: Create a new test tabel called ee…
Suggested Courses

862 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question