rpmbuild可以通过查找包中包含的二进制文件所需的共享库来自动检测依赖项,虽然这几乎是每次都很好的思考,但是有时候它是不受欢迎的,但仅限于某些特定的库.我指的是一些二进制文件
现在,问题是:有没有办法让自动检测功能保持活动状态(对于包中的其他二进制文件很方便)但是忽略/删除这些特定的库?
就像是
AutoReqIgnore : library1 AutoReqIgnore : library2我没有找到内置方式,但我 wrote a small script that I used as a filter:
#!/usr/bin/perl -w use strict; use IPC::Open2; # This quick script will run the native find-requires (first parameter) # and then strip out packages we don't want listed. open2(\*IN, \*OUT, @ARGV); print OUT while (<STDIN>); close(OUT); my $list = join('', <IN>); # Apply my filter(s): $list =~ s/^libqt-mt.so.*?$//mg; print $list;
您可以放置自己的正则表达式行,在此示例中我删除了libqt-mt.so.*
然后,在.spec文件中:
# Note: 'global' evaluates NOW, 'define' allows recursion later... %global _use_internal_dependency_generator 0 %global __find_requires_orig %{__find_requires} %define __find_requires %{_builddir}/%{?buildsubdir}/build/find-requires %{__find_requires_orig}
如您所见,此脚本位于/ build /下的源tarball中.