0

Is it possible to tell an rpmbuild spec file to ignore a file in the files list if it doesn't exist?

Something like:

%files
%{existingfile}
if [ -f %{dtdfile} ]; then
%{dtdfile}
fi
Rudolf Vavruch
  • 495
  • 2
  • 6
  • 13
  • 1
    Please don't do that. Either include the file or delete it. – Ignacio Vazquez-Abrams Jan 11 '10 at 19:45
  • This spec file is a part of template to be used as the starting point by a number of different packages, and the only difference between the packages (as far as the packager is concerned) is that sometimes a particular file will exist, sometimes not. At the moment, in the %prep script I am checking for the file and touching it if it does not exist, I just thought there might be a more elegant way of doing it. – Rudolf Vavruch Jan 12 '10 at 08:38

1 Answers1

0

It sounds like subpackages may help you out.

In the main package could include all the common files, then each subpackage could return the main package, and also include any additional files particular to that package.

See http://fedoraproject.org/wiki/How_to_create_an_RPM_package#Subpackages and http://www.rpm.org/max-rpm/s1-rpm-subpack-spec-file-changes.html

pwan
  • 2,894
  • 2
  • 24
  • 38