Product SiteDocumentation Site

Filling the list of files automatically

The -f option to the %files section allows you to read in a list of file names from a file. This file is assumed to look like the contents of the %files section, holding one file name per line. You can also include the various directives for files such as %attr or %doc. For example:
%files -f list_of_filenames.txt
You can combine this list with filename entries, such as the following:
%files -f xconfig_files.txt
%defattr(-,root,root)
/usr/X11R6/bin/xtoolwait
/usr/X11R6/man/man1/xtoolwait.1
This example reads in a list of file names from the file named xconfig_files.txt and also includes two additional files.
This list of files works best if you cannot determine the file names in advance. The build may create different files based on various macro values. In addition, you may not know the final paths for the files until build time.