What is best practice for RPM packaging something that provides a library which in name shadows a system library?
Background:
For an RPM-backed Linux system, I am packaging a "self-contained" app foo that wants to live under /opt and supply as many of its own dependencies as it can, so as not to rely on the versions installed on the main system. (foo uses LD_LIBRARY_PATH to avoid system libraries.)
Unfortunately, one of the foo dependencies is a library grunk, whose version is exactly that of the libgrunk.so required for the main system. RPM's automatic Provides: generation then identifies two RPMs as providing this library. (That's not really true — only the system package makes the library available to any program whatsoever, whereas the foo package makes it available only to foo.)
This confounds automatic dependency resolution sometimes. For example, yum might install the wrong package or only one package when two are needed.
Example:
grunk-libs-1.2-3.$arch.rpm # System Library
Files:
%{_libdir}/libgrunk.so.1
%{_libdir}/libgrunk.so.1.2
Provides:
libgrunk.so.1()(%{_arch})
foo-x.y.z-r.$arch.rpm # App
Files:
/opt/foo
/opt/foo/bin/...
Requires:
libgrunk.so.1()(%{_arch}) # foo needs grunk, but wants its own instance
foo-grunklibs-1.2-1.$arch.rpm # App Dependency
Files:
/opt/foo/libs/libgrunk.so.1
/opt/foo/libs/libgrunk.so.1.2
Provides:
libgrunk.so.1()(%{_arch}) # <-- same as from system "grunk-libs"
I've disabled AutoReqProv for now, but I want to be able to take advantage of RPM's automatic capabilities and dependency generation. I want RPM to know that foo.rpm does require foo-grunklibs.rpm by virtue of the latter's libgrunk.so.1, but also know that the same library from the main system rpm won't suffice.
I think I'm at the limits of conventional use. Is there a packaging technique I can use here to resolve this?