質問

I am building a debian package using dpkg.

The package has a dependency on libvirt which is not desired.

The rules file does not specify this dependency, but it is added by dpkg, I suppose due to some calls to libvirt-dev at build time.

However my package works fine without libvirt. As such, libvirt is a "Recommended" package but not "Required". How do I override this dependency and make sure it is not present in my final deb file ?

役に立ちましたか?

解決

Hard to know without seeing your actual package, but I'd guess that you have a binary or shared library which is linked against libvirt. That would cause dh_shlibdeps to include libvirt in the ${shlibs:Depends} substvar.

If that's your problem, then the right fix depends on what's getting linked to libvirt. It should be straightforward to determine; just run ldd on each binary or shared library object in your package, and grep for "libvirt".

If the thing linked against libvirt is only incidental to the package, and isn't part of the main functionality, then using Recommends: would indeed be the right thing. To make dh_shlibdeps exclude that object from its dependency scanning, give it a -X option. Example target for debian/rules, assuming debhelper7-style packaging:

override_dh_shlibdeps:
        dh_shlibdeps -Xname_of_your_object_to_exclude

If the thing(s) linked to libvirt actually are an important part of the package functionality, then the generated libvirt dependency is appropriate. If you still don't want it, you'll need to work out how to avoid linking against libvirt during your build.

ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top