excluding file types when packaging an rpm

半腔热情 提交于 2019-12-22 08:00:02

问题


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?


回答1:


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.




回答2:


You need to use %exclude macro, i.e.

%files
%exclude /lib/*.py
%exclude /comm/*.py



回答3:


Or just remove them from buildroot:

%install
...
find %{buildroot} -name ".py" -delete


来源:https://stackoverflow.com/questions/4786101/excluding-file-types-when-packaging-an-rpm

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!