On Jul 1, 2010, at 8:26 AM, Bailey, Darragh wrote:

-----Original Message-----
From: Matt Benson [mailto:gudnabr...@gmail.com]
Sent: 30 June 2010 15:57
To: Ant Users List
Subject: Re: Constructing patterns for use in fileset includes

<snipage>

You're in luck.  I would recommend using antcontrib:for to
iterate over a <tokens> resourcecollection built from your
property + the new <augment> task.  See
http://markmail.org/thread/4qskrvmiyk6qpjdg for a discussion
of a similar strategy for another problem.

HTH,
Matt

It helped lots thanks!
That augment task seems very useful, solves the problem perfectly. Never would have occurred to me to use it.

Not sure about how you were suggesting to use the <tokens> resource collector though?

Here's what I came up with:

Property packages.rpm.build is set to a list of package names to build, minus version and src.rpm extension and comma delimited.

    <fileset dir="${src}" id="rpmstobuild" />
    <!-- perform some manipulations using ant-contrib -->
    <antcontrib:for list="${packages.rpm.build}" param="rpmpkg">
      <sequential>
        <augment id="rpmstobuild">
          <include name="**/@{rpmpkg}*" />
        </augment>
      </sequential>
    </antcontrib:for>

    <apply executable="/usr/bin/rpmbuild" os="Linux" >
      <arg value="--rebuild" />
      <arg value="--define" />
      <arg value="_topdir ${rpm.topdir}" />
      <fileset refid="rpmstobuild" />
    </apply>

How would the <tokens> resource collector fit into this?

Honestly, I was so swept up in stuff-I-wrote that I forgot momentarily that <for> could iterate over a comma-delimited list out of the box. As it can also iterate over any Iterable, tokenizing your property into a resource collection is also doable with <for>, while being completely unnecessary. ;)

-Matt


Obviously I've a little bit of work to do with adding a mapper to track the outputted rpms to help stop the task re-running if it's not necessary.

--
Regards,
Darragh Bailey

Systems Software Engineer
Hewlett Packard Galway Ltd.

Postal Address: Hewlett Packard Galway Limited, Ballybrit Business Park, Galway Registered Office: Hewlett Packard Galway Limited, 63-74 Sir John Rogerson's Quay Dublin 2
Registered Number: 361933


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscr...@ant.apache.org
For additional commands, e-mail: user-h...@ant.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscr...@ant.apache.org
For additional commands, e-mail: user-h...@ant.apache.org

Reply via email to