Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8374093
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T14:50:40+00:00 2026-06-09T14:50:40+00:00

I am trying to create an Ant script that will create a label in

  • 0

I am trying to create an Ant script that will create a label in ClearCase and then apply the label to the latest version of any file where the latest version does not have a label.

I am using this to create the label:

<ccmklbtype typename="${label.name}" failonerr="false" 
 ordinary="true" comment="${label.comment}"/>

When I use this to add the labels:

<ccmklabel viewpath="${view.path}" comment="${label.comment}" recurse="true"
 typename="${label.name}" replace="false" version="\main\${side.branch}\LATEST"/>

It is, of course, adding the label to everything in the view path. My desired behavior would be to only add the label if the item doesn’t already have a label on the latest version.

I can do what is desired via a command prompt, but I am trying to see if it can be done via Ant.

Does anyone have any ideas?

It looks like there is not a way to just label something that doesn’t already have a name. Instead, I set it up to use an exec block in ANT that will label anything if it isn’t labeled already with one of the labels used previously:

<target name="add_labels" description="Look for LATEST code that does not have a previous version label already on it.  Skip the 0 generation as that is brought in from a previous release.">
<exec executable="cleartool" dir="${view.path}">
<arg value="find" />
<arg value="." />
<arg value="-ver" />
<arg value="version(\main\${side.branch}\LATEST)&amp;&amp;!version(\main\${side.branch}\0)${history.check}" />
<arg value="-exec" />
<arg value="cleartool mklabel -replace ${label.name} %CLEARCASE_XPN%" />
</exec>
</target>

It seems to work in testing.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-09T14:50:41+00:00Added an answer on June 9, 2026 at 2:50 pm

    Looking at the man page of ccmklabel, you see:

    replace bool
    If true, allow the replacement of a label of the same type on the same branch.
    The default is false.

    So with replace=true, if a file hasn’t a label on the latest version, it will be put (or moved to) said LATEST version.


    In the OP ruminator‘s case, he only wants to add a label if the version does not have one already.

    2 approaches are possible:

    • ccmklabel in a view which already select only the versions you want to label.
      Hard to do since the only version selector usable in a config spec is \main\${side.branch}\'{!lbtype(MY_TEST)}, which select the last version which isn’t labelled ‘MY_TEST‘ (and that doesn’t fit exactly the initial selection criteria)

    • don’t use ccmklabel in the ant script, and call insteald directly a cleartool find directive (which is more precise and can combine more version selectors than in a view config spec).
      That is what the OP ruminator illustrates in his question update:

    The find query focus on LATEST versions which haven’t the right label:

    <exec executable="cleartool" dir="${view.path}">
      <arg value="find" />
      <arg value="." />
      <arg value="-ver" />
      <arg value="version(\main\${side.branch}\LATEST)&amp;&amp;!version(\main\${side.branch}\0)${history.check}" />
      <arg value="-exec" />
      <arg value="cleartool mklabel -replace ${label.name} %CLEARCASE_XPN%" />
    </exec>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am new to ant, but am trying to create an ant script that
Here's the situation: I trying to make a ant test script that does the
I'm trying to execute iisvdir from an ant script to clean and create a
Greeting, I'm trying to put some Beanshell script in my Ant build.xml file. I've
I am trying to make a Ant script that would promote the SA for
I am trying to create a rpm package using ant task for that I
I'm currently trying create a service that will return results of a OLAP cube
I'm trying to create an ANT task that takes some database properties and executes
Trying to create a grails ant task that has other environments besides prod for
Ok so I am trying create a login script, here I am using PHP5

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.