Can some specific autodetected dependency be ignored upon rpmbuild

一世执手 提交于 2019-12-30 09:41:06

问题


rpmbuild can autodetect dependencies by looking up shared libraries required by binaries included in the package and, while this is a good think almost every time, there are time when it is undesirable but only for some specific libraries. I am referring to the case where some binary file requires libraries that are not provided to the system via its rpm package management but installed directly by third party installers.

Now, the question is: is there a way to keep the autodetect feature active (comes in handy for the other binaries in the package) but ignore/remove only these specific libraries?

Something like

AutoReqIgnore : library1
AutoReqIgnore : library2

回答1:


I have not found a built-in way, but I 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;

You can put your own regular expression lines, in this example I removed libqt-mt.so.*

Then, in the .spec file:

# 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}

As you can see, this script is in the source tarball under /build/ .




回答2:


As of rpm-4.9 (Fedora 15), rpm has a standard method to enable filtering of the autogenerated dependencies.

For example, you can write

%global __requires_exclude ^libthirdpartyplugin.so$


来源:https://stackoverflow.com/questions/12212712/can-some-specific-autodetected-dependency-be-ignored-upon-rpmbuild

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