Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

listing all files and subdirectories using ant

Tags:

ant

I am trying to create a rpm package using ant task for that I need to create specfile which will have all the file names in the following format

%attr(0755, root, root) %dir dir1
%attr(0755, root, root) %dir dir1/dir2
%attr(0755, root, root) %dir dir1/dir2/dir3

%attr(0500, root, root) dir1/file1
%attr(0500, root, root) dir1/dir2/file1

I have such directory structure created during my build process but using ant I am not able to list all the files and directories which I can then write into my specfile

following is what I have tried to list the files but it does not differentiate between files and directory , moreover I need some way to iterate over the list.

<fileset id="dist.contents" dir="${nativePackageDir}" includes="**"/>                                     |        
        <property name="prop.dist.contents" refid="dist.contents"/>                                               |  <target name="javaobject-library" depends="props">                                                             
        <echo>${prop.dist.contents}</echo>   
like image 817
Avinash Avatar asked May 10 '12 05:05

Avinash


1 Answers

<dirset id="dist.contents" dir="${nativePackageDir}" includes="*"/> 
<property name="prop.dist.contents" refid="dist.contents"/>
<echo>${prop.dist.contents}</echo>

Using dirset instead of fileset should fix your problem.

like image 64
Aneesh Vijendran Avatar answered Oct 20 '22 01:10

Aneesh Vijendran