In my spec file for packaging a python rpm, I want to remove certain filetypes in certain directories:
e.g., I want to exclude source *.py files in these directories:
lib/*.py
comm/*.py
I think I should do this in the %file section of my spec. Any suggestions?
Or just remove them from buildroot:
You need to use %exclude macro, i.e.
At one point in the distant past, you did that by just not including the files you didn't want in the
%file
section, and so they would not be packaged. That might have turned out to be too error prone, and so some RPM implementations started complaining about unpackaged files. Since RPM development has always been a bit fragmented and underdocumented, it's not clear to me what the canonical solution is, but I propose that the safest way is to just remove the files at the end of your installation routine. That approach will also easily transport to other packaging systems such as dpkg.