ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Pawanraj Sadhwani" <pawan...@elitecore.com>
Subject Different and Present together
Date Fri, 14 May 2004 07:46:35 GMT
Hi all,

I am trying to create an upgrade of a version of software installed on the
client. I am using a different selector to pass the updated files.

However the upgrade directory structure mandates that new files and updated
files are in a different folder.

  <macrodef name="newfiles">
    <attribute name="destdir" description="Where to place list file" />
    <attribute name="dir1"    description="Source dir comparison. Old
version" />
    <attribute name="dir2"    description="Target dir comparison. New
version" />
    <attribute name="prefix"  description="Add before filename" />
  
    <sequential>
      <copy todir="@{destdir}">
        <fileset dir="@{dir2}">
          <not>
            <present targetdir="@{dir1}"/>
          </not>
        </fileset>
      </copy>
      <listfiles dir="@{destdir}" file="new-files.tmp" dirsep="/"
prefix="@{prefix}"/>
    </sequential>
  </macrodef>

  <macrodef name="deletedfiles">
    <attribute name="destdir" description="Where to place list file" />
    <attribute name="dir1"    description="Source dir comparison. Old
version" />
    <attribute name="dir2"    description="Target dir comparison. New
version" />
    <attribute name="prefix"  description="Add before filename" />

    <sequential>
      <copy todir="@{destdir}">
        <fileset dir="@{dir1}">
          <not>
            <present targetdir="@{dir2}"/>
          </not>
        </fileset>
      </copy>
      <listfiles dir="@{destdir}" file="@{destdir}/delete-files.txt"
dirsep="/" prefix="@{prefix}"/>
      <listfiles dir="@{destdir}" file="delete-files.tmp"
dirsep="/" prefix="@{prefix}"/>
      
    </sequential>
  </macrodef>

  <macrodef name="updatedfiles">
    <attribute name="destdir" description="Where to place list file" />
    <attribute name="dir1"    description="Source dir comparison. Old
version" />
    <attribute name="dir2"    description="Target dir comparison. New
version" />
    <attribute name="prefix"  description="Add before filename" />

    <sequential>
      <copy todir="@{destdir}">
        <fileset dir="@{dir2}">
          <different targetdir="@{dir1}" ignorefiletimes="true" />
        </fileset>
      </copy>
      <listfiles dir="@{destdir}" file="delete-files.tmp" dirsep="/"
prefix="@{prefix}"/>
    </sequential>
  </macrodef>

<different selector performs the job of "newfiles" and "updatedfiles" macro
both. is it possible to have it restrict to comparing only those files that
are present in both places?

Thanx in advance

Pawan


Mime
View raw message