excluding file types when packaging an rpm

2019-04-30 09:06发布

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?

3条回答
forever°为你锁心
2楼-- · 2019-04-30 09:36

Or just remove them from buildroot:

%install
...
find %{buildroot} -name ".py" -delete
查看更多
手持菜刀,她持情操
3楼-- · 2019-04-30 09:44

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

%files
%exclude /lib/*.py
%exclude /comm/*.py
查看更多
三岁会撩人
4楼-- · 2019-04-30 09:50

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.

查看更多
登录 后发表回答